{"$schema":"https://json.schemastore.org/sarif-2.1.0.json","version":"2.1.0","runs":[{"tool":{"driver":{"name":"codehealth","informationUri":"https://codehealth.canine.dev","rules":[{"id":"D1","name":"Cyclomatic Complexity","shortDescription":{"text":"Cyclomatic Complexity"},"helpUri":"https://codehealth.canine.dev/dimensions/D1"},{"id":"D2","name":"Cognitive Complexity","shortDescription":{"text":"Cognitive Complexity"},"helpUri":"https://codehealth.canine.dev/dimensions/D2"},{"id":"D3","name":"God Classes","shortDescription":{"text":"God Classes"},"helpUri":"https://codehealth.canine.dev/dimensions/D3"},{"id":"D4","name":"Code Duplication","shortDescription":{"text":"Code Duplication"},"helpUri":"https://codehealth.canine.dev/dimensions/D4"},{"id":"D5","name":"Coupling","shortDescription":{"text":"Coupling"},"helpUri":"https://codehealth.canine.dev/dimensions/D5"},{"id":"D6","name":"Cohesion (LCOM4)","shortDescription":{"text":"Cohesion (LCOM4)"},"helpUri":"https://codehealth.canine.dev/dimensions/D6"},{"id":"D7","name":"Architectural Integrity","shortDescription":{"text":"Architectural Integrity"},"helpUri":"https://codehealth.canine.dev/dimensions/D7"},{"id":"D10","name":"Test Quality","shortDescription":{"text":"Test Quality"},"helpUri":"https://codehealth.canine.dev/dimensions/D10"},{"id":"D13","name":"Secret Scanning","shortDescription":{"text":"Secret Scanning"},"helpUri":"https://codehealth.canine.dev/dimensions/D13","relationships":[{"target":{"id":"CWE-798","toolComponent":{"name":"CWE","guid":"c3a2b1d0-7f3e-4b2a-9c1d-5e6f7a8b9c0d"}},"kinds":["relevant"]},{"target":{"id":"CWE-259","toolComponent":{"name":"CWE","guid":"c3a2b1d0-7f3e-4b2a-9c1d-5e6f7a8b9c0d"}},"kinds":["relevant"]},{"target":{"id":"A07:2025","toolComponent":{"name":"OWASP Top 10","guid":"7d1f0c2e-4b6a-4e39-9a51-0b2e8c3d5f61"}},"kinds":["relevant"]}],"properties":{"cwe":["CWE-798","CWE-259"],"owasp":"A07:2025"}},{"id":"D14","name":"License Compliance","shortDescription":{"text":"License Compliance"},"helpUri":"https://codehealth.canine.dev/dimensions/D14"},{"id":"D15","name":"Churn \u00D7 Complexity Hotspots","shortDescription":{"text":"Churn \u00D7 Complexity Hotspots"},"helpUri":"https://codehealth.canine.dev/dimensions/D15"},{"id":"D17","name":"Explicit Debt","shortDescription":{"text":"Explicit Debt"},"helpUri":"https://codehealth.canine.dev/dimensions/D17"},{"id":"D20","name":"ADR Quality","shortDescription":{"text":"ADR Quality"},"helpUri":"https://codehealth.canine.dev/dimensions/D20"},{"id":"D21","name":"Naming Consistency","shortDescription":{"text":"Naming Consistency"},"helpUri":"https://codehealth.canine.dev/dimensions/D21"},{"id":"D27","name":"Navigability","shortDescription":{"text":"Navigability"},"helpUri":"https://codehealth.canine.dev/dimensions/D27"},{"id":"D28","name":"Secrets (history)","shortDescription":{"text":"Secrets (history)"},"helpUri":"https://codehealth.canine.dev/dimensions/D28","relationships":[{"target":{"id":"CWE-798","toolComponent":{"name":"CWE","guid":"c3a2b1d0-7f3e-4b2a-9c1d-5e6f7a8b9c0d"}},"kinds":["relevant"]},{"target":{"id":"CWE-259","toolComponent":{"name":"CWE","guid":"c3a2b1d0-7f3e-4b2a-9c1d-5e6f7a8b9c0d"}},"kinds":["relevant"]},{"target":{"id":"A07:2025","toolComponent":{"name":"OWASP Top 10","guid":"7d1f0c2e-4b6a-4e39-9a51-0b2e8c3d5f61"}},"kinds":["relevant"]}],"properties":{"cwe":["CWE-798","CWE-259"],"owasp":"A07:2025"}},{"id":"D29","name":"Static Analysis (SAST)","shortDescription":{"text":"Static Analysis (SAST)"},"helpUri":"https://codehealth.canine.dev/dimensions/D29","relationships":[{"target":{"id":"CWE-79","toolComponent":{"name":"CWE","guid":"c3a2b1d0-7f3e-4b2a-9c1d-5e6f7a8b9c0d"}},"kinds":["relevant"]},{"target":{"id":"CWE-89","toolComponent":{"name":"CWE","guid":"c3a2b1d0-7f3e-4b2a-9c1d-5e6f7a8b9c0d"}},"kinds":["relevant"]},{"target":{"id":"CWE-78","toolComponent":{"name":"CWE","guid":"c3a2b1d0-7f3e-4b2a-9c1d-5e6f7a8b9c0d"}},"kinds":["relevant"]},{"target":{"id":"CWE-94","toolComponent":{"name":"CWE","guid":"c3a2b1d0-7f3e-4b2a-9c1d-5e6f7a8b9c0d"}},"kinds":["relevant"]},{"target":{"id":"CWE-77","toolComponent":{"name":"CWE","guid":"c3a2b1d0-7f3e-4b2a-9c1d-5e6f7a8b9c0d"}},"kinds":["relevant"]},{"target":{"id":"A05:2025","toolComponent":{"name":"OWASP Top 10","guid":"7d1f0c2e-4b6a-4e39-9a51-0b2e8c3d5f61"}},"kinds":["relevant"]}],"properties":{"cwe":["CWE-79","CWE-89","CWE-78","CWE-94","CWE-77"],"owasp":"A05:2025"}},{"id":"D34","name":"Knowledge Freshness","shortDescription":{"text":"Knowledge Freshness"},"helpUri":"https://codehealth.canine.dev/dimensions/D34"},{"id":"D35","name":"Change Coupling","shortDescription":{"text":"Change Coupling"},"helpUri":"https://codehealth.canine.dev/dimensions/D35"},{"id":"AX10","name":"Code composition","shortDescription":{"text":"Code composition"},"helpUri":"https://codehealth.canine.dev/dimensions/AX10"},{"id":"AX3","name":"Project dependency cycles","shortDescription":{"text":"Project dependency cycles"},"helpUri":"https://codehealth.canine.dev/dimensions/AX3"},{"id":"AX4","name":"Dependency direction","shortDescription":{"text":"Dependency direction"},"helpUri":"https://codehealth.canine.dev/dimensions/AX4"},{"id":"AX6","name":"Interface segregation","shortDescription":{"text":"Interface segregation"},"helpUri":"https://codehealth.canine.dev/dimensions/AX6"},{"id":"AX8","name":"Test isolation","shortDescription":{"text":"Test isolation"},"helpUri":"https://codehealth.canine.dev/dimensions/AX8"},{"id":"AX9","name":"CQS / query purity","shortDescription":{"text":"CQS / query purity"},"helpUri":"https://codehealth.canine.dev/dimensions/AX9"},{"id":"AXB1","name":"Runtime evidence locked \u2014 no reproducible boot","shortDescription":{"text":"Runtime evidence locked \u2014 no reproducible boot"},"helpUri":"https://codehealth.canine.dev/dimensions/AXB1"},{"id":"ED5","name":"Idempotency","shortDescription":{"text":"Idempotency"},"helpUri":"https://codehealth.canine.dev/dimensions/ED5"},{"id":"M1","name":"Documentation (README)","shortDescription":{"text":"Documentation (README)"},"helpUri":"https://codehealth.canine.dev/dimensions/M1"},{"id":"M2","name":"Architecture documentation","shortDescription":{"text":"Architecture documentation"},"helpUri":"https://codehealth.canine.dev/dimensions/M2"},{"id":"M3","name":"Folder \u0026 project structure","shortDescription":{"text":"Folder \u0026 project structure"},"helpUri":"https://codehealth.canine.dev/dimensions/M3"},{"id":"M4","name":"Documentation accuracy","shortDescription":{"text":"Documentation accuracy"},"helpUri":"https://codehealth.canine.dev/dimensions/M4"},{"id":"P1","name":"CI/CD gates","shortDescription":{"text":"CI/CD gates"},"helpUri":"https://codehealth.canine.dev/dimensions/P1"},{"id":"P10","name":"Library API \u0026 versioning","shortDescription":{"text":"Library API \u0026 versioning"},"helpUri":"https://codehealth.canine.dev/dimensions/P10"},{"id":"P2","name":"Observability","shortDescription":{"text":"Observability"},"helpUri":"https://codehealth.canine.dev/dimensions/P2"},{"id":"P3","name":"Security \u0026 performance tooling","shortDescription":{"text":"Security \u0026 performance tooling"},"helpUri":"https://codehealth.canine.dev/dimensions/P3"},{"id":"P6","name":"Release Hygiene","shortDescription":{"text":"Release Hygiene"},"helpUri":"https://codehealth.canine.dev/dimensions/P6"},{"id":"PF3","name":"Async \u0026 latency hygiene","shortDescription":{"text":"Async \u0026 latency hygiene"},"helpUri":"https://codehealth.canine.dev/dimensions/PF3"},{"id":"X10","name":"Duplicated predicate","shortDescription":{"text":"Duplicated predicate"},"helpUri":"https://codehealth.canine.dev/dimensions/X10"},{"id":"X14","name":"Bypassable address classification","shortDescription":{"text":"Bypassable address classification"},"helpUri":"https://codehealth.canine.dev/dimensions/X14"},{"id":"X19","name":"Unrestored process-global state","shortDescription":{"text":"Unrestored process-global state"},"helpUri":"https://codehealth.canine.dev/dimensions/X19"},{"id":"X20","name":"Mistyped argument guard","shortDescription":{"text":"Mistyped argument guard"},"helpUri":"https://codehealth.canine.dev/dimensions/X20"},{"id":"X21","name":"Side-effecting pattern guard","shortDescription":{"text":"Side-effecting pattern guard"},"helpUri":"https://codehealth.canine.dev/dimensions/X21"},{"id":"X26","name":"Unsynchronised callback handoff","shortDescription":{"text":"Unsynchronised callback handoff"},"helpUri":"https://codehealth.canine.dev/dimensions/X26"},{"id":"X27","name":"Collection changed while being enumerated","shortDescription":{"text":"Collection changed while being enumerated"},"helpUri":"https://codehealth.canine.dev/dimensions/X27"},{"id":"X28","name":"Index access outside its own emptiness guard","shortDescription":{"text":"Index access outside its own emptiness guard"},"helpUri":"https://codehealth.canine.dev/dimensions/X28"},{"id":"X3","name":"Exception handling","shortDescription":{"text":"Exception handling"},"helpUri":"https://codehealth.canine.dev/dimensions/X3"},{"id":"X32","name":"Type resolved by simple name across every loaded assembly","shortDescription":{"text":"Type resolved by simple name across every loaded assembly"},"helpUri":"https://codehealth.canine.dev/dimensions/X32"},{"id":"X4","name":"Structured logging","shortDescription":{"text":"Structured logging"},"helpUri":"https://codehealth.canine.dev/dimensions/X4"},{"id":"X6","name":"Hand-rolled structured-format parsing","shortDescription":{"text":"Hand-rolled structured-format parsing"},"helpUri":"https://codehealth.canine.dev/dimensions/X6"},{"id":"X7","name":"Silent fallback defaults","shortDescription":{"text":"Silent fallback defaults"},"helpUri":"https://codehealth.canine.dev/dimensions/X7"},{"id":"X9","name":"Subsumed condition operand","shortDescription":{"text":"Subsumed condition operand"},"helpUri":"https://codehealth.canine.dev/dimensions/X9"}]}},"results":[{"ruleId":"D1","level":"warning","message":{"text":"SimpleLoRATrainer.train (cyclomatic 95): SimpleLoRATrainer.train has cyclomatic complexity 95 (threshold 15). Of this number, 89 points are the body\u0027s 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":244}}}],"partialFingerprints":{"codehealthFindingId/v1":"81849bd4af8d18f72355cd431c9b72cfa774f8b81a8e30d9b817940016816b8f"}},{"ruleId":"D1","level":"warning","message":{"text":"Flux2Pipeline.generateWithResult (cyclomatic 93): Flux2Pipeline.generateWithResult has cyclomatic complexity 93 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/Flux2Pipeline.swift"},"region":{"startLine":1215}}}],"partialFingerprints":{"codehealthFindingId/v1":"2bd75828c373ddd65a5f8e20610ad9fd29c0ba283e06f343c1111e636eda1009"}},{"ruleId":"D1","level":"warning","message":{"text":"ImageToImage.run (cyclomatic 67): ImageToImage.run has cyclomatic complexity 67 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/Flux2CLI.swift"},"region":{"startLine":486}}}],"partialFingerprints":{"codehealthFindingId/v1":"942d79e2324076237b4a5e14394173b16b0245b28723ba551d1bd8b11bba9b2e"}},{"ruleId":"D1","level":"warning","message":{"text":"TextToImage.run (cyclomatic 51): TextToImage.run has cyclomatic complexity 51 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/Flux2CLI.swift"},"region":{"startLine":125}}}],"partialFingerprints":{"codehealthFindingId/v1":"8796c91bfb85cbd4e66bd16e9fe36c45b87f0e846dadf6851368ba966834f0b2"}},{"ruleId":"D1","level":"warning","message":{"text":"Flux2WeightLoader.mapBFLTransformerWeights (cyclomatic 43): Flux2WeightLoader.mapBFLTransformerWeights has cyclomatic complexity 43 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Loading/WeightLoader.swift"},"region":{"startLine":87}}}],"partialFingerprints":{"codehealthFindingId/v1":"60843503a85307483f2b723d622bdcc3fffcb6a52c1a2137627fc0591e38e64c"}},{"ruleId":"D1","level":"warning","message":{"text":"FluxToolsView.body (cyclomatic 33): FluxToolsView.body has cyclomatic complexity 33 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ContentView.swift"},"region":{"startLine":1231}}}],"partialFingerprints":{"codehealthFindingId/v1":"8dd415f7e99d354845d1eac4cecfce0023849a10057543b515392d6fde4b41f7"}},{"ruleId":"D1","level":"warning","message":{"text":"TrainLoRA.runSimpleTrainer (cyclomatic 29): TrainLoRA.runSimpleTrainer 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/TrainLoRACommand.swift"},"region":{"startLine":638}}}],"partialFingerprints":{"codehealthFindingId/v1":"d1e9ab65ba3b3126a9a519f3a51e07615afebe46dacff652f0c0c63e3c831819"}},{"ruleId":"D1","level":"warning","message":{"text":"SimpleLoRATrainer.trainStep (cyclomatic 28): SimpleLoRATrainer.trainStep has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":902}}}],"partialFingerprints":{"codehealthFindingId/v1":"49ff6165976a718fd3c8dd393cf7dd1517b7f28511d7a3cf0e4f2dc055599f80"}},{"ruleId":"D1","level":"warning","message":{"text":"Flux2FusedKernels.applyRotaryEmb (cyclomatic 25): Flux2FusedKernels.applyRotaryEmb 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Transformer/Flux2FusedKernels.swift"},"region":{"startLine":99}}}],"partialFingerprints":{"codehealthFindingId/v1":"249f141218e31e7f8cd11873dcde2c190896234d165e20b7d686ab131bb939db"}},{"ruleId":"D1","level":"warning","message":{"text":"FluxToolsView.processAction (cyclomatic 23): FluxToolsView.processAction 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ContentView.swift"},"region":{"startLine":1456}}}],"partialFingerprints":{"codehealthFindingId/v1":"d3f339195e05c7b53cad0d81519bf5081a01f8dcc0c5a9a8763e9f4ad41e2b90"}},{"ruleId":"D1","level":"warning","message":{"text":"TrainLoRA.run (cyclomatic 23): TrainLoRA.run 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/TrainLoRACommand.swift"},"region":{"startLine":220}}}],"partialFingerprints":{"codehealthFindingId/v1":"e505c04c8976443a2a3311fe22e9b665798b86d6e4273b330d835ffd6a838e3a"}},{"ruleId":"D1","level":"warning","message":{"text":"SimpleLoRATrainer.findLoRALayer (cyclomatic 23): SimpleLoRATrainer.findLoRALayer 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":1686}}}],"partialFingerprints":{"codehealthFindingId/v1":"9e890cf8d25c5aea0c757248237194d96da80b3dd78b15ba3cbe00365f6e47f0"}},{"ruleId":"D1","level":"warning","message":{"text":"SimpleLoRATrainer.scoreValidationImagesWithVLM (cyclomatic 22): SimpleLoRATrainer.scoreValidationImagesWithVLM 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":2072}}}],"partialFingerprints":{"codehealthFindingId/v1":"fd05803333d2c05f569d3d7f400b6aebe5cb56895052389668df5cda01ceed3e"}},{"ruleId":"D1","level":"warning","message":{"text":"Flux2Pipeline.preprocessImageForVAE (cyclomatic 20): Flux2Pipeline.preprocessImageForVAE 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/Flux2Pipeline.swift"},"region":{"startLine":2323}}}],"partialFingerprints":{"codehealthFindingId/v1":"cc21d0cced4d5a35daa35280f902e1b4a8bdab6bc0c8f3bc33a55d8ea38b7d4a"}},{"ruleId":"D1","level":"warning","message":{"text":"MistralVLM.loadWeights (cyclomatic 20): MistralVLM.loadWeights 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Vision/MistralVLM.swift"},"region":{"startLine":704}}}],"partialFingerprints":{"codehealthFindingId/v1":"55382631fd7b9bd289f803222a5268e3edc2835357a6e5e331999857c8d0d6f0"}},{"ruleId":"D1","level":"warning","message":{"text":"LoRALoader.mapBFLPathToSwiftPath (cyclomatic 19): LoRALoader.mapBFLPathToSwiftPath has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/LoRA/LoRALoader.swift"},"region":{"startLine":343}}}],"partialFingerprints":{"codehealthFindingId/v1":"27d669a86871cfea1b58aa8f5902f712a2611c2129f4efa5655a3a91653b5a36"}},{"ruleId":"D1","level":"warning","message":{"text":"Inpaint.run (cyclomatic 18): Inpaint.run has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body\u0027s 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/InpaintCommand.swift"},"region":{"startLine":139}}}],"partialFingerprints":{"codehealthFindingId/v1":"122adc1d429e3fa2b6ba8479b05f332ec7e6d4a9ec7c0995f811311537f61dcd"}},{"ruleId":"D1","level":"warning","message":{"text":"TrainLoRA.printConfigSummary (cyclomatic 18): TrainLoRA.printConfigSummary 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/TrainLoRACommand.swift"},"region":{"startLine":552}}}],"partialFingerprints":{"codehealthFindingId/v1":"d918dedc9573b6d698a9516ae6efc22bdbacef437ba4047f578934126f9b175c"}},{"ruleId":"D1","level":"warning","message":{"text":"Flux2SubjectMask.renderInvertedMask (cyclomatic 18): Flux2SubjectMask.renderInvertedMask 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Chains/Flux2SubjectMask.swift"},"region":{"startLine":156}}}],"partialFingerprints":{"codehealthFindingId/v1":"94690e26a7f8785d3fdfd294dda93afcf3f1f289d57b1184edf6126e2734a9a3"}},{"ruleId":"D1","level":"warning","message":{"text":"LoRALoader.parseAndMapWeights (cyclomatic 18): LoRALoader.parseAndMapWeights 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/LoRA/LoRALoader.swift"},"region":{"startLine":104}}}],"partialFingerprints":{"codehealthFindingId/v1":"ac41434ca1be5cc610e6597758edadc63e5366b0c98aa22970b90954fc6b47f8"}},{"ruleId":"D1","level":"warning","message":{"text":"Flux2WeightLoader.mergeLoRAWeights (cyclomatic 18): Flux2WeightLoader.mergeLoRAWeights 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Loading/WeightLoader.swift"},"region":{"startLine":760}}}],"partialFingerprints":{"codehealthFindingId/v1":"d99a612a7e5e56ce86c0f76e32a2f6dc1b2ab3f27f62fc95dafee73da2053aba"}},{"ruleId":"D1","level":"warning","message":{"text":"Flux2Pipeline.loadTransformer (cyclomatic 17): Flux2Pipeline.loadTransformer 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/Flux2Pipeline.swift"},"region":{"startLine":483}}}],"partialFingerprints":{"codehealthFindingId/v1":"783b6d5ee94ae97b2d4acbacd48cee8cd0cc15651f02fcb919f52187ae21f059"}},{"ruleId":"D1","level":"warning","message":{"text":"Flux2Transformer2DModel.getLoRAParameters (cyclomatic 17): Flux2Transformer2DModel.getLoRAParameters has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Flux2Transformer2DModel.unfreezeLoRAParameters) has the same decision points, in the same order, at the same nesting depths \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Model/LoRALinear.swift"},"region":{"startLine":210}}}],"partialFingerprints":{"codehealthFindingId/v1":"4b8f8bbeb945fc864e63d869cca53df926cff917c50d9ef8111f139ade4d192a"}},{"ruleId":"D1","level":"warning","message":{"text":"Flux2Transformer2DModel.unfreezeLoRAParameters (cyclomatic 17): Flux2Transformer2DModel.unfreezeLoRAParameters has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Flux2Transformer2DModel.getLoRAParameters) has the same decision points, in the same order, at the same nesting depths \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Model/LoRALinear.swift"},"region":{"startLine":304}}}],"partialFingerprints":{"codehealthFindingId/v1":"2b7dc91d5a960da5c41a168f99e1795cfd8f10409cc343539701282d7e3cb647"}},{"ruleId":"D1","level":"warning","message":{"text":"Flux2TransformerBlock.callAsFunction (cyclomatic 17): Flux2TransformerBlock.callAsFunction has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: 2 other methods here (Flux2TransformerBlock.callWithKVExtraction, Flux2TransformerBlock.callWithKVCached) have the same decision points, in the same order, at the same nesting depths \u2014 so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Transformer/Flux2TransformerBlock.swift"},"region":{"startLine":80}}}],"partialFingerprints":{"codehealthFindingId/v1":"c73708f19b9f6124b55e233d5eff3aa12c7b8dd8b993a391896f83af9c0627ac"}},{"ruleId":"D1","level":"warning","message":{"text":"Flux2TransformerBlock.callWithKVExtraction (cyclomatic 17): Flux2TransformerBlock.callWithKVExtraction has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: 2 other methods here (Flux2TransformerBlock.callAsFunction, Flux2TransformerBlock.callWithKVCached) have the same decision points, in the same order, at the same nesting depths \u2014 so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Transformer/Flux2TransformerBlock.swift"},"region":{"startLine":173}}}],"partialFingerprints":{"codehealthFindingId/v1":"ed96f25c501884ea84de7e50c9f0d696580a3378488a0ea7f4a354434476fed5"}},{"ruleId":"D1","level":"warning","message":{"text":"Flux2TransformerBlock.callWithKVCached (cyclomatic 17): Flux2TransformerBlock.callWithKVCached has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: 2 other methods here (Flux2TransformerBlock.callAsFunction, Flux2TransformerBlock.callWithKVExtraction) have the same decision points, in the same order, at the same nesting depths \u2014 so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Transformer/Flux2TransformerBlock.swift"},"region":{"startLine":253}}}],"partialFingerprints":{"codehealthFindingId/v1":"3f885d18196aabe8937ed6dad1a7b9680c81eec93a317a29ffd76c5028c2a734"}},{"ruleId":"D1","level":"warning","message":{"text":"SimpleLoRATrainer.addGradients (cyclomatic 17): SimpleLoRATrainer.addGradients has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 3 of the 17 points are its own statements and the rest belongs to one function item inside it that branches (addRecursively). 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":1460}}}],"partialFingerprints":{"codehealthFindingId/v1":"290cb053dbad74f4742511db15b3f0e6ca6292cfb31c98790d999d1dece60df6"}},{"ruleId":"D1","level":"warning","message":{"text":"SimpleLoRATrainer.parseVLMScores (cyclomatic 17): SimpleLoRATrainer.parseVLMScores 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":2223}}}],"partialFingerprints":{"codehealthFindingId/v1":"3b275ff08872a2a2e4bdf5285b53b11c1023761e7830a11c35a2be863df66ccb"}},{"ruleId":"D1","level":"warning","message":{"text":"ModelStatusBar.mistralStatusBar (cyclomatic 16): ModelStatusBar.mistralStatusBar 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ContentView.swift"},"region":{"startLine":149}}}],"partialFingerprints":{"codehealthFindingId/v1":"c1a189458fb2cd9e36318ea3d8f53323f617ab1fb2ca9f8592bab66f1c318ecb"}},{"ruleId":"D1","level":"warning","message":{"text":"ModelStatusBar.qwen3StatusBar (cyclomatic 16): ModelStatusBar.qwen3StatusBar 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ContentView.swift"},"region":{"startLine":247}}}],"partialFingerprints":{"codehealthFindingId/v1":"41de55223771d9c0129e8b06074178edc87aa086d51c9c1ca97879f00a83dbf7"}},{"ruleId":"D1","level":"warning","message":{"text":"Flux2OutpaintingChain.buildSmartMask (cyclomatic 16): Flux2OutpaintingChain.buildSmartMask 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Chains/Flux2OutpaintingChain.swift"},"region":{"startLine":398}}}],"partialFingerprints":{"codehealthFindingId/v1":"831660193c40db2fd4933450025ff49cd65f0c375ecd7afff150cd3ea8dec978"}},{"ruleId":"D1","level":"warning","message":{"text":"Flux2Pipeline.exportPrequantizedTransformer (cyclomatic 16): Flux2Pipeline.exportPrequantizedTransformer 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/Flux2Pipeline.swift"},"region":{"startLine":774}}}],"partialFingerprints":{"codehealthFindingId/v1":"d6fc09c5de8482212fc9c89c36f51b2781d35f576ea12927cbce939a6e6c25e1"}},{"ruleId":"D1","level":"warning","message":{"text":"LoRATrainingConfig.estimateMemoryGB (cyclomatic 16): LoRATrainingConfig.estimateMemoryGB has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform \u2014 the same kind of value, with no behaviour of its own \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Configuration/LoRATrainingConfig.swift"},"region":{"startLine":931}}}],"partialFingerprints":{"codehealthFindingId/v1":"6c4b95117c17c3bcc105fec10a9a287e43dae5621a472a9c353f989501d1b105"}},{"ruleId":"D1","level":"warning","message":{"text":"SimpleLoRATrainer.combineGradients::combineRecursively (cyclomatic 16): SimpleLoRATrainer.combineGradients::combineRecursively 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":1405}}}],"partialFingerprints":{"codehealthFindingId/v1":"fa7bed03268ec38acd397c9105a899faf58d9b580fb7b03e0fefd9c61c6936a4"}},{"ruleId":"D1","level":"warning","message":{"text":"Upsample.run (cyclomatic 16): Upsample.run 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxEncodersCLI/FluxEncodersCLI.swift"},"region":{"startLine":517}}}],"partialFingerprints":{"codehealthFindingId/v1":"416e77faa91c9791c2ecd1193e30fa66ea9fa11bc20fa15519d2e106af883dae"}},{"ruleId":"D1","level":"warning","message":{"text":"Qwen3Generator.chat (cyclomatic 16): Qwen3Generator.chat 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Generation/Qwen3Generator.swift"},"region":{"startLine":170}}}],"partialFingerprints":{"codehealthFindingId/v1":"0b183ee31d57e5cb68cfa3e7c73d6259ce29cd53a3bcd3ddf5a068a58dbccd8a"}},{"ruleId":"D1","level":"warning","message":{"text":"TekkenTokenizer.loadTekkenTokenizerFromFile (cyclomatic 16): TekkenTokenizer.loadTekkenTokenizerFromFile 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Tokenizer/TekkenTokenizer.swift"},"region":{"startLine":115}}}],"partialFingerprints":{"codehealthFindingId/v1":"485a12a48898ff1f8e3ce891caac23468a4e600e5377369b4d139a6ff6dc5e8c"}},{"ruleId":"D2","level":"warning","message":{"text":"Flux2Pipeline.generateWithResult (cognitive 194): Flux2Pipeline.generateWithResult has cognitive complexity 194 (threshold 15). Drivers by points: if/else 63 (143 pts), boolean chains 27, match/switch 4 (9 pts), ternaries 4 (8 pts), loops 3 (7 pts) (nesting depth added 93). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/Flux2Pipeline.swift"},"region":{"startLine":1215}}}],"partialFingerprints":{"codehealthFindingId/v1":"eec70630aa44ede1788b13b4e9dc2a409212489b8ada42039bd1e2e1635a55e8"}},{"ruleId":"D2","level":"warning","message":{"text":"SimpleLoRATrainer.train (cognitive 176): SimpleLoRATrainer.train has cognitive complexity 176 (threshold 15). Drivers by points: if/else 57 (129 pts), boolean chains 27, loops 5 (8 pts), error handling 1 (5 pts), ternaries 4 (5 pts), match/switch 2 (nesting depth added 80). Of this number, 169 points are the body\u0027s own statements and 7 belong to 2 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth \u2014 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\u0027s 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":244}}}],"partialFingerprints":{"codehealthFindingId/v1":"936306f8c042a6a58557bb0fb1c23a20dec606e95a76d3ae1f7f98cf4a4c5bad"}},{"ruleId":"D2","level":"warning","message":{"text":"ImageToImage.run (cognitive 107): ImageToImage.run has cognitive complexity 107 (threshold 15). Drivers by points: if/else 50 (81 pts), boolean chains 11, error handling 3 (6 pts), ternaries 3 (6 pts), loops 2, match/switch 1 (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/Flux2CLI.swift"},"region":{"startLine":486}}}],"partialFingerprints":{"codehealthFindingId/v1":"c7ee81073c4896546c8a5272641bd37bdf9521cfa22a17d6a33882364eb13f9a"}},{"ruleId":"D2","level":"warning","message":{"text":"TextToImage.run (cognitive 86): TextToImage.run has cognitive complexity 86 (threshold 15). Drivers by points: if/else 35 (64 pts), boolean chains 6, error handling 3 (6 pts), loops 3 (6 pts), ternaries 2 (3 pts), match/switch 1 (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/Flux2CLI.swift"},"region":{"startLine":125}}}],"partialFingerprints":{"codehealthFindingId/v1":"f037757a1cbcc615fa5069dd5b018b58e147d24a9bf711c4fcb3cda6631578eb"}},{"ruleId":"D2","level":"warning","message":{"text":"Flux2WeightLoader.mapBFLTransformerWeights (cognitive 55): Flux2WeightLoader.mapBFLTransformerWeights has cognitive complexity 55 (threshold 15). Drivers by points: if/else 35 (43 pts), loops 6 (8 pts), boolean chains 4 (nesting depth added 10). To reduce it, split the body: most of this score is breadth rather than depth \u2014 checks laid out side by side rather than stacked \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Loading/WeightLoader.swift"},"region":{"startLine":87}}}],"partialFingerprints":{"codehealthFindingId/v1":"05a5bf8b325e68405c839015d8e160906e14c37fa3fde1b7ba0e9c5ef92f41e3"}},{"ruleId":"D2","level":"warning","message":{"text":"TrainLoRA.runSimpleTrainer (cognitive 49): TrainLoRA.runSimpleTrainer has cognitive complexity 49 (threshold 15). Drivers by points: if/else 24 (40 pts), loops 3, ternaries 1 (3 pts), match/switch 2, 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/TrainLoRACommand.swift"},"region":{"startLine":638}}}],"partialFingerprints":{"codehealthFindingId/v1":"49dd0ee85cb95689a4e2527cff7e77e902138ff519a5463f10e7d00b057b306c"}},{"ruleId":"D2","level":"warning","message":{"text":"FluxToolsView.processAction (cognitive 47): FluxToolsView.processAction has cognitive complexity 47 (threshold 15). Drivers by points: if/else 9 (21 pts), ternaries 6 (18 pts), boolean chains 5, match/switch 1 (2 pts), error handling 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ContentView.swift"},"region":{"startLine":1456}}}],"partialFingerprints":{"codehealthFindingId/v1":"e83b22503dc4948a5eb606d66226291b7d0c819d3258bceb67dd2fbd0e40885c"}},{"ruleId":"D2","level":"warning","message":{"text":"Flux2WeightLoader.mergeLoRAWeights (cognitive 47): Flux2WeightLoader.mergeLoRAWeights has cognitive complexity 47 (threshold 15). Drivers by points: if/else 12 (34 pts), loops 6 (13 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Loading/WeightLoader.swift"},"region":{"startLine":760}}}],"partialFingerprints":{"codehealthFindingId/v1":"27cc5b97bcea18024428255c02d4070c05ced1d8d8007b5fbe255a5479cf9210"}},{"ruleId":"D2","level":"warning","message":{"text":"SimpleLoRATrainer.scoreValidationImagesWithVLM (cognitive 43): SimpleLoRATrainer.scoreValidationImagesWithVLM has cognitive complexity 43 (threshold 15). Drivers by points: if/else 9 (23 pts), ternaries 4 (11 pts), boolean chains 6, loops 1 (2 pts), error handling 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":2072}}}],"partialFingerprints":{"codehealthFindingId/v1":"861aaf57828a3d4ab7ebe8cf340c955740df5af322874048dfcd2f6c8ea28822"}},{"ruleId":"D2","level":"warning","message":{"text":"FluxToolsView.body (cognitive 39): FluxToolsView.body has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 11, ternaries 8 (9 pts), match/switch 1 (2 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth \u2014 checks laid out side by side rather than stacked \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ContentView.swift"},"region":{"startLine":1231}}}],"partialFingerprints":{"codehealthFindingId/v1":"0f85e4702bb6304c147cefa98b0be42fa663befb23b547826001489115a621c5"}},{"ruleId":"D2","level":"warning","message":{"text":"TrainLoRA.run (cognitive 39): TrainLoRA.run has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (20 pts), ternaries 8 (16 pts), loops 1 (2 pts), error handling 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/TrainLoRACommand.swift"},"region":{"startLine":220}}}],"partialFingerprints":{"codehealthFindingId/v1":"0e1072c4e0d421940336edaf0f1b2557f79fbbebad93a12080e3e4c4ad71ec88"}},{"ruleId":"D2","level":"warning","message":{"text":"SimpleLoRATrainer.trainStep (cognitive 37): SimpleLoRATrainer.trainStep has cognitive complexity 37 (threshold 15). Drivers by points: if/else 21 (30 pts), boolean chains 6, 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":902}}}],"partialFingerprints":{"codehealthFindingId/v1":"97f9c05b73ea3ba1023f6ba0a9d0bca6c6a01683bbef70df202adc3edc3a2578"}},{"ruleId":"D2","level":"warning","message":{"text":"LoRALoader.parseAndMapWeights (cognitive 36): LoRALoader.parseAndMapWeights has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (28 pts), loops 3 (6 pts), boolean chains 1, ternaries 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/LoRA/LoRALoader.swift"},"region":{"startLine":104}}}],"partialFingerprints":{"codehealthFindingId/v1":"7d64ae581b649a3d19f60fd08946233cdc128774e3f754773df79c5b46d14264"}},{"ruleId":"D2","level":"warning","message":{"text":"CaptionParser.validateDataset (cognitive 34): CaptionParser.validateDataset has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (26 pts), loops 2 (6 pts), boolean chains 1, error handling 1 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth \u2014 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\u0027s 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Data/CaptionParser.swift"},"region":{"startLine":195}}}],"partialFingerprints":{"codehealthFindingId/v1":"52092c1eb166c2c8ac720204335f1c9da838cc68920fd1da8b324d8c7e714e41"}},{"ruleId":"D2","level":"warning","message":{"text":"Flux2Pipeline.preprocessImageForVAE (cognitive 32): Flux2Pipeline.preprocessImageForVAE has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 9, ternaries 1 (4 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/Flux2Pipeline.swift"},"region":{"startLine":2323}}}],"partialFingerprints":{"codehealthFindingId/v1":"7cde05a611788f104c370af4b0f226374e7d43d86cd3d72c90701ccbe75c4339"}},{"ruleId":"D2","level":"warning","message":{"text":"MistralVLM.loadWeights (cognitive 31): MistralVLM.loadWeights has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (23 pts), loops 5, 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Vision/MistralVLM.swift"},"region":{"startLine":704}}}],"partialFingerprints":{"codehealthFindingId/v1":"78ec32f1bba4c0a09b724a68ba6fdf51b5b79806d3583bb56af9848c2b24f217"}},{"ruleId":"D2","level":"warning","message":{"text":"Flux2FusedKernels.applyRotaryEmb (cognitive 30): Flux2FusedKernels.applyRotaryEmb has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 11 (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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Transformer/Flux2FusedKernels.swift"},"region":{"startLine":99}}}],"partialFingerprints":{"codehealthFindingId/v1":"6a8b5800de52d2dee51914fc09a592a533795f63a42da1bb90c0ed182fa89f9b"}},{"ruleId":"D2","level":"warning","message":{"text":"Flux2Transformer2DModel.getLoRAParameters (cognitive 30): Flux2Transformer2DModel.getLoRAParameters has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (28 pts), 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. This shape REPEATS in the file: one other method here (Flux2Transformer2DModel.unfreezeLoRAParameters) has the same decision points, in the same order, at the same nesting depths \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Model/LoRALinear.swift"},"region":{"startLine":210}}}],"partialFingerprints":{"codehealthFindingId/v1":"b1c55dbb594207ee9e2f19a7308620fba2fb390787d54fc73dba3480d0a62fe7"}},{"ruleId":"D2","level":"warning","message":{"text":"Flux2Transformer2DModel.unfreezeLoRAParameters (cognitive 30): Flux2Transformer2DModel.unfreezeLoRAParameters has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (28 pts), 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. This shape REPEATS in the file: one other method here (Flux2Transformer2DModel.getLoRAParameters) has the same decision points, in the same order, at the same nesting depths \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Model/LoRALinear.swift"},"region":{"startLine":304}}}],"partialFingerprints":{"codehealthFindingId/v1":"0d92c5b1a86374e788fc3752836bd00ac525797769b4bd7a0d965d5e0cce8437"}},{"ruleId":"D2","level":"warning","message":{"text":"Flux2SubjectMask.renderInvertedMask (cognitive 29): Flux2SubjectMask.renderInvertedMask has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (16 pts), loops 3 (8 pts), boolean chains 4, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Chains/Flux2SubjectMask.swift"},"region":{"startLine":156}}}],"partialFingerprints":{"codehealthFindingId/v1":"2b8a3a157d59efa6ed74ba8eb96c9ebb52d143b9616543a7de9f68348f74cd8f"}},{"ruleId":"D2","level":"warning","message":{"text":"Flux2OutpaintingChain.buildSmartMask (cognitive 28): Flux2OutpaintingChain.buildSmartMask has cognitive complexity 28 (threshold 15). Drivers by points: loops 10 (23 pts), if/else 5 (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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Chains/Flux2OutpaintingChain.swift"},"region":{"startLine":398}}}],"partialFingerprints":{"codehealthFindingId/v1":"9aca96dea1fc407649bd6607b8cc5c5e8eeea95ec921c824291eecc37bb9cc4e"}},{"ruleId":"D2","level":"warning","message":{"text":"Upsample.run (cognitive 27): Upsample.run has cognitive complexity 27 (threshold 15). Drivers by points: if/else 18 (24 pts), boolean chains 2, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxEncodersCLI/FluxEncodersCLI.swift"},"region":{"startLine":517}}}],"partialFingerprints":{"codehealthFindingId/v1":"ee8e4357116a5fe8ef3412723f8a09c35cf8757a8f78dc43e2585adace2cbe35"}},{"ruleId":"D2","level":"warning","message":{"text":"Flux2InpaintCompositing.maskBoundingBox (cognitive 26): Flux2InpaintCompositing.maskBoundingBox has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 2 (3 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Chains/Flux2InpaintCompositing.swift"},"region":{"startLine":27}}}],"partialFingerprints":{"codehealthFindingId/v1":"53521fe180b8eca1fba04209c95b4430d5da07fdd8be210efa991d5aab9f1b3c"}},{"ruleId":"D2","level":"warning","message":{"text":"Flux2WeightLoader.mapDiffusersTransformerWeights (cognitive 26): Flux2WeightLoader.mapDiffusersTransformerWeights has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (21 pts), loops 3 (4 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Loading/WeightLoader.swift"},"region":{"startLine":315}}}],"partialFingerprints":{"codehealthFindingId/v1":"979fab90b29af4f45756e086cc25c9e42af76e2a9e552e1366cebaa0b02712f7"}},{"ruleId":"D2","level":"warning","message":{"text":"SimpleLoRATrainer.findLoRALayer (cognitive 26): SimpleLoRATrainer.findLoRALayer has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (20 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":1686}}}],"partialFingerprints":{"codehealthFindingId/v1":"a3c8872d5ca4ec13845d9d4ed4b22344bccaffaefb2c5300a4f5ce8d65777ec6"}},{"ruleId":"D2","level":"warning","message":{"text":"SimpleLoRATrainer.generateBaselineImages (cognitive 26): SimpleLoRATrainer.generateBaselineImages has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (18 pts), ternaries 2 (4 pts), boolean chains 3, 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. This shape REPEATS in the file: one other method here (SimpleLoRATrainer.generateValidationImages) has the same decision points, in the same order, at the same nesting depths \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":1750}}}],"partialFingerprints":{"codehealthFindingId/v1":"a708eee9e8d0e983c0ccabdda679155019536149986fa4a47916d826a312effa"}},{"ruleId":"D2","level":"warning","message":{"text":"SimpleLoRATrainer.generateValidationImages (cognitive 26): SimpleLoRATrainer.generateValidationImages has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (18 pts), ternaries 2 (4 pts), boolean chains 3, 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. This shape REPEATS in the file: one other method here (SimpleLoRATrainer.generateBaselineImages) has the same decision points, in the same order, at the same nesting depths \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":1863}}}],"partialFingerprints":{"codehealthFindingId/v1":"947e3827046816a79a20b119e64bf306d4e10dc262092b2dfeece87c86f9058a"}},{"ruleId":"D2","level":"warning","message":{"text":"Flux2Transformer2DModel.callAsFunction (cognitive 25): Flux2Transformer2DModel.callAsFunction has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 4, loops 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Transformer/Flux2Transformer.swift"},"region":{"startLine":123}}}],"partialFingerprints":{"codehealthFindingId/v1":"942f3a242222b86860def24ed06f207338ae5ec3f5ce49d5b3ecc6bea2b6c972"}},{"ruleId":"D2","level":"warning","message":{"text":"SimpleLoRATrainer.combineGradients::combineRecursively (cognitive 24): SimpleLoRATrainer.combineGradients::combineRecursively has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 4 (10 pts), if/else 4 (9 pts), loops 2 (4 pts), match/switch 1 (nesting depth added 13). The drivers above price the dispatch low by construction \u2014 a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":1405}}}],"partialFingerprints":{"codehealthFindingId/v1":"8fcba1eb5e2b2aff142afa4a81b5d36e38a3f4eaff2941a74708201640e9fd2e"}},{"ruleId":"D2","level":"warning","message":{"text":"Embed.run (cognitive 23): Embed.run has cognitive complexity 23 (threshold 15). Drivers by points: if/else 16 (23 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxEncodersCLI/FluxEncodersCLI.swift"},"region":{"startLine":288}}}],"partialFingerprints":{"codehealthFindingId/v1":"cb0385aabee0b06be89935413865355a8e19562b9eac34439b638b11371f9b8b"}},{"ruleId":"D2","level":"warning","message":{"text":"Qwen3Generator.chat (cognitive 23): Qwen3Generator.chat has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 5, 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Generation/Qwen3Generator.swift"},"region":{"startLine":170}}}],"partialFingerprints":{"codehealthFindingId/v1":"8ab4389c7a7fee478a289de7d0c28dc1aecbc4db4a535bef93a33c3d1c0ad613"}},{"ruleId":"D2","level":"warning","message":{"text":"TekkenTokenizer.encodeBPEChunk (cognitive 23): TekkenTokenizer.encodeBPEChunk has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (17 pts), loops 3 (5 pts), ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Tokenizer/TekkenTokenizer.swift"},"region":{"startLine":320}}}],"partialFingerprints":{"codehealthFindingId/v1":"0d6a441778b25fca109a2e55e15bbe15331efff205e824cd9b77b2550ad18d82"}},{"ruleId":"D2","level":"warning","message":{"text":"Qwen35VLM.generateMultiImage (cognitive 23): Qwen35VLM.generateMultiImage has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 3, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/Qwen35/Qwen35VLM.swift"},"region":{"startLine":124}}}],"partialFingerprints":{"codehealthFindingId/v1":"f0be87ab92988c8b5f0e50df5619d6306bc53eb870a3f7961e44771f1e042dca"}},{"ruleId":"D2","level":"warning","message":{"text":"Flux2MaskedInpaintingChain.run (cognitive 22): Flux2MaskedInpaintingChain.run has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 4, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Chains/Flux2MaskedInpaintingChain.swift"},"region":{"startLine":301}}}],"partialFingerprints":{"codehealthFindingId/v1":"9317e885e37717ccf07138efa38fd98ab1d52216b592b2442342d581bd22e054"}},{"ruleId":"D2","level":"warning","message":{"text":"LoRALoader.mapBFLPathToSwiftPath (cognitive 22): LoRALoader.mapBFLPathToSwiftPath has cognitive complexity 22 (threshold 15). Drivers by points: if/else 18 (22 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth \u2014 checks laid out side by side rather than stacked \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/LoRA/LoRALoader.swift"},"region":{"startLine":343}}}],"partialFingerprints":{"codehealthFindingId/v1":"4c4efbe373f00381ee5d214f9754e2cca6c0a8bd25536c50d058afb60e368d4a"}},{"ruleId":"D2","level":"warning","message":{"text":"Flux2Transformer2DModel.setAllLoRAScales (cognitive 22): Flux2Transformer2DModel.setAllLoRAScales has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (20 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. This shape REPEATS in the file: one other method here (Flux2Transformer2DModel.restoreLoRAScales) has the same decision points, in the same order, at the same nesting depths \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Model/LoRALinear.swift"},"region":{"startLine":368}}}],"partialFingerprints":{"codehealthFindingId/v1":"1962c4876a53a6e3c7048a1e8feb5a03d5586a39488c16c441fc2569be5931e1"}},{"ruleId":"D2","level":"warning","message":{"text":"Flux2Transformer2DModel.restoreLoRAScales (cognitive 22): Flux2Transformer2DModel.restoreLoRAScales has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (20 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. This shape REPEATS in the file: one other method here (Flux2Transformer2DModel.setAllLoRAScales) has the same decision points, in the same order, at the same nesting depths \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Model/LoRALinear.swift"},"region":{"startLine":393}}}],"partialFingerprints":{"codehealthFindingId/v1":"049f0c9bda986af6d642b6bd90c2c7f703952fceec3b1044aa42e6280c970214"}},{"ruleId":"D2","level":"warning","message":{"text":"SimpleLoRATrainer.addGradients::addRecursively (cognitive 22): SimpleLoRATrainer.addGradients::addRecursively has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 4 (10 pts), if/else 3 (7 pts), loops 2 (4 pts), match/switch 1 (nesting depth added 12). The drivers above price the dispatch low by construction \u2014 a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":1466}}}],"partialFingerprints":{"codehealthFindingId/v1":"9bd4391d9b5ed5e67ec81936ceb5c734dde2804c785047c20c082970523612fb"}},{"ruleId":"D2","level":"warning","message":{"text":"TekkenTokenizer.loadTekkenTokenizerFromFile (cognitive 22): TekkenTokenizer.loadTekkenTokenizerFromFile has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (5 pts), match/switch 1 (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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Tokenizer/TekkenTokenizer.swift"},"region":{"startLine":115}}}],"partialFingerprints":{"codehealthFindingId/v1":"92f893771d5c81ebc2cc23fb5a217ed83db829c36a9183aea8a372feef2bd6fd"}},{"ruleId":"D2","level":"warning","message":{"text":"Inpaint.run (cognitive 21): Inpaint.run has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (17 pts), ternaries 2, boolean chains 1, loops 1 (nesting depth added 4). Of this number, 20 points are the body\u0027s 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 \u2014 checks laid out side by side rather than stacked \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/InpaintCommand.swift"},"region":{"startLine":139}}}],"partialFingerprints":{"codehealthFindingId/v1":"54e0d2e31c575513e97d912330e1de022af0e911d839848b8793b85fab1c8310"}},{"ruleId":"D2","level":"warning","message":{"text":"ProfileCompare.run (cognitive 21): ProfileCompare.run has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (9 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/ProfileCommand.swift"},"region":{"startLine":334}}}],"partialFingerprints":{"codehealthFindingId/v1":"e4b77d8a6c9f7d03e3c82f1fc62d728d4a9a1f80f05b5b945e0fe309f29396a5"}},{"ruleId":"D2","level":"warning","message":{"text":"FluxTextEncoders.sampleToken (cognitive 21): FluxTextEncoders.sampleToken has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (17 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/FluxTextEncoders.swift"},"region":{"startLine":1027}}}],"partialFingerprints":{"codehealthFindingId/v1":"48f674b898108e3fc8bf1b5ae044c6649e616dce000d56cf6e3e251a97f5f59b"}},{"ruleId":"D2","level":"warning","message":{"text":"MistralGenerator.chat (cognitive 21): MistralGenerator.chat has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 4, 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Generation/MistralGenerator.swift"},"region":{"startLine":233}}}],"partialFingerprints":{"codehealthFindingId/v1":"46bccfe172927cc96178e8b8338f7e8c1fbce836f0ccd7d9caa634703a4c32ae"}},{"ruleId":"D2","level":"warning","message":{"text":"Flux2TransformerBlock.callAsFunction (cognitive 20): Flux2TransformerBlock.callAsFunction has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12, boolean chains 8. To reduce it, split the body: this score is breadth rather than depth \u2014 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. This shape REPEATS in the file: 2 other methods here (Flux2TransformerBlock.callWithKVExtraction, Flux2TransformerBlock.callWithKVCached) have the same decision points, in the same order, at the same nesting depths \u2014 so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Transformer/Flux2TransformerBlock.swift"},"region":{"startLine":80}}}],"partialFingerprints":{"codehealthFindingId/v1":"ba496319f90d21db05e602e59a9031a079c3dd27751f40efdce109ad878d9aa1"}},{"ruleId":"D2","level":"warning","message":{"text":"Flux2TransformerBlock.callWithKVExtraction (cognitive 20): Flux2TransformerBlock.callWithKVExtraction has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12, boolean chains 8. To reduce it, split the body: this score is breadth rather than depth \u2014 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. This shape REPEATS in the file: 2 other methods here (Flux2TransformerBlock.callAsFunction, Flux2TransformerBlock.callWithKVCached) have the same decision points, in the same order, at the same nesting depths \u2014 so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Transformer/Flux2TransformerBlock.swift"},"region":{"startLine":173}}}],"partialFingerprints":{"codehealthFindingId/v1":"10f5abc6a4e8a648b0a1a70542a4213f1319bca2fc3c3198cadfa1e92fef7b30"}},{"ruleId":"D2","level":"warning","message":{"text":"Flux2TransformerBlock.callWithKVCached (cognitive 20): Flux2TransformerBlock.callWithKVCached has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12, boolean chains 8. To reduce it, split the body: this score is breadth rather than depth \u2014 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. This shape REPEATS in the file: 2 other methods here (Flux2TransformerBlock.callAsFunction, Flux2TransformerBlock.callWithKVExtraction) have the same decision points, in the same order, at the same nesting depths \u2014 so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Transformer/Flux2TransformerBlock.swift"},"region":{"startLine":253}}}],"partialFingerprints":{"codehealthFindingId/v1":"1521c8abf56d631e0ca2a98ee1a9286d3409c49d2d6536005c55612c35479880"}},{"ruleId":"D2","level":"warning","message":{"text":"SimpleLoRATrainer.parseVLMScores (cognitive 20): SimpleLoRATrainer.parseVLMScores has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 10, if/else 8 (10 pts) (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":2223}}}],"partialFingerprints":{"codehealthFindingId/v1":"bc2049092fddf577266b707a419fada2419243165df56825bc63368f4a0398b1"}},{"ruleId":"D2","level":"warning","message":{"text":"Chat.run (cognitive 20): Chat.run has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxEncodersCLI/FluxEncodersCLI.swift"},"region":{"startLine":156}}}],"partialFingerprints":{"codehealthFindingId/v1":"1a20eac7afd947f108f5d2e6c39460a029314da18cbbbccac560ad778cd7a43d"}},{"ruleId":"D2","level":"warning","message":{"text":"MistralVLM.load (cognitive 20): MistralVLM.load has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 6, loops 2 (3 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Vision/MistralVLM.swift"},"region":{"startLine":590}}}],"partialFingerprints":{"codehealthFindingId/v1":"8cbc7a1421e162c4ef3eddfa5d593d382bd8e7d3dc25ffb64fa67793a3765493"}},{"ruleId":"D2","level":"warning","message":{"text":"ImageGenerationViewModel.generate (cognitive 19): ImageGenerationViewModel.generate has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 4 (12 pts), if/else 4 (6 pts), 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/ViewModels/ImageGenerationViewModel.swift"},"region":{"startLine":202}}}],"partialFingerprints":{"codehealthFindingId/v1":"9ba0fab763ccf3d6033f89273d2f653970efb6babe9cf521b74d623cab54383f"}},{"ruleId":"D2","level":"warning","message":{"text":"Flux2InpaintCompositing.composite (cognitive 19): Flux2InpaintCompositing.composite has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 7, 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Chains/Flux2InpaintCompositing.swift"},"region":{"startLine":121}}}],"partialFingerprints":{"codehealthFindingId/v1":"0888f0b9ddc1f50f44b4296a3c53d0fe7b616a11c7585ebed7928130b3d4c0bf"}},{"ruleId":"D2","level":"warning","message":{"text":"Flux2Pipeline.loadTransformer (cognitive 19): Flux2Pipeline.loadTransformer has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 2, error handling 1 (2 pts), match/switch 1 (2 pts), ternaries 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth \u2014 checks laid out side by side rather than stacked \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/Flux2Pipeline.swift"},"region":{"startLine":483}}}],"partialFingerprints":{"codehealthFindingId/v1":"d8fb925a33be9a03b86cc7d6cd6a15dcfc741ec1c8ada8a213590a313c801c1a"}},{"ruleId":"D2","level":"warning","message":{"text":"Qwen3Generator.generate (cognitive 19): Qwen3Generator.generate 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Generation/Qwen3Generator.swift"},"region":{"startLine":40}}}],"partialFingerprints":{"codehealthFindingId/v1":"c1d5f455ce1f8a5bb7c789a3d60b34dc29421e916e589683002c51ebb508256a"}},{"ruleId":"D2","level":"warning","message":{"text":"TekkenTokenizer.decode (cognitive 19): TekkenTokenizer.decode has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 2, 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Tokenizer/TekkenTokenizer.swift"},"region":{"startLine":394}}}],"partialFingerprints":{"codehealthFindingId/v1":"35c01f92058d80e05e5eb19b1d15cfb881ffba9d9fee87abc6e5872440bd3242"}},{"ruleId":"D2","level":"warning","message":{"text":"TrainLoRA.printConfigSummary (cognitive 18): TrainLoRA.printConfigSummary has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12, ternaries 6. To reduce it, split the body: this score is breadth rather than depth \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/TrainLoRACommand.swift"},"region":{"startLine":552}}}],"partialFingerprints":{"codehealthFindingId/v1":"a3878f040778528c761bef5b04f356c4f7aa816b99e1fdc8f4e5e0b917cc279d"}},{"ruleId":"D2","level":"warning","message":{"text":"VLMProviderOptions.loadIfRequested (cognitive 18): VLMProviderOptions.loadIfRequested has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), ternaries 1 (2 pts), match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction \u2014 a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/VLMProviderOptions.swift"},"region":{"startLine":65}}}],"partialFingerprints":{"codehealthFindingId/v1":"08387e4eb011ba4b9e2ac1d70095525ed3e0838aca0b8400d26714a44c7d1808"}},{"ruleId":"D2","level":"warning","message":{"text":"AutoencoderKLFlux2.decodeTiled (cognitive 18): AutoencoderKLFlux2.decodeTiled has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 4 (12 pts), loops 4 (6 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/VAE/AutoencoderKL.swift"},"region":{"startLine":176}}}],"partialFingerprints":{"codehealthFindingId/v1":"190b3066bfe2051227bf2524cc636ef9ac9e41766355c64ab2259bddb7cb9c31"}},{"ruleId":"D2","level":"warning","message":{"text":"CaptionParser.parseJSONLine (cognitive 18): CaptionParser.parseJSONLine has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth \u2014 checks laid out side by side rather than stacked \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Data/CaptionParser.swift"},"region":{"startLine":44}}}],"partialFingerprints":{"codehealthFindingId/v1":"865bf17d80f740af0ab5e47b459d9c62aac0fbf66dbaffae349ed26b4d52267b"}},{"ruleId":"D2","level":"warning","message":{"text":"MLXProfiler.generateReport (cognitive 18): MLXProfiler.generateReport has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 2 (4 pts), 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Utils/Flux2Profiler.swift"},"region":{"startLine":18}}}],"partialFingerprints":{"codehealthFindingId/v1":"5b098f8725f68c13ac7d60ffafbffee558d341be13d57b085c183f4fc21224e1"}},{"ruleId":"D2","level":"warning","message":{"text":"Qwen3VLGenerator.generate (cognitive 18): Qwen3VLGenerator.generate has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Generation/Qwen3VLGenerator.swift"},"region":{"startLine":31}}}],"partialFingerprints":{"codehealthFindingId/v1":"a5a26dc6b90385a85b351b4822abb7e48b40457de04ef65252c4aa287c8986b3"}},{"ruleId":"D2","level":"warning","message":{"text":"Qwen3VLForCausalLM.load (cognitive 18): Qwen3VLForCausalLM.load has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLModel.swift"},"region":{"startLine":298}}}],"partialFingerprints":{"codehealthFindingId/v1":"a236ee7f8f3065ee85a5754a022976fba512f566b7143b49083445b56ba9eb72"}},{"ruleId":"D2","level":"warning","message":{"text":"ModelStatusBar.mistralStatusBar (cognitive 17): ModelStatusBar.mistralStatusBar has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 8, if/else 7, boolean chains 2. To reduce it, split the body: this score is breadth rather than depth \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ContentView.swift"},"region":{"startLine":149}}}],"partialFingerprints":{"codehealthFindingId/v1":"79a1aa7a7b3efb7071a48bedc02a51b366afe7cc34e9025b28cfd876e2645482"}},{"ruleId":"D2","level":"warning","message":{"text":"LoRATrainingConfig.suggestAdjustments (cognitive 17): LoRATrainingConfig.suggestAdjustments has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (16 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Configuration/LoRATrainingConfig.swift"},"region":{"startLine":984}}}],"partialFingerprints":{"codehealthFindingId/v1":"70d27ee1d680c03b45188787f989714520f0a1ee0779909d56d4b4e7eda75571"}},{"ruleId":"D2","level":"warning","message":{"text":"MistralGenerator.generate (cognitive 17): MistralGenerator.generate has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (15 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Generation/MistralGenerator.swift"},"region":{"startLine":94}}}],"partialFingerprints":{"codehealthFindingId/v1":"6b075406d85692719eda7dcdeefd0c8d9a3d4705b4c2edbd2c31d4c26cfd201c"}},{"ruleId":"D2","level":"warning","message":{"text":"Qwen35VLM.load (cognitive 17): Qwen35VLM.load has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (7 pts), loops 3 (5 pts), ternaries 1 (3 pts), error handling 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/Qwen35/Qwen35VLM.swift"},"region":{"startLine":286}}}],"partialFingerprints":{"codehealthFindingId/v1":"61220b80373506031654cccc0a19e2fdf5871455cf1368f0f25901b7f21caaf3"}},{"ruleId":"D2","level":"warning","message":{"text":"Qwen3ChatView.body (cognitive 16): Qwen3ChatView.body has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 3 (6 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ContentView.swift"},"region":{"startLine":2472}}}],"partialFingerprints":{"codehealthFindingId/v1":"e9c1392e5080819e361730f3db5cebc0842bec0a2d07161f12322937b208f56d"}},{"ruleId":"D2","level":"warning","message":{"text":"CompareEncoders.run (cognitive 16): CompareEncoders.run has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (10 pts), ternaries 4 (5 pts), boolean chains 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth \u2014 checks laid out side by side rather than stacked \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/CompareEncoders.swift"},"region":{"startLine":57}}}],"partialFingerprints":{"codehealthFindingId/v1":"f6f5d304c52dbd5f795cb6b37dd701a9eeaf560daabc298bde9295cd1230c7d9"}},{"ruleId":"D2","level":"warning","message":{"text":"LatentCache.preEncodeDataset (cognitive 16): LatentCache.preEncodeDataset has cognitive complexity 16 (threshold 15). Drivers by points: loops 6 (13 pts), if/else 2 (3 pts) (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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Data/LatentCache.swift"},"region":{"startLine":192}}}],"partialFingerprints":{"codehealthFindingId/v1":"62e7366a815103f8943a292a06ee12ab9fd1d30b6a9b4e00147f872e43c0517c"}},{"ruleId":"D2","level":"warning","message":{"text":"LatentCache.preEncodeControlImages (cognitive 16): LatentCache.preEncodeControlImages has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2, 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Data/LatentCache.swift"},"region":{"startLine":340}}}],"partialFingerprints":{"codehealthFindingId/v1":"184970d27e816bcdb43c03bc1a2c6707503046b9136a912f52d28b05466fa899"}},{"ruleId":"D2","level":"warning","message":{"text":"FluxTextEncoders.analyzeImage (cognitive 16): FluxTextEncoders.analyzeImage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 2, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth \u2014 checks laid out side by side rather than stacked \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/FluxTextEncoders.swift"},"region":{"startLine":843}}}],"partialFingerprints":{"codehealthFindingId/v1":"ff74b65175e31396adab582a3a41993d2a3416172df18e583accf715f08ce842"}},{"ruleId":"D3","level":"warning","message":{"text":"MethodTooLong: Flux2Pipeline.generateWithResult: MethodTooLong \u2014 generateWithResult runs 590 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 490 over it, 5.90\u00D7 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 \u2014 the runs of statements that work on the same values and would earn the same name \u2014 into its own named unit, and have this one call them in order."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/Flux2Pipeline.swift"},"region":{"startLine":1215}}}],"partialFingerprints":{"codehealthFindingId/v1":"24b5a3ef3b0d076cdce9cd4d0dcb656a826823821b348c477c061a6dcfb77b48"}},{"ruleId":"D3","level":"warning","message":{"text":"MethodTooLong: SimpleLoRATrainer.train: MethodTooLong \u2014 train runs 412 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 312 over it, 4.12\u00D7 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 \u2014 the runs of statements that work on the same values and would earn the same name \u2014 into its own named unit, and have this one call them in order."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":244}}}],"partialFingerprints":{"codehealthFindingId/v1":"9f67be5499f1ab1b7106f554fd0fb14487884fbb7c05851ab56a0ba79057c59f"}},{"ruleId":"D3","level":"warning","message":{"text":"ClassTooLong: SimpleLoRATrainer: ClassTooLong \u2014 1482 significant lines (blank, comment-only and punctuation-only lines excluded), 34 methods. The bar is 400 significant lines; this is 1082 over it, 3.71\u00D7 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":172}}}],"partialFingerprints":{"codehealthFindingId/v1":"cbc0a764ad8283cdb65d24848829b2aa76ee1c9662a42fc3978b49555cd9c7eb"}},{"ruleId":"D3","level":"warning","message":{"text":"FileTooLong: Views/ContentView.swift: FileTooLong \u2014 1807 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1307 over it, 3.61\u00D7 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ContentView.swift"},"region":{"startLine":1}}}],"partialFingerprints":{"codehealthFindingId/v1":"79f5f28575d1fffaddc03b138b2b4c11fde44f82e14b9adb8a1724e006f340a6"}},{"ruleId":"D3","level":"warning","message":{"text":"ClassTooLong: Flux2Pipeline: ClassTooLong \u2014 1364 significant lines (blank, comment-only and punctuation-only lines excluded), 35 methods. The bar is 400 significant lines; this is 964 over it, 3.41\u00D7 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/Flux2Pipeline.swift"},"region":{"startLine":99}}}],"partialFingerprints":{"codehealthFindingId/v1":"05e8c26c5973f4bce3c308d3573d6cb348135710e39bba3fa635a1e1270b7860"}},{"ruleId":"D3","level":"warning","message":{"text":"FileTooLong: Loop/SimpleLoRATrainer.swift: FileTooLong \u2014 1598 significant lines (blank, comment-only and punctuation-only lines excluded), about 93% of them inside a single declaration: SimpleLoRATrainer (172-2591). The bar is 500 significant lines; this is 1098 over it, 3.20\u00D7 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 \u2014 the parts that share the same inputs and are named together \u2014 into its own unit in a sibling file, and have the original call them."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":1}}}],"partialFingerprints":{"codehealthFindingId/v1":"9a2fd0c5762ff14605754e4a4b91baaefe72c9641f96c52110f850c40cff11f3"}},{"ruleId":"D3","level":"warning","message":{"text":"FileTooLong: Pipeline/Flux2Pipeline.swift: FileTooLong \u2014 1420 significant lines (blank, comment-only and punctuation-only lines excluded), about 96% of them inside a single declaration: Flux2Pipeline (99-2526). The bar is 500 significant lines; this is 920 over it, 2.84\u00D7 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 \u2014 the parts that share the same inputs and are named together \u2014 into its own unit in a sibling file, and have the original call them."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/Flux2Pipeline.swift"},"region":{"startLine":1}}}],"partialFingerprints":{"codehealthFindingId/v1":"164f229ea8351c9655cd55d43a4965ef3395f9c7170cd4319ac75dd754350c88"}},{"ruleId":"D3","level":"warning","message":{"text":"MethodTooLong: TrainLoRA.runSimpleTrainer: MethodTooLong \u2014 runSimpleTrainer 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\u00D7 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 \u2014 the runs of statements that work on the same values and would earn the same name \u2014 into its own named unit, and have this one call them in order."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/TrainLoRACommand.swift"},"region":{"startLine":638}}}],"partialFingerprints":{"codehealthFindingId/v1":"51caf116701e3ea9f4e1f613b3f9e4f1819bc1217f89365cecb787a0afecea27"}},{"ruleId":"D3","level":"warning","message":{"text":"MethodTooLong: ImageToImage.run: MethodTooLong \u2014 run runs 196 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 96 over it, 1.96\u00D7 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 \u2014 the runs of statements that work on the same values and would earn the same name \u2014 into its own named unit, and have this one call them in order."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/Flux2CLI.swift"},"region":{"startLine":486}}}],"partialFingerprints":{"codehealthFindingId/v1":"9446f270b778e77e930446659b07e63e7053f0fadc77712a1703b8ac418b7ffe"}},{"ruleId":"D3","level":"warning","message":{"text":"MethodTooLong: YAMLConfigParser.toLoRATrainingConfig: MethodTooLong \u2014 toLoRATrainingConfig runs 196 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 96 over it, 1.96\u00D7 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 \u2014 the runs of statements that work on the same values and would earn the same name \u2014 into its own named unit, and have this one call them in order."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/TrainingConfigYAML.swift"},"region":{"startLine":347}}}],"partialFingerprints":{"codehealthFindingId/v1":"a4bad55f7dcb4909f475488b111a82ac3fa1a08256c5cc6de290606a73b119b7"}},{"ruleId":"D3","level":"warning","message":{"text":"ClassTooLong: FluxTextEncoders: ClassTooLong \u2014 743 significant lines (blank, comment-only and punctuation-only lines excluded), 50 methods. The bar is 400 significant lines; this is 343 over it, 1.86\u00D7 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/FluxTextEncoders.swift"},"region":{"startLine":33}}}],"partialFingerprints":{"codehealthFindingId/v1":"0738f6f6e335411aec7764557eb54f95bbac3f024af513c9b666fc586687cb72"}},{"ruleId":"D3","level":"warning","message":{"text":"MethodTooLong: ModelsManagementView.body: MethodTooLong \u2014 body runs 176 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 76 over it, 1.76\u00D7 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 \u2014 the runs of statements that work on the same values and would earn the same name \u2014 into its own named unit, and have this one call them in order."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ContentView.swift"},"region":{"startLine":1724}}}],"partialFingerprints":{"codehealthFindingId/v1":"123fc6f0d6f48e5f23195bf8bf969f683c3359500d5613c18a85d7e57dff94ef"}},{"ruleId":"D3","level":"warning","message":{"text":"TooManyMethods: FluxTextEncoders: TooManyMethods \u2014 50 methods. The bar is 30 methods; this is 20 over it, 1.67\u00D7 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/FluxTextEncoders.swift"},"region":{"startLine":33}}}],"partialFingerprints":{"codehealthFindingId/v1":"99062a03a557ec9ce1ad559876c992796e1298dffdf7db81caf6eb251203a089"}},{"ruleId":"D3","level":"warning","message":{"text":"MethodTooLong: SimpleLoRATrainer.trainStep: MethodTooLong \u2014 trainStep 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\u00D7 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 \u2014 the runs of statements that work on the same values and would earn the same name \u2014 into its own named unit, and have this one call them in order."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":902}}}],"partialFingerprints":{"codehealthFindingId/v1":"341a0c5dff73df1f6ae7aa7f1d78479bd6dce67326294ba4b7e99a8e8db28f7f"}},{"ruleId":"D3","level":"warning","message":{"text":"MethodTooLong: FluxToolsView.processAction: MethodTooLong \u2014 processAction runs 158 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 58 over it, 1.58\u00D7 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 \u2014 the runs of statements that work on the same values and would earn the same name \u2014 into its own named unit, and have this one call them in order."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ContentView.swift"},"region":{"startLine":1456}}}],"partialFingerprints":{"codehealthFindingId/v1":"7fed91e4b83dc1d8f772178879c6e22902c8b8cf9dd9441b843914bf8ac8c1a4"}},{"ruleId":"D3","level":"warning","message":{"text":"FileTooLong: FluxTextEncoders/FluxTextEncoders.swift: FileTooLong \u2014 773 significant lines (blank, comment-only and punctuation-only lines excluded), about 96% of them inside a single declaration: FluxTextEncoders (33-1363). The bar is 500 significant lines; this is 273 over it, 1.55\u00D7 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 \u2014 the parts that share the same inputs and are named together \u2014 into its own unit in a sibling file, and have the original call them."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/FluxTextEncoders.swift"},"region":{"startLine":1}}}],"partialFingerprints":{"codehealthFindingId/v1":"ad5a7b4f4f0edd1f6ed8cea1326ae37c16c9f85318ff670e9ce243160292c243"}},{"ruleId":"D3","level":"warning","message":{"text":"MethodTooLong: TextToImage.run: MethodTooLong \u2014 run runs 154 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 54 over it, 1.54\u00D7 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 \u2014 the runs of statements that work on the same values and would earn the same name \u2014 into its own named unit, and have this one call them in order."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/Flux2CLI.swift"},"region":{"startLine":125}}}],"partialFingerprints":{"codehealthFindingId/v1":"07648c8a021e06bfcd50b72bfb450ee1285bdba4fe7704a3741b6f7c31a2f642"}},{"ruleId":"D3","level":"warning","message":{"text":"MethodTooLong: Flux2WeightLoader.mapBFLTransformerWeights: MethodTooLong \u2014 mapBFLTransformerWeights runs 154 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 54 over it, 1.54\u00D7 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 \u2014 the runs of statements that work on the same values and would earn the same name \u2014 into its own named unit, and have this one call them in order."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Loading/WeightLoader.swift"},"region":{"startLine":87}}}],"partialFingerprints":{"codehealthFindingId/v1":"d995e16192d5e5fd3bc945d0a2845705f4f3f32e0b91da62adbf57e48031a1c3"}},{"ruleId":"D3","level":"warning","message":{"text":"ClassTooLong: TrainLoRA: ClassTooLong \u2014 610 significant lines (blank, comment-only and punctuation-only lines excluded), 6 methods. The bar is 400 significant lines; this is 210 over it, 1.53\u00D7 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/TrainLoRACommand.swift"},"region":{"startLine":13}}}],"partialFingerprints":{"codehealthFindingId/v1":"233a3aed0b5c6a48800d8ee078d903ead0564c29769b27998988d03c59f49953"}},{"ruleId":"D3","level":"warning","message":{"text":"MethodTooLong: TrainLoRA.run: MethodTooLong \u2014 run 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\u00D7 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 \u2014 the runs of statements that work on the same values and would earn the same name \u2014 into its own named unit, and have this one call them in order."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/TrainLoRACommand.swift"},"region":{"startLine":220}}}],"partialFingerprints":{"codehealthFindingId/v1":"5d621109334014383c7c2d6c6b045fa058d7cbf33206c8d8b79d5f2a08a2f7b6"}},{"ruleId":"D3","level":"warning","message":{"text":"MethodTooLong: FluxToolsView.body: MethodTooLong \u2014 body runs 136 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 36 over it, 1.36\u00D7 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 \u2014 the runs of statements that work on the same values and would earn the same name \u2014 into its own named unit, and have this one call them in order."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ContentView.swift"},"region":{"startLine":1231}}}],"partialFingerprints":{"codehealthFindingId/v1":"1de08b6d8fdd25e3b11c1d9eb86772f4cbd1ab72b0bd8e14fa8aba6ee4e601e6"}},{"ruleId":"D3","level":"warning","message":{"text":"FileTooLong: Flux2CLI/TrainLoRACommand.swift: FileTooLong \u2014 643 significant lines (blank, comment-only and punctuation-only lines excluded), about 95% of them inside a single declaration: TrainLoRA (13-949). The bar is 500 significant lines; this is 143 over it, 1.29\u00D7 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 \u2014 the parts that share the same inputs and are named together \u2014 into its own unit in a sibling file, and have the original call them."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/TrainLoRACommand.swift"},"region":{"startLine":1}}}],"partialFingerprints":{"codehealthFindingId/v1":"986a14756593d527ccda677529e7e249208c6bbfcd5a2d956011d6c7a887dee0"}},{"ruleId":"D3","level":"warning","message":{"text":"MethodTooLong: Flux2Transformer2DModel.callAsFunction: MethodTooLong \u2014 callAsFunction runs 127 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 27 over it, 1.27\u00D7 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 \u2014 the runs of statements that work on the same values and would earn the same name \u2014 into its own named unit, and have this one call them in order."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Transformer/Flux2Transformer.swift"},"region":{"startLine":123}}}],"partialFingerprints":{"codehealthFindingId/v1":"eea5bd2f6dfe0c36b0673a23f9d596141901dc9d48330b9bab23b014f20cda7c"}},{"ruleId":"D3","level":"warning","message":{"text":"FileTooLong: Flux2CLI/Flux2CLI.swift: FileTooLong \u2014 631 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 131 over it, 1.26\u00D7 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/Flux2CLI.swift"},"region":{"startLine":1}}}],"partialFingerprints":{"codehealthFindingId/v1":"d118a4f50bb4bc4289dfd546dd0341991b865960625efeb44c67d95ef4c17746"}},{"ruleId":"D3","level":"warning","message":{"text":"ClassTooLong: Flux2WeightLoader: ClassTooLong \u2014 479 significant lines (blank, comment-only and punctuation-only lines excluded), 17 methods. The bar is 400 significant lines; this is 79 over it, 1.20\u00D7 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Loading/WeightLoader.swift"},"region":{"startLine":10}}}],"partialFingerprints":{"codehealthFindingId/v1":"593b30d6e8cbebc903be468dacc1e9baa647d64b555cd0685b5eb656ba8fe3d0"}},{"ruleId":"D3","level":"warning","message":{"text":"TooManyMethods: Flux2Pipeline: TooManyMethods \u2014 35 methods, declared across 2 files: Pipeline/Flux2Pipeline.swift (30), Pipeline/Flux2Pipeline\u002BChainHelpers.swift (5). The bar is 30 methods; this is 5 over it, 1.17\u00D7 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/Flux2Pipeline.swift"},"region":{"startLine":99}}}],"partialFingerprints":{"codehealthFindingId/v1":"a8afe89836cd4869aa967c3ddceac76cf11d870c3c0c6475f80b917e2fa01562"}},{"ruleId":"D3","level":"warning","message":{"text":"TooManyMethods: SimpleLoRATrainer: TooManyMethods \u2014 34 methods. The bar is 30 methods; this is 4 over it, 1.13\u00D7 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":172}}}],"partialFingerprints":{"codehealthFindingId/v1":"6c623b48f524e4836d4cde00b6be8453579b53fa6c9e782a194f08d6db30905f"}},{"ruleId":"D3","level":"warning","message":{"text":"TooManyMethods: TextEncoderModelDownloader: TooManyMethods \u2014 33 methods. The bar is 30 methods; this is 3 over it, 1.10\u00D7 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift"},"region":{"startLine":17}}}],"partialFingerprints":{"codehealthFindingId/v1":"c2f1c38d08a1010d2c6534960e4475648ff6538f67cd29562111fdc09fc25c4c"}},{"ruleId":"D3","level":"warning","message":{"text":"MethodTooLong: CompareEncoders.run: MethodTooLong \u2014 run runs 110 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 10 over it, 1.10\u00D7 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 \u2014 the runs of statements that work on the same values and would earn the same name \u2014 into its own named unit, and have this one call them in order."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/CompareEncoders.swift"},"region":{"startLine":57}}}],"partialFingerprints":{"codehealthFindingId/v1":"03e177c0f15ff5c324577783f4856ae00c85b434b2eb5b3dbfb9ec78e0e7c73f"}},{"ruleId":"D3","level":"warning","message":{"text":"FileTooLong: Configuration/LoRATrainingConfig.swift: FileTooLong \u2014 549 significant lines (blank, comment-only and punctuation-only lines excluded), about 68% of them inside a single declaration: LoRATrainingConfig (215-887). The bar is 500 significant lines; this is 49 over it, 1.10\u00D7 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 \u2014 the parts that share the same inputs and are named together \u2014 into its own unit in a sibling file, and have the original call them."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Configuration/LoRATrainingConfig.swift"},"region":{"startLine":1}}}],"partialFingerprints":{"codehealthFindingId/v1":"a2805d975f57c523c404a92e7d1f488242a57ce702088c6eb18a0fd1decebfe9"}},{"ruleId":"D3","level":"warning","message":{"text":"MethodTooLong: Embed.run: MethodTooLong \u2014 run runs 108 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 8 over it, 1.08\u00D7 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 \u2014 the runs of statements that work on the same values and would earn the same name \u2014 into its own named unit, and have this one call them in order."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxEncodersCLI/FluxEncodersCLI.swift"},"region":{"startLine":288}}}],"partialFingerprints":{"codehealthFindingId/v1":"2a339bc46bf26c240619bdb22205f4c2b4f595ac8d26b51b275a78c8f57df59f"}},{"ruleId":"D3","level":"warning","message":{"text":"MethodTooLong: SimpleLoRATrainer.generateLearningCurveSVG: MethodTooLong \u2014 generateLearningCurveSVG runs 106 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 6 over it, 1.06\u00D7 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 \u2014 the runs of statements that work on the same values and would earn the same name \u2014 into its own named unit, and have this one call them in order."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":2424}}}],"partialFingerprints":{"codehealthFindingId/v1":"61e19d8791899411f7481c9b7bdd51858323e85713503312875664fc676ed665"}},{"ruleId":"D3","level":"warning","message":{"text":"MethodTooLong: Flux2MaskedInpaintingChain.run: MethodTooLong \u2014 run runs 104 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 4 over it, 1.04\u00D7 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 \u2014 the runs of statements that work on the same values and would earn the same name \u2014 into its own named unit, and have this one call them in order."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Chains/Flux2MaskedInpaintingChain.swift"},"region":{"startLine":301}}}],"partialFingerprints":{"codehealthFindingId/v1":"4b54836022c45828df44f86a31ad9f9ec0fca2f4ecca2c854a446c2e0a4c2a00"}},{"ruleId":"D3","level":"warning","message":{"text":"MethodTooLong: SimpleLoRATrainer.scoreValidationImagesWithVLM: MethodTooLong \u2014 scoreValidationImagesWithVLM runs 103 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 3 over it, 1.03\u00D7 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 \u2014 the runs of statements that work on the same values and would earn the same name \u2014 into its own named unit, and have this one call them in order."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":2072}}}],"partialFingerprints":{"codehealthFindingId/v1":"675e1e8210add9f3f662dc1728469bb2d2605650bd84ed9e2d39e95f14d2d118"}},{"ruleId":"D3","level":"warning","message":{"text":"FileTooLong: FluxEncodersCLI/FluxEncodersCLI.swift: FileTooLong \u2014 511 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 11 over it, 1.02\u00D7 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxEncodersCLI/FluxEncodersCLI.swift"},"region":{"startLine":1}}}],"partialFingerprints":{"codehealthFindingId/v1":"dbc9e90ae6ed8b5086fde0c3d56dbb4bcbfd239c9deeb54664fc79d08b334ecf"}},{"ruleId":"D4","level":"warning","message":{"text":"Near-duplicate member family (4 members, 46 shared lines): Sources/FluxTextEncoders/Generation/MistralGenerator.swift:94-225 | Sources/FluxTextEncoders/Generation/MistralGenerator.swift:233-362 | Sources/FluxTextEncoders/Generation/Qwen3Generator.swift:40-161 | Sources/FluxTextEncoders/Generation/Qwen3Generator.swift:170-290 \u2014 These 4 members are variants of one another: a block of 46 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\u0027 grain \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Generation/MistralGenerator.swift"},"region":{"startLine":94}}}],"partialFingerprints":{"codehealthFindingId/v1":"0e1261dd56270136c69fb8b94aa23418a4a06953be65730cae128a2e8e40f0e3"}},{"ruleId":"D4","level":"warning","message":{"text":"Near-duplicate member pair (101 shared lines): Sources/Flux2CLI/Flux2CLI.swift:125-373 | Sources/Flux2CLI/Flux2CLI.swift:486-825 \u2014 These two members are variants of one another: 101 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\u0027 grain \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/Flux2CLI.swift"},"region":{"startLine":125}}}],"partialFingerprints":{"codehealthFindingId/v1":"ec44aa6ccce2b6f12d5688d05f5d6c52b83926999370dab552b1e28406194b86"}},{"ruleId":"D4","level":"warning","message":{"text":"Near-duplicate member pair (52 shared lines): Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1750-1856 | Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1863-1989 \u2014 These two members are variants of one another: 52 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\u0027 grain \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":1750}}}],"partialFingerprints":{"codehealthFindingId/v1":"5a840ef8c1c7c9860a32f3cc929ba17ac28d39f326e224d66a1d31ebecf87eff"}},{"ruleId":"D4","level":"warning","message":{"text":"Near-duplicate member pair (34 shared lines): Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1398-1457 | Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1460-1512 \u2014 These two members are variants of one another: 34 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\u0027 grain \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":1398}}}],"partialFingerprints":{"codehealthFindingId/v1":"ef66a13a0230681d5730766dfc9b4a29b930c6ddcd44a193c7b77f298dcec67c"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (30 corresponding lines): Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift:181-214 | Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLModel.swift:175-204 \u2014 These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift"},"region":{"startLine":181}}}],"partialFingerprints":{"codehealthFindingId/v1":"26aabcf41020010812cd884d8f397051c8fe3310e664be376885c8bb5c354c02"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (16 corresponding lines): Sources/FluxTextEncoders/Model/MistralAttention.swift:374-392 | Sources/FluxTextEncoders/Model/Qwen3/Qwen3Attention.swift:64-90 \u2014 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 \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/MistralAttention.swift"},"region":{"startLine":374}}}],"partialFingerprints":{"codehealthFindingId/v1":"56c534f60ce23b479e80e5594b01336218527320b81ff22bf5ac27d5d80bb11a"}},{"ruleId":"D4","level":"warning","message":{"text":"Members sharing a duplicated core (5 members, 50\u002B identical tokens): Sources/FluxEncodersCLI/FluxEncodersCLI.swift:92-140 | Sources/FluxEncodersCLI/FluxEncodersCLI.swift:156-249 | Sources/FluxEncodersCLI/FluxEncodersCLI.swift:288-455 | Sources/FluxEncodersCLI/FluxEncodersCLI.swift:517-649 | Sources/FluxEncodersCLI/FluxEncodersCLI.swift:671-730 \u2014 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 \u2014 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\u0027 grain \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxEncodersCLI/FluxEncodersCLI.swift"},"region":{"startLine":92}}}],"partialFingerprints":{"codehealthFindingId/v1":"0639ea06ed761f7f6f4ec1b0c889fd446fc6c626a1b5f72a3bba288c1a34f1ca"}},{"ruleId":"D4","level":"warning","message":{"text":"Members sharing a duplicated core (4 members, 50\u002B identical tokens): Sources/Flux2Core/Loading/WeightLoader.swift:15-45 | Sources/FluxTextEncoders/Loading/TextEncoderWeightLoader.swift:14-42 | Sources/FluxTextEncoders/Model/MistralModel.swift:277-323 | Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift:332-386 \u2014 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 \u2014 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\u0027 grain \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Loading/WeightLoader.swift"},"region":{"startLine":15}}}],"partialFingerprints":{"codehealthFindingId/v1":"48767d77987b705bab72e33ddc9fe85f69139dd64ec7f164ed3c83db02c9582e"}},{"ruleId":"D4","level":"warning","message":{"text":"Members sharing a duplicated core (4 members, 50\u002B identical tokens): Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:963-1001 | Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:1006-1042 | Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:1079-1117 | Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:1122-1158 \u2014 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 \u2014 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\u0027 grain \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/Flux2Pipeline.swift"},"region":{"startLine":963}}}],"partialFingerprints":{"codehealthFindingId/v1":"ed7c8e6207967dcfc2c8d86f5f5df9da254c3e615433140e81dbcd5fe850290a"}},{"ruleId":"D4","level":"warning","message":{"text":"Members sharing a duplicated core (4 members, 50\u002B identical tokens): Sources/Flux2Core/Transformer/Flux2Attention.swift:442-461 | Sources/Flux2Core/Transformer/Flux2ParallelAttention.swift:318-337 | Sources/Flux2Core/Transformer/Flux2ParallelAttention.swift:443-462 | Sources/Flux2Core/Transformer/Flux2RoPE.swift:208-241 \u2014 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 \u2014 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\u0027 grain \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Transformer/Flux2Attention.swift"},"region":{"startLine":442}}}],"partialFingerprints":{"codehealthFindingId/v1":"6a1e0de60313aafaa3b74fbd1e1302c0d6ff9b52fddc9fe9bb98bb4f29eed344"}},{"ruleId":"D4","level":"warning","message":{"text":"Members sharing a duplicated core (4 members, 50\u002B identical tokens): Sources/FluxTextEncoders/Configuration/EncoderConfiguration.swift:61-83 | Sources/FluxTextEncoders/Configuration/Qwen35Configuration.swift:79-105 | Sources/FluxTextEncoders/Configuration/Qwen3Configuration.swift:51-70 | Sources/FluxTextEncoders/Configuration/Qwen3VLConfiguration.swift:65-89 \u2014 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 \u2014 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\u0027 grain \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Configuration/EncoderConfiguration.swift"},"region":{"startLine":61}}}],"partialFingerprints":{"codehealthFindingId/v1":"f084fb6d4fec8425ac1216597a89e91a6467894290965a772b32fea68bbfeaed"}},{"ruleId":"D4","level":"warning","message":{"text":"Members sharing a duplicated core (4 members, 50\u002B identical tokens): Sources/FluxTextEncoders/Generation/MistralGenerator.swift:426-453 | Sources/FluxTextEncoders/Generation/Qwen3Generator.swift:415-440 | Sources/FluxTextEncoders/Generation/Qwen3VLGenerator.swift:122-155 | Sources/FluxTextEncoders/Model/Qwen35/Qwen35VLM.swift:254-279 \u2014 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 \u2014 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\u0027 grain \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Generation/MistralGenerator.swift"},"region":{"startLine":426}}}],"partialFingerprints":{"codehealthFindingId/v1":"cc54d838821e66ddc6c0c562b6eb3ab439478bc4704ad56c4829b802ef138189"}},{"ruleId":"D4","level":"warning","message":{"text":"Members sharing a duplicated core (4 members, 50\u002B identical tokens): Sources/FluxTextEncoders/Model/MistralAttention.swift:394-474 | Sources/FluxTextEncoders/Model/Qwen3/Qwen3Attention.swift:92-163 | Sources/FluxTextEncoders/Model/Qwen35/Qwen35Attention.swift:65-142 | Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLAttention.swift:62-126 \u2014 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 \u2014 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\u0027 grain \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/MistralAttention.swift"},"region":{"startLine":394}}}],"partialFingerprints":{"codehealthFindingId/v1":"e4012c6e348d6afb3c876cdc6f01caec6035da8eb819d28d26ba3ae5089a54a2"}},{"ruleId":"D4","level":"warning","message":{"text":"Members sharing a duplicated core (4 members, 50\u002B identical tokens): Sources/FluxTextEncoders/Model/MistralModel.swift:99-148 | Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift:58-105 | Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLModel.swift:62-111 | Sources/FluxTextEncoders/Vision/MistralVLM.swift:403-429 \u2014 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 \u2014 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\u0027 grain \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/MistralModel.swift"},"region":{"startLine":99}}}],"partialFingerprints":{"codehealthFindingId/v1":"1bef4d98fac9903d0ad9d4b197aec126f68eeb21e6a5ad333832f32454a72ce1"}},{"ruleId":"D4","level":"warning","message":{"text":"Members sharing a duplicated core (4 members, 50\u002B identical tokens): Sources/FluxTextEncoders/Model/MistralModel.swift:277-323 | Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift:332-386 | Sources/FluxTextEncoders/Model/Qwen35/Qwen35Model.swift:218-289 | Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLModel.swift:298-371 \u2014 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 \u2014 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\u0027 grain \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/MistralModel.swift"},"region":{"startLine":277}}}],"partialFingerprints":{"codehealthFindingId/v1":"8d69c0f1553611d3f8fbedfbd9a928e7e23e5b78febcdaf8263e9082c39431f1"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (76 corresponding lines): Sources/Flux2App/Views/ImageToImageView.swift:249-324 | Sources/Flux2App/Views/TextToImageView.swift:198-293 \u2014 These two members are one piece of code written twice and then edited apart: 76 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ImageToImageView.swift"},"region":{"startLine":249}}}],"partialFingerprints":{"codehealthFindingId/v1":"ad78aa987488ce2f1dbc2345350556c3705c84fac414935756fdf7572d43716b"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (93 corresponding lines): Sources/Flux2App/Views/ImageToImageView.swift:129-221 | Sources/Flux2App/Views/TextToImageView.swift:61-172 \u2014 These two members are one piece of code written twice and then edited apart: 93 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ImageToImageView.swift"},"region":{"startLine":129}}}],"partialFingerprints":{"codehealthFindingId/v1":"514be325991e970dcdc341f030eb005609a0d61d7302e5f70e64fa2a2751db31"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (68 corresponding lines): Sources/Flux2Core/Transformer/Flux2Attention.swift:245-334 | Sources/Flux2Core/Transformer/Flux2Attention.swift:347-414 \u2014 These two members are one piece of code written twice and then edited apart: 68 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Transformer/Flux2Attention.swift"},"region":{"startLine":245}}}],"partialFingerprints":{"codehealthFindingId/v1":"1544d8f605a17870ac8639189291b35a64dc7d3c8027b2c061df3db9b38806f4"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copies of one member (3 members, 75\u002B corresponding lines): Sources/Flux2Core/Transformer/Flux2TransformerBlock.swift:80-168 | Sources/Flux2Core/Transformer/Flux2TransformerBlock.swift:173-250 | Sources/Flux2Core/Transformer/Flux2TransformerBlock.swift:253-327 \u2014 These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 75 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Transformer/Flux2TransformerBlock.swift"},"region":{"startLine":80}}}],"partialFingerprints":{"codehealthFindingId/v1":"72d849e0ae32a4dca7d840a649b54356191456322359a4a235ba771e081dc06f"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (58 corresponding lines): Sources/Flux2Core/Transformer/Flux2ParallelAttention.swift:138-200 | Sources/Flux2Core/Transformer/Flux2ParallelAttention.swift:212-269 \u2014 These two members are one piece of code written twice and then edited apart: 58 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Transformer/Flux2ParallelAttention.swift"},"region":{"startLine":138}}}],"partialFingerprints":{"codehealthFindingId/v1":"1bd4fe52fbc785022d567cf0cb24c6d4fd79b61ac3bbea8ebae37f165a984e16"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (79 corresponding lines): Sources/Flux2App/Views/ContentView.swift:149-242 | Sources/Flux2App/Views/ContentView.swift:247-325 \u2014 These two members are one piece of code written twice and then edited apart: 79 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ContentView.swift"},"region":{"startLine":149}}}],"partialFingerprints":{"codehealthFindingId/v1":"90cace4ae7057b1106ace818620576d6da000d9eebfe499953a4b515e1095c8b"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (72 corresponding lines): Sources/Flux2App/Views/ImageToImageView.swift:411-487 | Sources/Flux2App/Views/TextToImageView.swift:346-417 \u2014 These two members are one piece of code written twice and then edited apart: 72 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ImageToImageView.swift"},"region":{"startLine":411}}}],"partialFingerprints":{"codehealthFindingId/v1":"8c67f060595f365044aa2d5a740adcd6a75044d25176dfd7c2378a9899c0eec1"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (40 corresponding lines): Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1268-1313 | Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1318-1357 \u2014 These two members are one piece of code written twice and then edited apart: 40 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":1268}}}],"partialFingerprints":{"codehealthFindingId/v1":"a37e3255eccc82612ae8458aa399a5f14d9029138250fe2ec28e58239d4b9a98"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (88 corresponding lines): Sources/Flux2Core/Transformer/Flux2Transformer.swift:346-443 | Sources/Flux2Core/Transformer/Flux2Transformer.swift:459-546 \u2014 These two members are one piece of code written twice and then edited apart: 88 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Transformer/Flux2Transformer.swift"},"region":{"startLine":346}}}],"partialFingerprints":{"codehealthFindingId/v1":"2adc38f4a02108e95712a3357734bfa6ad2210f69ac5303d183203ebf7c2c9db"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (70 corresponding lines): Sources/FluxTextEncoders/Embeddings/KleinEmbeddingExtractor.swift:50-134 | Sources/FluxTextEncoders/Embeddings/KleinVLEmbeddingExtractor.swift:44-113 \u2014 These two members are one piece of code written twice and then edited apart: 70 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Embeddings/KleinEmbeddingExtractor.swift"},"region":{"startLine":50}}}],"partialFingerprints":{"codehealthFindingId/v1":"2e17cca21d6b344040f0bb32c729eb820d3f39fad33d5e547cce87c5a16ea0b0"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (59 corresponding lines): Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift:109-179 | Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLModel.swift:115-173 \u2014 These two members are one piece of code written twice and then edited apart: 59 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift"},"region":{"startLine":109}}}],"partialFingerprints":{"codehealthFindingId/v1":"1b59618d28bee2e80df919e121773acd21bcd69b3d713ffea39e36f42a7671c7"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (50 corresponding lines): Sources/Flux2App/Views/ContentView.swift:1994-2043 | Sources/Flux2App/Views/ContentView.swift:2095-2151 \u2014 These two members are one piece of code written twice and then edited apart: 50 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ContentView.swift"},"region":{"startLine":1994}}}],"partialFingerprints":{"codehealthFindingId/v1":"afa84a582f492207a008063c2a8d42cbed8fcee9fb50c2534793b63357284de5"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copies of one member (3 members, 38\u002B corresponding lines): Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:205-253 | Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:304-347 | Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:467-504 \u2014 These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 38 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift"},"region":{"startLine":205}}}],"partialFingerprints":{"codehealthFindingId/v1":"92714aa4882a3f1ba0bb4dfc587a896413920ebbd27f998e70c9c26fb9d250d7"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (29 corresponding lines): Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:2446-2478 | Sources/Flux2Core/Training/Data/LatentCache.swift:462-490 \u2014 These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/Flux2Pipeline.swift"},"region":{"startLine":2446}}}],"partialFingerprints":{"codehealthFindingId/v1":"75ba0732de856b76cb1f7e1fee053b756fee410b79efce449daaa844309258a7"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (35 corresponding lines): Sources/FluxTextEncoders/FluxTextEncoders.swift:189-238 | Sources/FluxTextEncoders/FluxTextEncoders.swift:298-332 \u2014 These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/FluxTextEncoders.swift"},"region":{"startLine":189}}}],"partialFingerprints":{"codehealthFindingId/v1":"d4cd3f571341eb637b501dd3e3dc937180b9301f975613d15347d5f779d67d71"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (34 corresponding lines): Sources/Flux2Core/Pipeline/Flux2Pipeline\u002BChainHelpers.swift:164-197 | Sources/Flux2Core/Pipeline/Flux2Pipeline\u002BChainHelpers.swift:199-236 \u2014 These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/Flux2Pipeline\u002BChainHelpers.swift"},"region":{"startLine":164}}}],"partialFingerprints":{"codehealthFindingId/v1":"0e4c74ec5d12aa11f2859583b3017d20cee8adf840539c1dbb838e4345aa7621"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (18 corresponding lines): Sources/Flux2Core/Training/Model/LoRALinear.swift:368-385 | Sources/Flux2Core/Training/Model/LoRALinear.swift:393-410 \u2014 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 \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Model/LoRALinear.swift"},"region":{"startLine":368}}}],"partialFingerprints":{"codehealthFindingId/v1":"a93eff2b9160088d856f6d32c2d1fb7df9dc214b0a700c3ff70c18db752af671"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (16 corresponding lines): Sources/Flux2Core/Configuration/Flux2Config.swift:350-367 | Sources/Flux2Core/Configuration/VAEConfig.swift:99-114 \u2014 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 \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Configuration/Flux2Config.swift"},"region":{"startLine":350}}}],"partialFingerprints":{"codehealthFindingId/v1":"691f74da9cff49d22424941b63cdc31c000b4b859f5de9bcd86c5e87ba5d050a"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (23 corresponding lines): Sources/FluxTextEncoders/Model/Qwen35/Qwen35Attention.swift:35-63 | Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLAttention.swift:38-60 \u2014 These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/Qwen35/Qwen35Attention.swift"},"region":{"startLine":35}}}],"partialFingerprints":{"codehealthFindingId/v1":"e65cbf4bae721f21683d3567c565ea31aade23954ec23522d213f7d8b690df12"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (35 corresponding lines): Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:74-108 | Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:518-553 \u2014 These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift"},"region":{"startLine":74}}}],"partialFingerprints":{"codehealthFindingId/v1":"9ba3185578d67ba22263ca3e42dcea3ae932ce201ab41ccc2c40912cc7ce1d62"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (41 corresponding lines): Sources/Flux2App/Views/ImageToImageView.swift:366-406 | Sources/Flux2App/Views/TextToImageView.swift:298-341 \u2014 These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ImageToImageView.swift"},"region":{"startLine":366}}}],"partialFingerprints":{"codehealthFindingId/v1":"f8224562bdd5baaad69da8086365c625fc8c24fd4e4c90901c18f07a03c4f57d"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (33 corresponding lines): Sources/FluxTextEncoders/Configuration/EncoderConfiguration.swift:107-145 | Sources/FluxTextEncoders/Configuration/Qwen3VLConfiguration.swift:131-163 \u2014 These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Configuration/EncoderConfiguration.swift"},"region":{"startLine":107}}}],"partialFingerprints":{"codehealthFindingId/v1":"ccec5875bf652febabd02ca07f83e6d5935caf8d6666c7232560192964d704e1"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (32 corresponding lines): Sources/Flux2App/Views/ContentView.swift:2052-2083 | Sources/Flux2App/Views/ContentView.swift:2160-2200 \u2014 These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ContentView.swift"},"region":{"startLine":2052}}}],"partialFingerprints":{"codehealthFindingId/v1":"1d5f5cd418e0acceea90802acf8f883a993987a2097058b432cfca236124d6c0"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (30 corresponding lines): Sources/FluxTextEncoders/FluxTextEncoders.swift:246-275 | Sources/FluxTextEncoders/FluxTextEncoders.swift:335-371 \u2014 These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/FluxTextEncoders.swift"},"region":{"startLine":246}}}],"partialFingerprints":{"codehealthFindingId/v1":"1ffa93b49fa2d6eab4849f2195ab214ee897db16db5dd7a20eb6babf5a3162d4"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (27 corresponding lines): Sources/Flux2CLI/TrainLoRACommand.swift:438-464 | Sources/Flux2CLI/TrainLoRACommand.swift:506-550 \u2014 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 \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/TrainLoRACommand.swift"},"region":{"startLine":438}}}],"partialFingerprints":{"codehealthFindingId/v1":"0f89a698713f295c56582d0066f1ec71b999f741516b75f94b4e1632ed87e047"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (22 corresponding lines): Sources/Flux2Core/Pipeline/LatentUtils.swift:256-286 | Sources/Flux2Core/Transformer/Flux2RoPE.swift:249-270 \u2014 These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/LatentUtils.swift"},"region":{"startLine":256}}}],"partialFingerprints":{"codehealthFindingId/v1":"8349cf6dd944f7d9a08d5304e9ceb81d770707398cca4506b7c040f876ab3fd8"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (35 corresponding lines): Sources/Flux2Core/Training/Data/TrainingDataset.swift:249-283 | Sources/Flux2Core/Training/Data/TrainingDataset.swift:286-334 \u2014 These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Data/TrainingDataset.swift"},"region":{"startLine":249}}}],"partialFingerprints":{"codehealthFindingId/v1":"18e32ffba8d3bf334e76b3229612036b01e1ad13a09235940c2906e72cafa227"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (33 corresponding lines): Sources/Flux2Chains/Flux2MaskedInpaintingChain.swift:250-288 | Sources/Flux2Chains/Flux2OutpaintingChain.swift:136-168 \u2014 These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Chains/Flux2MaskedInpaintingChain.swift"},"region":{"startLine":250}}}],"partialFingerprints":{"codehealthFindingId/v1":"20955fa64fb9191855de1fb5fad37ed1b82e627fa2a47398ce6e9883460cfc1b"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (14 corresponding lines): Sources/FluxTextEncoders/Configuration/TextEncoderModelRegistry.swift:677-697 | Sources/FluxTextEncoders/Configuration/TextEncoderModelRegistry.swift:699-712 \u2014 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 \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Configuration/TextEncoderModelRegistry.swift"},"region":{"startLine":677}}}],"partialFingerprints":{"codehealthFindingId/v1":"899745204fbe1dfda65ec6920808cfd41d68eb957de8a411c6a93924cbe63d0d"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (28 corresponding lines): Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:912-941 | Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:1048-1075 \u2014 These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/Flux2Pipeline.swift"},"region":{"startLine":912}}}],"partialFingerprints":{"codehealthFindingId/v1":"573f2991cddb25053850b526707d48b4329a04db68cf4a291abc996d132b5017"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (25 corresponding lines): Sources/Flux2Core/Loading/KleinTextEncoder.swift:165-189 | Sources/Flux2Core/Loading/MistralEncoder.swift:409-433 \u2014 These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Loading/KleinTextEncoder.swift"},"region":{"startLine":165}}}],"partialFingerprints":{"codehealthFindingId/v1":"694248b1caadf8fb56d612ec03e86456e1554a73c984058b1630f904b63660d3"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copies of one member (3 members, 31\u002B corresponding lines): Sources/Flux2App/ViewModels/ModelManager.swift:221-251 | Sources/Flux2App/ViewModels/ModelManager.swift:326-356 | Sources/Flux2App/ViewModels/ModelManager.swift:552-582 \u2014 These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 31 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/ViewModels/ModelManager.swift"},"region":{"startLine":221}}}],"partialFingerprints":{"codehealthFindingId/v1":"e0d25c8e645510bdd113a79c03f9c638f8169a8d8fdb3920d1afcdec4202436f"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (22 corresponding lines): Sources/Flux2Core/Loading/KleinTextEncoder.swift:123-144 | Sources/Flux2Core/Loading/MistralEncoder.swift:70-91 \u2014 These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Loading/KleinTextEncoder.swift"},"region":{"startLine":123}}}],"partialFingerprints":{"codehealthFindingId/v1":"92b0bd02569d45cd88a35791b01502b5d0e62caf35c10f04eb334e02e0e95dee"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copies of one member (3 members, 16\u002B corresponding lines): Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:2297-2320 | Sources/FluxTextEncoders/FluxTextEncoders.swift:711-729 | Sources/FluxTextEncoders/FluxTextEncoders.swift:731-746 \u2014 These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":2297}}}],"partialFingerprints":{"codehealthFindingId/v1":"52b278043938e36e4f99f2a72dc9c006fb212ff00a0f5822f3d317d522f679b6"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copies of one member (3 members, 30\u002B corresponding lines): Sources/Flux2Core/Transformer/Flux2SingleBlock.swift:59-98 | Sources/Flux2Core/Transformer/Flux2SingleBlock.swift:135-164 | Sources/Flux2Core/Transformer/Flux2SingleBlock.swift:253-288 \u2014 These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 30 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Transformer/Flux2SingleBlock.swift"},"region":{"startLine":59}}}],"partialFingerprints":{"codehealthFindingId/v1":"f87673aa6dc27490cf48b5ce5a6e79c6c74906ace20d8ec7f08f42674214bc13"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (15 corresponding lines): Sources/FluxTextEncoders/Model/Qwen35/Qwen35Model.swift:127-141 | Sources/FluxTextEncoders/Vision/MistralVLM.swift:532-554 \u2014 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 \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/Qwen35/Qwen35Model.swift"},"region":{"startLine":127}}}],"partialFingerprints":{"codehealthFindingId/v1":"c71e7702ac175cefa1b89a3781351bad54fdf2e4d68fd56f53a9834db3f2702a"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (14 corresponding lines): Sources/Flux2Core/Training/Data/LatentCache.swift:446-459 | Sources/Flux2Core/Training/LoRATrainingHelper.swift:330-350 \u2014 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 \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Data/LatentCache.swift"},"region":{"startLine":446}}}],"partialFingerprints":{"codehealthFindingId/v1":"9b54ba3d7b31872029c41c57b499798aec80e31aacc1a21e85d2b176df39456e"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (18 corresponding lines): Sources/Flux2Core/Loading/DevTextEncoder.swift:37-54 | Sources/Flux2Core/Loading/MistralEncoder.swift:36-62 \u2014 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 \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Loading/DevTextEncoder.swift"},"region":{"startLine":37}}}],"partialFingerprints":{"codehealthFindingId/v1":"3a77466c4f2375ee0f88089fe09ec9cd074a0ed577287c4550e521a47a7fd44f"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copies of one member (6 members, 17\u002B corresponding lines): Sources/Flux2Core/Pipeline/LatentUtils.swift:119-142 | Sources/Flux2Core/Pipeline/LatentUtils.swift:152-177 | Sources/Flux2Core/Pipeline/LatentUtils.swift:186-212 | Sources/Flux2Core/Pipeline/LatentUtils.swift:223-246 | Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1225-1241 | Sources/Flux2Core/VAE/AutoencoderKL.swift:333-362 \u2014 These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/LatentUtils.swift"},"region":{"startLine":119}}}],"partialFingerprints":{"codehealthFindingId/v1":"0ee20921eee4d33573b40cbdb8481c03b3bd0a1cc018d98130e022fe82fd6f86"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (20 corresponding lines): Sources/Flux2Core/Training/Optimizer/ResumableAdamW.swift:47-66 | Sources/Flux2Core/Training/Optimizer/ResumableLion.swift:48-69 \u2014 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 \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Optimizer/ResumableAdamW.swift"},"region":{"startLine":47}}}],"partialFingerprints":{"codehealthFindingId/v1":"ab8235b43b3667d7936355e5b582fa1084960500c86a28af70d9a50673b94e7a"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (14 corresponding lines): Sources/Flux2Core/Transformer/Flux2Attention.swift:422-437 | Sources/Flux2Core/Transformer/Flux2ParallelAttention.swift:273-286 \u2014 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 \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Transformer/Flux2Attention.swift"},"region":{"startLine":422}}}],"partialFingerprints":{"codehealthFindingId/v1":"e8097d03f1fa85e84b68e7b20ff7358cc0bdbd29f481ad4fbe1b2b1c74de9d3a"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copies of one member (3 members, 18\u002B corresponding lines): Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift:240-272 | Sources/FluxTextEncoders/Model/Qwen35/Qwen35Model.swift:161-178 | Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLModel.swift:224-242 \u2014 These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift"},"region":{"startLine":240}}}],"partialFingerprints":{"codehealthFindingId/v1":"35952631f7135c1e0ae215455a1e4c9944cd07252dd5f64b35c70feef08fb19d"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (39 corresponding lines): Sources/Flux2App/Views/ImageToImageView.swift:20-68 | Sources/Flux2App/Views/TextToImageView.swift:18-56 \u2014 These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ImageToImageView.swift"},"region":{"startLine":20}}}],"partialFingerprints":{"codehealthFindingId/v1":"721b4bb97bc5f55adbb8c644ec55dac1542f32d846d2c141a377b1f374aa430a"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copies of one member (4 members, 17\u002B corresponding lines): Sources/FluxTextEncoders/FluxTextEncoders.swift:428-446 | Sources/FluxTextEncoders/FluxTextEncoders.swift:449-465 | Sources/FluxTextEncoders/FluxTextEncoders.swift:468-485 | Sources/FluxTextEncoders/FluxTextEncoders.swift:494-512 \u2014 These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/FluxTextEncoders.swift"},"region":{"startLine":428}}}],"partialFingerprints":{"codehealthFindingId/v1":"965896bbd7cd3a89c74153757e3ace68a1262bb7477aa36f7e2a935b84b64211"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (11 corresponding lines): Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:630-640 | Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:643-653 \u2014 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 \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift"},"region":{"startLine":630}}}],"partialFingerprints":{"codehealthFindingId/v1":"9588ccefa7ad4905c5028c69dd814d07d628dfc34e2670fd8356c1b55b960ece"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (12 corresponding lines): Sources/FluxTextEncoders/Model/Qwen35/Qwen35MRoPE.swift:28-39 | Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLMRoPE.swift:31-43 \u2014 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 \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/Qwen35/Qwen35MRoPE.swift"},"region":{"startLine":28}}}],"partialFingerprints":{"codehealthFindingId/v1":"8214a1af0163b4897893d543f752c299461b10e980749d0f4a0a82045ffb947e"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (16 corresponding lines): Sources/Flux2App/ViewModels/ImageGenerationViewModel.swift:322-337 | Sources/Flux2App/Views/ContentView.swift:1696-1711 \u2014 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 \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/ViewModels/ImageGenerationViewModel.swift"},"region":{"startLine":322}}}],"partialFingerprints":{"codehealthFindingId/v1":"b193979ea4405e50d38097ac8d707a3707dafdbf4fe7a2baec48d7878fb0ca62"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (7 corresponding lines): Sources/FluxTextEncoders/FluxTextEncoders.swift:827-833 | Sources/FluxTextEncoders/Vision/MistralVLM.swift:578-584 \u2014 These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/FluxTextEncoders.swift"},"region":{"startLine":827}}}],"partialFingerprints":{"codehealthFindingId/v1":"43bda07fdf2df09fd36d00374eafb288be0db066f8872c5a3c528c4a42ba63ef"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copies of one member (3 members, 12\u002B corresponding lines): Sources/FluxTextEncoders/Model/MistralMLP.swift:25-37 | Sources/FluxTextEncoders/Model/Qwen3/Qwen3MLP.swift:27-40 | Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLMLP.swift:26-37 \u2014 These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/MistralMLP.swift"},"region":{"startLine":25}}}],"partialFingerprints":{"codehealthFindingId/v1":"1f73773c8435e2730fb709ef17ada43334a1f9d92603373112e7fffb0d852fb4"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (21 corresponding lines): Sources/FluxTextEncoders/Model/MistralModel.swift:325-347 | Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLModel.swift:373-393 \u2014 These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/MistralModel.swift"},"region":{"startLine":325}}}],"partialFingerprints":{"codehealthFindingId/v1":"f89f8d3006184d6f41bf8bb361438603933e1d51707115e0ce94616601924f78"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copies of one member (3 members, 22\u002B corresponding lines): Sources/Flux2Core/Training/Configuration/LoRATrainingConfig.swift:748-769 | Sources/Flux2Core/Training/Configuration/LoRATrainingConfig.swift:772-793 | Sources/Flux2Core/Training/Configuration/LoRATrainingConfig.swift:796-817 \u2014 These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 22 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Configuration/LoRATrainingConfig.swift"},"region":{"startLine":748}}}],"partialFingerprints":{"codehealthFindingId/v1":"75be328645c7bd5db8eb9cc8a03ae7d7d130dcd05ab5de1058500dfb96924901"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (19 corresponding lines): Sources/FluxTextEncoders/Generation/MistralGenerator.swift:365-383 | Sources/FluxTextEncoders/Generation/Qwen3Generator.swift:297-317 \u2014 These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Generation/MistralGenerator.swift"},"region":{"startLine":365}}}],"partialFingerprints":{"codehealthFindingId/v1":"007dfaf18f1898186ce29f487b5af0d492fbcd7d0fc754fc5884b4dcab268333"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copies of one member (4 members, 16\u002B corresponding lines): Sources/FluxTextEncoders/Model/MistralModel.swift:82-97 | Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift:41-56 | Sources/FluxTextEncoders/Model/Qwen35/Qwen35Model.swift:59-74 | Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLModel.swift:45-60 \u2014 These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/MistralModel.swift"},"region":{"startLine":82}}}],"partialFingerprints":{"codehealthFindingId/v1":"543cdfd91215815ff7611754dad5dd92b9211dd032079d37289f03320632f26e"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (14 corresponding lines): Sources/Flux2Core/Pipeline/LatentUtils.swift:460-473 | Sources/Flux2Core/Pipeline/LatentUtils.swift:483-496 \u2014 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 \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/LatentUtils.swift"},"region":{"startLine":460}}}],"partialFingerprints":{"codehealthFindingId/v1":"7d0e36ef8ce396d5e09fc0aa99b4a3d0b5073412aaade389b7d526217c3af9a8"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (13 corresponding lines): Sources/FluxGemma4VLM/FluxGemma4VLM.swift:26-39 | Sources/FluxGemma4VLM/FluxGemma4VLM.swift:45-57 \u2014 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 \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxGemma4VLM/FluxGemma4VLM.swift"},"region":{"startLine":26}}}],"partialFingerprints":{"codehealthFindingId/v1":"acc930d9a8d6fbaf1f93247c2de99075f6e9c3418923c4f103ecd434a920a781"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copies of one member (3 members, 20\u002B corresponding lines): Sources/FluxTextEncoders/Model/MistralModel.swift:220-239 | Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift:275-294 | Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLModel.swift:244-265 \u2014 These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/MistralModel.swift"},"region":{"startLine":220}}}],"partialFingerprints":{"codehealthFindingId/v1":"829884140a31d95a9b8ea810db62720d70f9e6d67ee3b9abce3a3b8f3ca86d93"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (11 corresponding lines): Sources/FluxTextEncoders/FluxTextEncoders.swift:768-778 | Sources/FluxTextEncoders/FluxTextEncoders.swift:800-810 \u2014 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 \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/FluxTextEncoders.swift"},"region":{"startLine":768}}}],"partialFingerprints":{"codehealthFindingId/v1":"f473de19c9a2bff7ed2579f73c0fdfa2f90d302660c54157a3625f87eaf483c1"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (17 corresponding lines): Sources/Flux2Core/Pipeline/LatentUtils.swift:23-42 | Sources/Flux2Core/Pipeline/LatentUtils.swift:52-68 \u2014 These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/LatentUtils.swift"},"region":{"startLine":23}}}],"partialFingerprints":{"codehealthFindingId/v1":"2bb78e3de6fff8fd4ab826703d7daa4afc76e5cff93c0f64a56d423c672173f3"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (7 corresponding lines): Sources/Flux2Core/Utils/Flux2Debug.swift:84-90 | Sources/Flux2Core/Utils/Flux2Debug.swift:93-99 \u2014 These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Utils/Flux2Debug.swift"},"region":{"startLine":84}}}],"partialFingerprints":{"codehealthFindingId/v1":"82967f805874ddf914320aaeb781c05f7690675fabc47524e42bdd1b344e55c1"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (5 corresponding lines): Sources/FluxTextEncoders/Model/Qwen35/Qwen35MRoPE.swift:122-126 | Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLMRoPE.swift:119-123 \u2014 These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/Qwen35/Qwen35MRoPE.swift"},"region":{"startLine":122}}}],"partialFingerprints":{"codehealthFindingId/v1":"a3ae1072b61e4aabd8451254705a5e7027f454487a6dcb059e730e448625ffdd"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copies of one member (3 members, 10\u002B corresponding lines): Sources/FluxTextEncoders/Model/MistralModel.swift:21-30 | Sources/FluxTextEncoders/Model/Qwen3/Qwen3DecoderLayer.swift:20-29 | Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLDecoderLayer.swift:25-34 \u2014 These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/MistralModel.swift"},"region":{"startLine":21}}}],"partialFingerprints":{"codehealthFindingId/v1":"53bbcc0afcc14e1477404118553a37c68e65475d47a5f539d68f0e35de6958f9"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (7 corresponding lines): Sources/FluxTextEncoders/Loading/SafetensorsDirectory.swift:22-28 | Sources/FluxTextEncoders/Loading/SafetensorsDirectory.swift:33-41 \u2014 These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Loading/SafetensorsDirectory.swift"},"region":{"startLine":22}}}],"partialFingerprints":{"codehealthFindingId/v1":"518ce7a55b49d396dbf32ca5eb24af0aa8e68bb018a7314afeac4fdf86bf899f"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (14 corresponding lines): Sources/Flux2App/ViewModels/ModelManager.swift:129-143 | Sources/Flux2App/ViewModels/ModelManager.swift:154-167 \u2014 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 \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/ViewModels/ModelManager.swift"},"region":{"startLine":129}}}],"partialFingerprints":{"codehealthFindingId/v1":"8457d4ca27a790de11311abb4362b0ab9838a8c3a6efe024d58d62f9953160df"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (8 corresponding lines): Sources/Flux2Core/Pipeline/LatentUtils.swift:291-298 | Sources/Flux2Core/Transformer/Flux2RoPE.swift:275-285 \u2014 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 \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/LatentUtils.swift"},"region":{"startLine":291}}}],"partialFingerprints":{"codehealthFindingId/v1":"80c8ac35ee3d6224de53f8f8399b9ad0de5a9dca28ff8085a57b377f21f81d8f"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (10 corresponding lines): Sources/FluxTextEncoders/FluxTextEncoders.swift:100-109 | Sources/FluxTextEncoders/FluxTextEncoders.swift:156-165 \u2014 These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/FluxTextEncoders.swift"},"region":{"startLine":100}}}],"partialFingerprints":{"codehealthFindingId/v1":"64ff327f61746871e61fa4aa1e3397e2a2cc3c1e556efa035d9d3b6db2f6de23"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copies of one member (3 members, 10\u002B corresponding lines): Sources/FluxTextEncoders/FluxTextEncoders.swift:374-383 | Sources/FluxTextEncoders/FluxTextEncoders.swift:751-760 | Sources/FluxTextEncoders/FluxTextEncoders.swift:783-792 \u2014 These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/FluxTextEncoders.swift"},"region":{"startLine":374}}}],"partialFingerprints":{"codehealthFindingId/v1":"718d6d18996c51e9f1068148a654f2176f8f94b4730808a5cf9f7b5112bd0a18"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (16 corresponding lines): Sources/Flux2Core/Transformer/Flux2SingleBlock.swift:171-186 | Sources/Flux2Core/Transformer/Flux2TransformerBlock.swift:334-349 \u2014 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 \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Transformer/Flux2SingleBlock.swift"},"region":{"startLine":171}}}],"partialFingerprints":{"codehealthFindingId/v1":"d5137503cba42a540635057f75763c06865ea12293446db1aae7132f98777896"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (6 corresponding lines): Sources/FluxTextEncoders/Configuration/EncoderConfiguration.swift:299-304 | Sources/FluxTextEncoders/Configuration/Qwen3Configuration.swift:179-184 \u2014 These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Configuration/EncoderConfiguration.swift"},"region":{"startLine":299}}}],"partialFingerprints":{"codehealthFindingId/v1":"215d42b5830ed672ec77ca03b2e644ae3db709f43adaa6435f96b9b55dd23e6c"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (11 corresponding lines): Sources/FluxGemma4VLM/Gemma4VLMProvider.swift:93-103 | Sources/FluxGemma4VLM/Gemma4VLMProvider.swift:107-117 \u2014 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 \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxGemma4VLM/Gemma4VLMProvider.swift"},"region":{"startLine":93}}}],"partialFingerprints":{"codehealthFindingId/v1":"bfc67ec794798495fedf36ad9549dcbeda0060871748723cacdffc2ca82029f0"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (7 corresponding lines): Sources/Flux2CLI/TestGemma4.swift:117-123 | Sources/Flux2Core/Training/LoRATrainingSetup.swift:64-73 \u2014 These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/TestGemma4.swift"},"region":{"startLine":117}}}],"partialFingerprints":{"codehealthFindingId/v1":"753a67a6c7809d3f2d9b6c52c3dcd97267a9ff4010f83b26c1ff4540df7c7f88"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (4 corresponding lines): Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:2586-2590 | scripts/fix_learning_curve.swift:28-31 \u2014 These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":2586}}}],"partialFingerprints":{"codehealthFindingId/v1":"1e780d54091f9962d11e6d2a976d534eacec60b9b7c9ae394f1dadc1bf0465ac"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (14 corresponding lines): Sources/FluxTextEncoders/VLM/FluxVLMProvider.swift:79-92 | Sources/FluxTextEncoders/VLM/FluxVLMProvider.swift:118-132 \u2014 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 \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/VLM/FluxVLMProvider.swift"},"region":{"startLine":79}}}],"partialFingerprints":{"codehealthFindingId/v1":"d6bdaf86e7107ff45ced39de77c9417273e9398c6c3070b79ad611d55a1dd7e8"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (5 corresponding lines): Sources/FluxTextEncoders/Vision/ImageProcessor.swift:242-246 | Sources/FluxTextEncoders/Vision/VisionEncoder.swift:483-487 \u2014 These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Vision/ImageProcessor.swift"},"region":{"startLine":242}}}],"partialFingerprints":{"codehealthFindingId/v1":"95eedecf205ea6bc4232e9afcd59f4e7880913f417e4dda91d57e1ab83f1a1b1"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (6 corresponding lines): Sources/Flux2Core/Training/Configuration/LoRATrainingConfig.swift:874-879 | Sources/Flux2Core/Training/Control/TrainingState.swift:249-255 \u2014 These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Configuration/LoRATrainingConfig.swift"},"region":{"startLine":874}}}],"partialFingerprints":{"codehealthFindingId/v1":"6f371002a989a35a0e291c5c08cf07acf10c0c7a73e25e81daa5c8592256d82a"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (8 corresponding lines): Sources/Flux2CLI/TrainLoRACommand.swift:987-994 | Sources/Flux2CLI/TrainingConfigYAML.swift:638-645 \u2014 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 \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/TrainLoRACommand.swift"},"region":{"startLine":987}}}],"partialFingerprints":{"codehealthFindingId/v1":"269267f7356d5201c6ee843e03b2c10b58edc51c7676fa081ae91ba73db2f987"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (4 corresponding lines): Sources/Flux2Core/Transformer/Flux2Attention.swift:199-202 | Sources/Flux2Core/Transformer/Flux2ParallelAttention.swift:290-293 \u2014 These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Transformer/Flux2Attention.swift"},"region":{"startLine":199}}}],"partialFingerprints":{"codehealthFindingId/v1":"7b44404632801cc3c1f7df260af4ab13598b5416f072a8bc27293930f08e91d0"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (4 corresponding lines): Sources/Flux2Core/Transformer/Flux2Attention.swift:206-209 | Sources/Flux2Core/Transformer/Flux2ParallelAttention.swift:295-298 \u2014 These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Transformer/Flux2Attention.swift"},"region":{"startLine":206}}}],"partialFingerprints":{"codehealthFindingId/v1":"ee75d354ac1566414318b8ef4e660094552208e82723018804de65a4f3fe0959"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (7 corresponding lines): Sources/Flux2Core/Configuration/ModelRegistry.swift:442-448 | Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:43-49 \u2014 These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Configuration/ModelRegistry.swift"},"region":{"startLine":442}}}],"partialFingerprints":{"codehealthFindingId/v1":"005fab0190ced3efdd800bf75accb62ecf70d45197848c14f020de83f61cacd9"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copies of one member (3 members, 4\u002B corresponding lines): Sources/FluxTextEncoders/Model/MistralModel.swift:242-245 | Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift:297-300 | Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLModel.swift:267-270 \u2014 These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/MistralModel.swift"},"region":{"startLine":242}}}],"partialFingerprints":{"codehealthFindingId/v1":"5827e3ebf5c7e491075a65dbd05b301d3271db8b85c95bfe73b733d56c71c472"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (8 corresponding lines): Sources/Flux2Core/Training/Optimizer/ResumableAdamW.swift:34-41 | Sources/Flux2Core/Training/Optimizer/ResumableLion.swift:35-42 \u2014 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 \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Optimizer/ResumableAdamW.swift"},"region":{"startLine":34}}}],"partialFingerprints":{"codehealthFindingId/v1":"50f18aec02f6ec3ff750c6354fda94baaab89388eaa66e4910a9843b5016f63e"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (4 corresponding lines): Sources/Flux2App/ViewModels/ImageGenerationViewModel.swift:182-185 | Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:2313-2316 \u2014 These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/ViewModels/ImageGenerationViewModel.swift"},"region":{"startLine":182}}}],"partialFingerprints":{"codehealthFindingId/v1":"cf66c460aef5722431495ab47d382bee09d804744b86e6430116828e27114d68"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (4 corresponding lines): Sources/Flux2Core/Loading/KleinTextEncoder.swift:155-158 | Sources/Flux2Core/Loading/MistralEncoder.swift:399-402 \u2014 These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Loading/KleinTextEncoder.swift"},"region":{"startLine":155}}}],"partialFingerprints":{"codehealthFindingId/v1":"2e9949974f3e9e33404547eb825cda7208b4d7b77f681775e3c98b5bedd6bbbd"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (3 corresponding lines): Sources/Flux2Core/Loading/ModelDownloader.swift:232-237 | Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:200-202 \u2014 These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Loading/ModelDownloader.swift"},"region":{"startLine":232}}}],"partialFingerprints":{"codehealthFindingId/v1":"2a2ad5afc775fd0cd9095087cb03fc4e368c4e8eab78221a7848f7692da3533e"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (5 corresponding lines): Sources/FluxTextEncoders/Configuration/EncoderConfiguration.swift:293-297 | Sources/FluxTextEncoders/Configuration/Qwen3Configuration.swift:173-177 \u2014 These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Configuration/EncoderConfiguration.swift"},"region":{"startLine":293}}}],"partialFingerprints":{"codehealthFindingId/v1":"8397cf54b742af1586021c5d3e020690e0fa5c337922a629431f4c0f513500ad"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (11 corresponding lines): Sources/Flux2Core/Loading/DevTextEncoder.swift:136-149 | Sources/Flux2Core/Loading/MistralEncoder.swift:484-494 \u2014 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 \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Loading/DevTextEncoder.swift"},"region":{"startLine":136}}}],"partialFingerprints":{"codehealthFindingId/v1":"9d1131f0d3e69ea6cb6bc3dd338e5f5947e561f7c8a9f9ec1edfe7c18f9726b1"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (8 corresponding lines): Sources/Flux2Core/Configuration/ModelRegistry.swift:300-307 | Sources/Flux2Core/Loading/DevTextEncoder.swift:57-68 \u2014 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 \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Configuration/ModelRegistry.swift"},"region":{"startLine":300}}}],"partialFingerprints":{"codehealthFindingId/v1":"bfad6b00683acf192770d6ae6a9d209a7b23a2a975c10ca89ae64476fe75b4fb"}},{"ruleId":"D4","level":"warning","message":{"text":"Edited copy of a member (6 corresponding lines): Sources/FluxTextEncoders/Generation/Qwen3Generator.swift:24-32 | Sources/FluxTextEncoders/Generation/Qwen3VLGenerator.swift:23-28 \u2014 These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below \u2014 the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members\u0027 grain \u2014 factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Generation/Qwen3Generator.swift"},"region":{"startLine":24}}}],"partialFingerprints":{"codehealthFindingId/v1":"24c786c65861b0f2047b12acdff1fbaa20f0c6d562fbf63a4eacc7ef1e74eb96"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (59\u201361 lines \u00D7 2): Sources/Flux2App/Views/ImageToImageView.swift:129-187 | Sources/Flux2App/Views/TextToImageView.swift:61-121 \u2014 before extracting anything, compare \u0060Sources/Flux2App/Views/ImageToImageView.swift\u0060 and \u0060Sources/Flux2App/Views/TextToImageView.swift\u0060 as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 270 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 \u2014 extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2App/Views/ImageToImageView.swift:129\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 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 \u0060spacing\u0060 to \u006012\u0060 in one and \u006016\u0060 in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH \u2014 their common supertype where they have one, or a new abstraction over them where they do not \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ImageToImageView.swift"},"region":{"startLine":129}}}],"partialFingerprints":{"codehealthFindingId/v1":"41b889f4eb521f442ae8a2a25b9c273a97f1ec105048fcec9b72aa5b79715079"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (48\u201355 lines \u00D7 3): Sources/Flux2Core/Transformer/Flux2TransformerBlock.swift:110-164 | Sources/Flux2Core/Transformer/Flux2TransformerBlock.swift:199-247 | Sources/Flux2Core/Transformer/Flux2TransformerBlock.swift:277-324 \u2014 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 \u2014 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 \u0060Sources/Flux2Core/Transformer/Flux2TransformerBlock.swift:110\u0060 it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows \u2014 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\u0027 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 \u2014 a one-line delegation has no helper inside it to lift \u2014 so generate the run from the set it enumerates, or accept it and keep each member\u0027s own documentation with it."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Transformer/Flux2TransformerBlock.swift"},"region":{"startLine":110}}}],"partialFingerprints":{"codehealthFindingId/v1":"a5a54af5226ad71e1438df54f309cb53ddcb41762a44d4cba26c3bfea94845be"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (52\u201355 lines \u00D7 2): Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:1684-1735 | Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:1806-1860 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:1684\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/Flux2Pipeline.swift"},"region":{"startLine":1684}}}],"partialFingerprints":{"codehealthFindingId/v1":"c74ac2a1b2eb09dde68d5d98e7ce760a4b924abdcdd8e1b3fd6422deb37546a9"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (48\u201350 lines \u00D7 2): Sources/Flux2CLI/Flux2CLI.swift:145-194 | Sources/Flux2CLI/Flux2CLI.swift:504-551 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/Flux2CLI.swift"},"region":{"startLine":145}}}],"partialFingerprints":{"codehealthFindingId/v1":"e5e5618b781fd72d8a941ee1327173dc0b903351a5c265eb49b59e7f943ea216"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (44\u201350 lines \u00D7 2): Sources/FluxTextEncoders/Generation/MistralGenerator.swift:110-159 | Sources/FluxTextEncoders/Generation/MistralGenerator.swift:248-291 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/FluxTextEncoders/Generation/MistralGenerator.swift:110\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Generation/MistralGenerator.swift"},"region":{"startLine":110}}}],"partialFingerprints":{"codehealthFindingId/v1":"496ad3d7a7bc93f49818ea72b58c7605610b7477b2dafea2759c4d48ee687829"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (45 lines \u00D7 2): Sources/Flux2App/Views/ImageToImageView.swift:492-536 | Sources/Flux2App/Views/TextToImageView.swift:422-466 \u2014 before extracting anything, compare \u0060Sources/Flux2App/Views/ImageToImageView.swift\u0060 and \u0060Sources/Flux2App/Views/TextToImageView.swift\u0060 as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 270 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 \u2014 extracting one helper per block leaves the fork in place."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ImageToImageView.swift"},"region":{"startLine":492}}}],"partialFingerprints":{"codehealthFindingId/v1":"e85416733cb8aba7d959f8a685427a7aef8a62c15c0a6a100941353c15bedd81"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (42\u201344 lines \u00D7 2): Sources/FluxTextEncoders/Model/MistralModel.swift:99-142 | Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift:58-99 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Model/MistralModel.swift\u0060 and \u0060Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift\u0060 as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 169 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 \u0060Sources/FluxTextEncoders/Model/MistralModel.swift:99\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/MistralModel.swift"},"region":{"startLine":99}}}],"partialFingerprints":{"codehealthFindingId/v1":"4fb11f30949d71a17a5eacd77f2d7ff027ab94cb9f503d77018de8d08507a61e"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (38\u201341 lines \u00D7 2): Sources/FluxTextEncoders/Generation/Qwen3Generator.swift:58-98 | Sources/FluxTextEncoders/Generation/Qwen3Generator.swift:187-224 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/FluxTextEncoders/Generation/Qwen3Generator.swift:58\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Generation/Qwen3Generator.swift"},"region":{"startLine":58}}}],"partialFingerprints":{"codehealthFindingId/v1":"26645575d227f1b42119bf3d822707dcb29ee421b913737ec8ca4f2a081f31f8"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (25\u201337 lines \u00D7 4): Sources/FluxTextEncoders/Model/MistralAttention.swift:434-470 | Sources/FluxTextEncoders/Model/Qwen3/Qwen3Attention.swift:129-159 | Sources/FluxTextEncoders/Model/Qwen35/Qwen35Attention.swift:109-133 | Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLAttention.swift:95-122 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Model/MistralAttention.swift\u0060 and \u0060Sources/FluxTextEncoders/Model/Qwen3/Qwen3Attention.swift\u0060 as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 85 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. 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 \u2014 the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/MistralAttention.swift"},"region":{"startLine":434}}}],"partialFingerprints":{"codehealthFindingId/v1":"86575a19803363196069113c0c4cf7cd80abe56467d38abb3c7a339491d4d683"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (33\u201335 lines \u00D7 2): Sources/Flux2Core/Transformer/Flux2Attention.swift:251-285 | Sources/Flux2Core/Transformer/Flux2Attention.swift:353-385 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Transformer/Flux2Attention.swift"},"region":{"startLine":251}}}],"partialFingerprints":{"codehealthFindingId/v1":"e582e09e3cc88ce92db66ed7b8cbd6f91cef2935baf67e633f83ff23e2fca0d2"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (35 lines \u00D7 2): Sources/FluxTextEncoders/Generation/MistralGenerator.swift:388-422 | Sources/FluxTextEncoders/Generation/Qwen3Generator.swift:322-356 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Generation/MistralGenerator.swift\u0060 and \u0060Sources/FluxTextEncoders/Generation/Qwen3Generator.swift\u0060 as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 158 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 \u2014 extracting one helper per block leaves the fork in place."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Generation/MistralGenerator.swift"},"region":{"startLine":388}}}],"partialFingerprints":{"codehealthFindingId/v1":"39d53a943fe21abe7960850759c0a83e44f7414993abe683bfd4a1ffe01218ad"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (34 lines \u00D7 2): Sources/Flux2App/Views/ContentView.swift:2010-2043 | Sources/Flux2App/Views/ContentView.swift:2118-2151 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2App/Views/ContentView.swift:2010\u0060 it runs out through the closing brace of the declaration holding it \u2014 the window is that declaration\u0027s tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ContentView.swift"},"region":{"startLine":2010}}}],"partialFingerprints":{"codehealthFindingId/v1":"996bb8f4ba2ab1289b5965f63ac1c9fed7f2993dc2a1448e6784b128406344b3"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (34 lines \u00D7 2): Sources/Flux2App/Views/ImageToImageView.swift:288-321 | Sources/Flux2App/Views/TextToImageView.swift:256-289 \u2014 before extracting anything, compare \u0060Sources/Flux2App/Views/ImageToImageView.swift\u0060 and \u0060Sources/Flux2App/Views/TextToImageView.swift\u0060 as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 270 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 \u2014 extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2App/Views/ImageToImageView.swift:288\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that. \u2605 These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, \u0060Sources/Flux2App/Views/TextToImageView.swift:290\u0060 calls \u0060help\u0060 and \u0060Sources/Flux2App/Views/ImageToImageView.swift:322\u0060 does not \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ImageToImageView.swift"},"region":{"startLine":288}}}],"partialFingerprints":{"codehealthFindingId/v1":"0f8167d7c8b868d1e4c576cab51961bd9e1f28971f066f9d8a5540ef32a30284"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (32\u201334 lines \u00D7 2): Sources/Flux2Core/Loading/MistralEncoder.swift:107-140 | Sources/Flux2Core/Loading/MistralEncoder.swift:338-369 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2Core/Loading/MistralEncoder.swift:107\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Loading/MistralEncoder.swift"},"region":{"startLine":107}}}],"partialFingerprints":{"codehealthFindingId/v1":"f1fb84b8be3074e42ab40cb4b9b5e63aa13fae665ce729126ec3aed5599b2c16"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (34 lines \u00D7 2): Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:1763-1796 | Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:1997-2030 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/Flux2Pipeline.swift"},"region":{"startLine":1763}}}],"partialFingerprints":{"codehealthFindingId/v1":"178f7e451b22716f91aa81ec36ef95556af15239b814a2c25a6dfb2f66162e58"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (28\u201334 lines \u00D7 2): Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift:146-179 | Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLModel.swift:146-173 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift\u0060 and \u0060Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLModel.swift\u0060 as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 195 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 \u0060Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift:146\u0060 it runs out through the closing brace of the declaration holding it \u2014 the window is that declaration\u0027s tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that. The \u0060return\u0060 at the foot of the matched lines is the enclosing body\u0027s own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that \u0060return\u0060 occupied \u2014 no decision has to be handed back and re-acted on."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift"},"region":{"startLine":146}}}],"partialFingerprints":{"codehealthFindingId/v1":"eb6a4644ccdefb5394c395e2aebe58e3305b8b13f260d697db9908bcb33baf88"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (33 lines \u00D7 2): Sources/Flux2CLI/Flux2CLI.swift:269-301 | Sources/Flux2CLI/Flux2CLI.swift:690-722 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/Flux2CLI.swift"},"region":{"startLine":269}}}],"partialFingerprints":{"codehealthFindingId/v1":"69aa1c9f4c3015f51818a9351d32fe91280e72bef6e6ad31aa4f0d01f56911a8"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (32 lines \u00D7 2): Sources/Flux2App/Views/ImageToImageView.swift:442-473 | Sources/Flux2App/Views/TextToImageView.swift:372-403 \u2014 before extracting anything, compare \u0060Sources/Flux2App/Views/ImageToImageView.swift\u0060 and \u0060Sources/Flux2App/Views/TextToImageView.swift\u0060 as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 270 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 \u2014 extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2App/Views/ImageToImageView.swift:442\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that. \u2605 These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, \u0060Sources/Flux2App/Views/TextToImageView.swift:370\u0060 calls \u0060help\u0060 and \u0060Sources/Flux2App/Views/ImageToImageView.swift:440\u0060 does not \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ImageToImageView.swift"},"region":{"startLine":442}}}],"partialFingerprints":{"codehealthFindingId/v1":"502463524b43c3ad35cb08f3761ab7fc3139df6e0be24f61d7b76b5611f3490a"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (21\u201329 lines \u00D7 3): Sources/FluxTextEncoders/Model/MistralModel.swift:165-193 | Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift:193-214 | Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLModel.swift:184-204 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Model/MistralModel.swift\u0060 and \u0060Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift\u0060 as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 169 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 \u0060Sources/FluxTextEncoders/Model/MistralModel.swift:165\u0060 it runs out through the closing brace of the declaration holding it \u2014 the window is that declaration\u0027s tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that. The \u0060return\u0060 at the foot of the matched lines is the enclosing body\u0027s own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that \u0060return\u0060 occupied \u2014 no decision has to be handed back and re-acted on."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/MistralModel.swift"},"region":{"startLine":165}}}],"partialFingerprints":{"codehealthFindingId/v1":"34add79b952da287c740c3b25cd2bcada70cc7ab3db09b25fbdb7de6adcffa2b"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (15\u201329 lines \u00D7 3): Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift:240-268 | Sources/FluxTextEncoders/Model/Qwen35/Qwen35Model.swift:161-176 | Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLModel.swift:224-238 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift\u0060 and \u0060Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLModel.swift\u0060 as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 195 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 \u0060Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift:240\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift"},"region":{"startLine":240}}}],"partialFingerprints":{"codehealthFindingId/v1":"7b75c1bd4c02df41840f4424ab6b58657db9834f4974ca5559430fdc3771108b"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (26\u201329 lines \u00D7 2): Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1765-1793 | Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1889-1914 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1765\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":1765}}}],"partialFingerprints":{"codehealthFindingId/v1":"a40ddc89c044a78dc26ee6042f3b6f8ca9f7fbdca574784a1dec409996326417"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (49\u201353 lines \u00D7 2): Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:2494-2546 | scripts/fix_learning_curve.swift:189-237 \u2014 the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach \u2014 a location they all depend on today, or a new shared one if there is none \u2014 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 \u0060Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:2494\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":2494}}}],"partialFingerprints":{"codehealthFindingId/v1":"9851635231fd1887e962f4337c64d5fe115a5c7d20d5e27babbe958a34363edc"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (25\u201326 lines \u00D7 4): Sources/FluxTextEncoders/Generation/MistralGenerator.swift:168-193 | Sources/FluxTextEncoders/Generation/MistralGenerator.swift:300-325 | Sources/FluxTextEncoders/Generation/Qwen3Generator.swift:105-130 | Sources/FluxTextEncoders/Generation/Qwen3Generator.swift:231-255 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Generation/MistralGenerator.swift\u0060 and \u0060Sources/FluxTextEncoders/Generation/Qwen3Generator.swift\u0060 as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 158 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 \u2014 extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/FluxTextEncoders/Generation/MistralGenerator.swift:168\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Generation/MistralGenerator.swift"},"region":{"startLine":168}}}],"partialFingerprints":{"codehealthFindingId/v1":"c402a52f2cf69464795fde3ef23510288a249bbb799f6667cf70dfb147081287"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (21\u201325 lines \u00D7 4): Sources/FluxTextEncoders/Generation/MistralGenerator.swift:128-152 | Sources/FluxTextEncoders/Generation/MistralGenerator.swift:264-285 | Sources/FluxTextEncoders/Generation/Qwen3Generator.swift:70-91 | Sources/FluxTextEncoders/Generation/Qwen3Generator.swift:198-218 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Generation/MistralGenerator.swift\u0060 and \u0060Sources/FluxTextEncoders/Generation/Qwen3Generator.swift\u0060 as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 158 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 \u2014 extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/FluxTextEncoders/Generation/MistralGenerator.swift:128\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Generation/MistralGenerator.swift"},"region":{"startLine":128}}}],"partialFingerprints":{"codehealthFindingId/v1":"e2c14109e1e02b7fd0f1c6a5cbd64fa4c9deb9bc203b2c9e0119d70028b04049"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (25 lines \u00D7 2): Sources/Flux2App/Views/ImageToImageView.swift:249-273 | Sources/Flux2App/Views/TextToImageView.swift:198-222 \u2014 before extracting anything, compare \u0060Sources/Flux2App/Views/ImageToImageView.swift\u0060 and \u0060Sources/Flux2App/Views/TextToImageView.swift\u0060 as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 270 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 \u2014 extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2App/Views/ImageToImageView.swift:249\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ImageToImageView.swift"},"region":{"startLine":249}}}],"partialFingerprints":{"codehealthFindingId/v1":"e2db02b434e147b4f328b60170decf0f8b5f5fa9e1359370892721f9522b811f"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (25 lines \u00D7 2): Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1915-1939 | Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1946-1970 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":1915}}}],"partialFingerprints":{"codehealthFindingId/v1":"5c59c169e7a32b54331cf36ad55041a0947473767fc0e8c85df84996ff0699b0"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (22\u201325 lines \u00D7 2): Sources/FluxTextEncoders/Embeddings/KleinEmbeddingExtractor.swift:50-74 | Sources/FluxTextEncoders/Embeddings/KleinVLEmbeddingExtractor.swift:44-65 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Embeddings/KleinEmbeddingExtractor.swift\u0060 and \u0060Sources/FluxTextEncoders/Embeddings/KleinVLEmbeddingExtractor.swift\u0060 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. 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 \u2014 extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/FluxTextEncoders/Embeddings/KleinEmbeddingExtractor.swift:50\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that. \u2605 These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, \u0060Sources/FluxTextEncoders/Embeddings/KleinEmbeddingExtractor.swift:75\u0060 calls \u0060log\u0060 and \u0060Sources/FluxTextEncoders/Embeddings/KleinVLEmbeddingExtractor.swift:66\u0060 does not \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Embeddings/KleinEmbeddingExtractor.swift"},"region":{"startLine":50}}}],"partialFingerprints":{"codehealthFindingId/v1":"c29ade72e669025bffacc3ba728e03c925a34ff380fc3511c3ba0adc7d7b7f7b"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (23\u201324 lines \u00D7 2): Sources/Flux2App/Views/ImageToImageView.swift:384-406 | Sources/Flux2App/Views/TextToImageView.swift:318-341 \u2014 before extracting anything, compare \u0060Sources/Flux2App/Views/ImageToImageView.swift\u0060 and \u0060Sources/Flux2App/Views/TextToImageView.swift\u0060 as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 270 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 \u2014 extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2App/Views/ImageToImageView.swift:384\u0060 it runs out through the closing brace of the declaration holding it \u2014 the window is that declaration\u0027s tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ImageToImageView.swift"},"region":{"startLine":384}}}],"partialFingerprints":{"codehealthFindingId/v1":"7d04bcc42b9cff3e9671a18a3be1e1a274bbb31a7b4ade3a2b56f8a925152352"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (24 lines \u00D7 2): Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:466-489 | Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:568-591 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":466}}}],"partialFingerprints":{"codehealthFindingId/v1":"c2a616cf284030bdc0fa665545e55bd32ad235fb2dd689785438c66105c34837"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (18\u201323 lines \u00D7 3): Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:1698-1715 | Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:1821-1840 | Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:2055-2077 \u2014 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 \u2014 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 \u0060Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:1698\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that. \u2605 These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, \u0060Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:2078\u0060 calls \u0060verbose\u0060 and \u0060Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:1716\u0060 does not \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/Flux2Pipeline.swift"},"region":{"startLine":1698}}}],"partialFingerprints":{"codehealthFindingId/v1":"55e5c1464351a1c5fd6d3d25287f7404cc05edc43c1817d61fa2404bc2a28f7a"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (24 lines \u00D7 2): Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1794-1817 | Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1824-1847 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":1794}}}],"partialFingerprints":{"codehealthFindingId/v1":"6f645d9396063431bd8fdde226d4d6071113bbd35dd6a575b04cd63985c7ded0"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (23 lines \u00D7 2): Sources/FluxEncodersCLI/FluxEncodersCLI.swift:118-140 | Sources/FluxEncodersCLI/FluxEncodersCLI.swift:708-730 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/FluxEncodersCLI/FluxEncodersCLI.swift:118\u0060 it runs out through the closing brace of the declaration holding it \u2014 the window is that declaration\u0027s tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxEncodersCLI/FluxEncodersCLI.swift"},"region":{"startLine":118}}}],"partialFingerprints":{"codehealthFindingId/v1":"37c22b51bc193e5c2f4dc0cd1f6bbadf07680de522a373547e9df591101e18f0"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (17\u201323 lines \u00D7 2): Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift:119-141 | Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLModel.swift:127-143 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift\u0060 and \u0060Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLModel.swift\u0060 as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 195 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 \u0060Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift:119\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that. \u2605 These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, \u0060Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLModel.swift:125\u0060 calls \u0060textOnlyPositionIds\u0060 and \u0060Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift:116\u0060 does not \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift"},"region":{"startLine":119}}}],"partialFingerprints":{"codehealthFindingId/v1":"280184b1d59db68b2a4a6998b4b5cbf81ed2bf61afc650141bbe5bafa7429766"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (16\u201321 lines \u00D7 3): Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:1681-1696 | Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:1803-1819 | Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:2033-2053 \u2014 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 \u2014 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 \u0060Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:1681\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/Flux2Pipeline.swift"},"region":{"startLine":1681}}}],"partialFingerprints":{"codehealthFindingId/v1":"275f6b12ee844148f23358e3ddde16620cd5152e23bc7399017e13aed3e49f11"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (20 lines \u00D7 2): Sources/Flux2CLI/Flux2CLI.swift:197-216 | Sources/Flux2CLI/Flux2CLI.swift:652-671 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/Flux2CLI.swift"},"region":{"startLine":197}}}],"partialFingerprints":{"codehealthFindingId/v1":"cb0ff6871721cd48a58eddfe085693ae15947331ff90c4da850cec599b1a1382"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (37\u201338 lines \u00D7 2): Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:1568-1604 | Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:1936-1973 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/Flux2Pipeline.swift"},"region":{"startLine":1568}}}],"partialFingerprints":{"codehealthFindingId/v1":"538e743d04b45a9a1fd4455b7f25e072fc184dfe409c8b1ab1da6b750685875d"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (16\u201320 lines \u00D7 2): Sources/Flux2Core/Training/LoRATrainingHelper.swift:160-179 | Sources/Flux2Core/Training/LoRATrainingHelper.swift:530-545 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2Core/Training/LoRATrainingHelper.swift:160\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/LoRATrainingHelper.swift"},"region":{"startLine":160}}}],"partialFingerprints":{"codehealthFindingId/v1":"942bccb6507bf2a1a29b696533c6b6e62e860c0e118c79806f1c33c3969ecd79"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (14\u201320 lines \u00D7 2): Sources/Flux2Core/Transformer/Flux2ParallelAttention.swift:104-123 | Sources/Flux2Core/Transformer/Flux2ParallelAttention.swift:256-269 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2Core/Transformer/Flux2ParallelAttention.swift:104\u0060 it runs out through the closing brace of the declaration holding it \u2014 the window is that declaration\u0027s tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that. The \u0060return\u0060 at the foot of the matched lines is the enclosing body\u0027s own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that \u0060return\u0060 occupied \u2014 no decision has to be handed back and re-acted on."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Transformer/Flux2ParallelAttention.swift"},"region":{"startLine":104}}}],"partialFingerprints":{"codehealthFindingId/v1":"8389a7247fd8ee21afd9ac41af9d3873221376fd36364ecde5abe7c05d8566b0"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (19 lines \u00D7 2): Sources/Flux2App/Views/ContentView.swift:1494-1512 | Sources/Flux2App/Views/ContentView.swift:1624-1642 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ContentView.swift"},"region":{"startLine":1494}}}],"partialFingerprints":{"codehealthFindingId/v1":"81452605448678194e61d64ec35fafa616912ae83b6e15b5a01d22cab0e9ec3a"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (16\u201319 lines \u00D7 2): Sources/Flux2Core/Loading/WeightLoader.swift:605-623 | Sources/Flux2Core/Loading/WeightLoader.swift:673-688 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2Core/Loading/WeightLoader.swift:605\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Loading/WeightLoader.swift"},"region":{"startLine":605}}}],"partialFingerprints":{"codehealthFindingId/v1":"7f3b0e36dd865af04e12a043ca1f8ed2761ae647dcc5beb35375abd29a24de05"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (19 lines \u00D7 2): Sources/FluxTextEncoders/Model/MistralModel.swift:32-50 | Sources/FluxTextEncoders/Model/Qwen3/Qwen3DecoderLayer.swift:31-49 \u2014 the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach \u2014 a location they all depend on today, or a new shared one if there is none \u2014 and call it from each site; until then, every change has to be made twice."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/MistralModel.swift"},"region":{"startLine":32}}}],"partialFingerprints":{"codehealthFindingId/v1":"d6b7518979f64d05b11ba782c72211a46dd1f161c7bbac3f45b05df647c0e146"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (17\u201318 lines \u00D7 3): Sources/FluxTextEncoders/Model/MistralModel.swift:131-148 | Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift:88-105 | Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLModel.swift:95-111 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Model/MistralModel.swift\u0060 and \u0060Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift\u0060 as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 169 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 \u0060Sources/FluxTextEncoders/Model/MistralModel.swift:131\u0060 it runs out through the closing brace of the declaration holding it \u2014 the window is that declaration\u0027s tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that. The \u0060return\u0060 at the foot of the matched lines is the enclosing body\u0027s own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that \u0060return\u0060 occupied \u2014 no decision has to be handed back and re-acted on."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/MistralModel.swift"},"region":{"startLine":131}}}],"partialFingerprints":{"codehealthFindingId/v1":"7fccb2bfed25056702142188090ad72d7d31286be80fdefd4e6aba2fd673d029"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (17\u201318 lines \u00D7 2): Sources/Flux2App/ViewModels/ImageGenerationViewModel.swift:259-275 | Sources/Flux2App/ViewModels/ImageGenerationViewModel.swift:284-301 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2App/ViewModels/ImageGenerationViewModel.swift:259\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 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 \u2014 the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/ViewModels/ImageGenerationViewModel.swift"},"region":{"startLine":259}}}],"partialFingerprints":{"codehealthFindingId/v1":"5e613ed12db6cefbed26157468034565de0ab9795d607922b67977da350a1f19"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (17\u201318 lines \u00D7 2): Sources/Flux2Core/Transformer/Flux2Attention.swift:212-229 | Sources/Flux2Core/Transformer/Flux2ParallelAttention.swift:300-316 \u2014 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 \u2014 a file they already depend on, or a new one alongside them \u2014 and call it from both call sites, so a change lands once."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Transformer/Flux2Attention.swift"},"region":{"startLine":212}}}],"partialFingerprints":{"codehealthFindingId/v1":"9098b2b14b60c1c00ead4987abc47aa9e8cfab2fbca05aa8e41fe1e21996c256"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (16\u201318 lines \u00D7 2): Sources/FluxTextEncoders/Vision/Qwen35ImageProcessor.swift:58-75 | Sources/FluxTextEncoders/Vision/Qwen35ImageProcessor.swift:122-137 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Vision/Qwen35ImageProcessor.swift"},"region":{"startLine":58}}}],"partialFingerprints":{"codehealthFindingId/v1":"a1db2289538f708149952f95305595334e88c85bbd74a9f296759513a09881ab"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (16\u201317 lines \u00D7 3): Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:366-382 | Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:419-435 | Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:521-536 \u2014 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 \u2014 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 \u0060Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:366\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift"},"region":{"startLine":366}}}],"partialFingerprints":{"codehealthFindingId/v1":"cf37f2d8ee456a99b140b7fa1710a4ef78a93e4c6c23ec370876d06c34a986aa"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (17 lines \u00D7 2): Sources/Flux2App/Views/ImageToImageView.swift:226-242 | Sources/Flux2App/Views/TextToImageView.swift:177-193 \u2014 before extracting anything, compare \u0060Sources/Flux2App/Views/ImageToImageView.swift\u0060 and \u0060Sources/Flux2App/Views/TextToImageView.swift\u0060 as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 270 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 \u2014 extracting one helper per block leaves the fork in place. \u2605 These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, \u0060Sources/Flux2App/Views/ImageToImageView.swift:220\u0060 calls \u0060frame\u0060 and \u0060Sources/Flux2App/Views/TextToImageView.swift:171\u0060 does not \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ImageToImageView.swift"},"region":{"startLine":226}}}],"partialFingerprints":{"codehealthFindingId/v1":"0b7a0ed5f3576ed16e528a4efcb48138f5b1669a135d1f11c5c359310bdcc455"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (16\u201317 lines \u00D7 2): Sources/Flux2App/Views/ImageToImageView.swift:366-381 | Sources/Flux2App/Views/TextToImageView.swift:298-314 \u2014 before extracting anything, compare \u0060Sources/Flux2App/Views/ImageToImageView.swift\u0060 and \u0060Sources/Flux2App/Views/TextToImageView.swift\u0060 as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 270 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 \u2014 extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2App/Views/ImageToImageView.swift:366\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ImageToImageView.swift"},"region":{"startLine":366}}}],"partialFingerprints":{"codehealthFindingId/v1":"895b49464c32f28350652d7e221b9d617b710944abd586d4b7232b3a74636597"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (17 lines \u00D7 2): Sources/Flux2CLI/CompareEncoders.swift:167-183 | Sources/Flux2CLI/CompareEncoders.swift:188-204 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/CompareEncoders.swift"},"region":{"startLine":167}}}],"partialFingerprints":{"codehealthFindingId/v1":"92519af510fcd728132284abcbbfed7c8242964feeea3150f36cfd71742ab8e7"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (3\u201317 lines \u00D7 3): Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1297-1313 | Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1341-1357 | Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1522-1524 \u2014 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 \u2014 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 \u0060Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1297\u0060 it runs out through the closing brace of the declaration holding it \u2014 the window is that declaration\u0027s tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand \u2014 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 \u2014 the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":1297}}}],"partialFingerprints":{"codehealthFindingId/v1":"3127d4c93d69a45b255aff469cdc385c6887c03be6cea629b61f7b622ebaa60b"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (16\u201317 lines \u00D7 2): Sources/Flux2Core/Training/Optimizer/ResumableAdamW.swift:47-63 | Sources/Flux2Core/Training/Optimizer/ResumableLion.swift:48-63 \u2014 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 \u2014 a file they already depend on, or a new one alongside them \u2014 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 \u0060Sources/Flux2Core/Training/Optimizer/ResumableAdamW.swift:47\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that. \u2605 These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, \u0060Sources/Flux2Core/Training/Optimizer/ResumableLion.swift:66\u0060 calls \u0060MLXArray\u0060, \u0060Int32\u0060 and \u0060Sources/Flux2Core/Training/Optimizer/ResumableAdamW.swift:65\u0060 does not \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Optimizer/ResumableAdamW.swift"},"region":{"startLine":47}}}],"partialFingerprints":{"codehealthFindingId/v1":"672ac0525b06024d46b11d878e7b20c446b7a20f4bebf4d664dce24fbc81d2ad"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (17 lines \u00D7 2): Sources/Flux2Core/Transformer/Flux2Transformer.swift:399-415 | Sources/Flux2Core/Transformer/Flux2Transformer.swift:504-520 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2Core/Transformer/Flux2Transformer.swift:399\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that. \u2605 These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, \u0060Sources/Flux2Core/Transformer/Flux2Transformer.swift:396\u0060 calls \u0060setDoubleStream\u0060 and \u0060Sources/Flux2Core/Transformer/Flux2Transformer.swift:502\u0060 does not \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Transformer/Flux2Transformer.swift"},"region":{"startLine":399}}}],"partialFingerprints":{"codehealthFindingId/v1":"eec6b3755ec9bff34ec955b4e1a1ebce1301d2c0112b200a67fc52429e203747"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (16\u201317 lines \u00D7 2): Sources/FluxTextEncoders/Generation/MistralGenerator.swift:346-362 | Sources/FluxTextEncoders/Generation/Qwen3Generator.swift:275-290 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Generation/MistralGenerator.swift\u0060 and \u0060Sources/FluxTextEncoders/Generation/Qwen3Generator.swift\u0060 as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 158 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 \u2014 extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/FluxTextEncoders/Generation/MistralGenerator.swift:346\u0060 it runs out through the closing brace of the declaration holding it \u2014 the window is that declaration\u0027s tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Generation/MistralGenerator.swift"},"region":{"startLine":346}}}],"partialFingerprints":{"codehealthFindingId/v1":"ff8e3898a02aafbd48551b16d4f0f2d095bd1b43cca4e47140793020b87ebb1e"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (17 lines \u00D7 2): Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:388-404 | Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:441-457 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:388\u0060 it runs out through the closing brace of the declaration holding it \u2014 the window is that declaration\u0027s tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift"},"region":{"startLine":388}}}],"partialFingerprints":{"codehealthFindingId/v1":"4a8cc72f32f9358e87b2ed5d038ea8662b12eec3ba5f6c2da80a7d3ddde59e5e"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (13\u201317 lines \u00D7 2): Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift:400-416 | Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLModel.swift:381-393 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift\u0060 and \u0060Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLModel.swift\u0060 as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 195 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 \u0060Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift:400\u0060 it runs out through the closing brace of the declaration holding it \u2014 the window is that declaration\u0027s tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift"},"region":{"startLine":400}}}],"partialFingerprints":{"codehealthFindingId/v1":"64e5d94f4105c863c0024c6cdb54bc9244fedf506e6e97adebf2e04f6c802263"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (22 lines \u00D7 3): Sources/Flux2Core/Transformer/Flux2ParallelAttention.swift:80-101 | Sources/Flux2Core/Transformer/Flux2ParallelAttention.swift:149-170 | Sources/Flux2Core/Transformer/Flux2ParallelAttention.swift:222-243 \u2014 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 \u2014 resolving only two of them leaves the rest to drift apart the first time one is edited."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Transformer/Flux2ParallelAttention.swift"},"region":{"startLine":80}}}],"partialFingerprints":{"codehealthFindingId/v1":"da2ee88ab513e188dd9e0445ce412cb764d2756184903a86186151fd272636b2"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (10\u201316 lines \u00D7 3): Sources/Flux2Core/Transformer/Flux2TransformerBlock.swift:89-104 | Sources/Flux2Core/Transformer/Flux2TransformerBlock.swift:182-192 | Sources/Flux2Core/Transformer/Flux2TransformerBlock.swift:262-271 \u2014 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 \u2014 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 \u0060Sources/Flux2Core/Transformer/Flux2TransformerBlock.swift:89\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Transformer/Flux2TransformerBlock.swift"},"region":{"startLine":89}}}],"partialFingerprints":{"codehealthFindingId/v1":"1a52038ba35035ec2f4c6c8643c9180bdce918f5c436e593dc2f874617b00be7"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (15\u201316 lines \u00D7 3): Sources/FluxTextEncoders/Generation/MistralGenerator.swift:404-418 | Sources/FluxTextEncoders/Generation/Qwen3Generator.swift:338-352 | Sources/FluxTextEncoders/Generation/Qwen3VLGenerator.swift:132-147 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Generation/MistralGenerator.swift\u0060 and \u0060Sources/FluxTextEncoders/Generation/Qwen3Generator.swift\u0060 as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 158 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 \u2014 extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/FluxTextEncoders/Generation/MistralGenerator.swift:404\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that. The \u0060return\u0060 at the foot of the matched lines is the enclosing body\u0027s own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that \u0060return\u0060 occupied \u2014 no decision has to be handed back and re-acted on. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names \u2014 the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Generation/MistralGenerator.swift"},"region":{"startLine":404}}}],"partialFingerprints":{"codehealthFindingId/v1":"76ea9f598929a44c019598fe303a437bb6e491a2f843467734c03aed68b1f4a4"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (16 lines \u00D7 3): Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:215-230 | Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:312-327 | Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:474-489 \u2014 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 \u2014 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 \u0060Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:215\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that. \u2605 These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, \u0060Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:214\u0060 calls \u0060ensureTekkenJson\u0060 and \u0060Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:311\u0060 does not \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift"},"region":{"startLine":215}}}],"partialFingerprints":{"codehealthFindingId/v1":"1e30133e5aa7da802b9117841935c7f8c06673800c0abe92c9f5df7dd6e48e42"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (15 lines \u00D7 4): Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:1716-1730 | Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:1841-1855 | Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:1873-1887 | Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:2081-2095 \u2014 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 \u2014 resolving only two of them leaves the rest to drift apart the first time one is edited."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/Flux2Pipeline.swift"},"region":{"startLine":1716}}}],"partialFingerprints":{"codehealthFindingId/v1":"c5c25a68836246f99573b1602ad69c86c2b801a21b4ee8e83ebd7068e4d53c54"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (15 lines \u00D7 3): Sources/Flux2CLI/InpaintCommand.swift:281-295 | Sources/Flux2CLI/MaskSubjectCommand.swift:72-86 | Sources/Flux2CLI/OutpaintCommand.swift:143-157 \u2014 before extracting anything, compare \u0060Sources/Flux2CLI/InpaintCommand.swift\u0060 and \u0060Sources/Flux2CLI/OutpaintCommand.swift\u0060 as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 31 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together \u2014 extracting one helper per block leaves the fork in place."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/InpaintCommand.swift"},"region":{"startLine":281}}}],"partialFingerprints":{"codehealthFindingId/v1":"66f3cf0908b63c216fa924d2446352909b20c8ea9c307433dc4d4090ae633e6f"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (15 lines \u00D7 2): Sources/Flux2App/Views/ContentView.swift:1994-2008 | Sources/Flux2App/Views/ContentView.swift:2095-2109 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2App/Views/ContentView.swift:1994\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ContentView.swift"},"region":{"startLine":1994}}}],"partialFingerprints":{"codehealthFindingId/v1":"f7247e22a6f14281985cdf896240160a54ad5ee5db8bbef492d1515620e01088"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (14\u201315 lines \u00D7 2): Sources/Flux2App/Views/ImageToImageView.swift:411-424 | Sources/Flux2App/Views/TextToImageView.swift:346-360 \u2014 before extracting anything, compare \u0060Sources/Flux2App/Views/ImageToImageView.swift\u0060 and \u0060Sources/Flux2App/Views/TextToImageView.swift\u0060 as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 270 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 \u2014 extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2App/Views/ImageToImageView.swift:411\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ImageToImageView.swift"},"region":{"startLine":411}}}],"partialFingerprints":{"codehealthFindingId/v1":"0940bb71fa95e5a58e484fd42f55f57189eac2373fc93f4941f4af2fb4047085"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (15 lines \u00D7 2): Sources/Flux2CLI/ProfileCommand.swift:99-113 | Sources/Flux2CLI/ProfileCommand.swift:202-216 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2CLI/ProfileCommand.swift:99\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/ProfileCommand.swift"},"region":{"startLine":99}}}],"partialFingerprints":{"codehealthFindingId/v1":"947e609f258237a3704eb11b0c5b94164cbb83cfe7e6c033b45a783efff95a59"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (15 lines \u00D7 2): Sources/Flux2CLI/TrainLoRACommand.swift:970-984 | Sources/Flux2CLI/TrainingConfigYAML.swift:622-636 \u2014 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 \u2014 a file they already depend on, or a new one alongside them \u2014 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 \u0060return\u0060 inside it is the body\u0027s own exit and keeps its meaning in the moved unit."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/TrainLoRACommand.swift"},"region":{"startLine":970}}}],"partialFingerprints":{"codehealthFindingId/v1":"7e05424086726517a43d47e1ccdc256fb21aa68db51430309bee7e2e55da8be0"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (15 lines \u00D7 2): Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:987-1001 | Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:1103-1117 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:987\u0060 it runs out through the closing brace of the declaration holding it \u2014 the window is that declaration\u0027s tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/Flux2Pipeline.swift"},"region":{"startLine":987}}}],"partialFingerprints":{"codehealthFindingId/v1":"26928632cd4f26238a7e2127c85cb997d497f848bac4ed9ba38be94a72921bc9"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (14\u201315 lines \u00D7 2): Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:1319-1333 | Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:1355-1368 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/Flux2Pipeline.swift"},"region":{"startLine":1319}}}],"partialFingerprints":{"codehealthFindingId/v1":"7b8440c4be5844d0b6f748ca12ddba960a0a0e04275377b9469262752906403c"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (15 lines \u00D7 2): Sources/FluxEncodersCLI/FluxEncodersCLI.swift:92-106 | Sources/FluxEncodersCLI/FluxEncodersCLI.swift:156-170 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/FluxEncodersCLI/FluxEncodersCLI.swift:92\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxEncodersCLI/FluxEncodersCLI.swift"},"region":{"startLine":92}}}],"partialFingerprints":{"codehealthFindingId/v1":"9e172f33683da4b823cf5223cf3edc438e455ba335bc55be37f2910419722bb8"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (15 lines \u00D7 2): Sources/FluxTextEncoders/Generation/MistralGenerator.swift:197-211 | Sources/FluxTextEncoders/Generation/MistralGenerator.swift:329-343 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/FluxTextEncoders/Generation/MistralGenerator.swift:197\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Generation/MistralGenerator.swift"},"region":{"startLine":197}}}],"partialFingerprints":{"codehealthFindingId/v1":"e9def74472fde377529d1b655ec0518e28e103b5e2d9f883019d7f33ee226f3c"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (14\u201315 lines \u00D7 2): Sources/FluxTextEncoders/Model/Qwen3/Qwen3Attention.swift:103-117 | Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLAttention.swift:74-87 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Model/Qwen3/Qwen3Attention.swift\u0060 and \u0060Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLAttention.swift\u0060 as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 77 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/Qwen3/Qwen3Attention.swift"},"region":{"startLine":103}}}],"partialFingerprints":{"codehealthFindingId/v1":"1140fd74984cbef766c96c8864d00e84d0b03c95ee1724836c9360645fbc2ef7"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (15 lines \u00D7 2): Sources/FluxTextEncoders/Model/Qwen35/Qwen35Model.swift:254-268 | Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLModel.swift:342-356 \u2014 the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach \u2014 a location they all depend on today, or a new shared one if there is none \u2014 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 \u0060Sources/FluxTextEncoders/Model/Qwen35/Qwen35Model.swift:254\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/Qwen35/Qwen35Model.swift"},"region":{"startLine":254}}}],"partialFingerprints":{"codehealthFindingId/v1":"6fa26a2704a7753f86b598750593603caba909b0b399bc52659cd04d13637d40"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (14 lines \u00D7 3): Sources/FluxTextEncoders/Configuration/EncoderConfiguration.swift:126-139 | Sources/FluxTextEncoders/Configuration/Qwen3Configuration.swift:125-138 | Sources/FluxTextEncoders/Configuration/Qwen3VLConfiguration.swift:147-160 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Configuration/EncoderConfiguration.swift\u0060 and \u0060Sources/FluxTextEncoders/Configuration/Qwen3Configuration.swift\u0060 as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 32 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 \u2014 extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/FluxTextEncoders/Configuration/EncoderConfiguration.swift:126\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Configuration/EncoderConfiguration.swift"},"region":{"startLine":126}}}],"partialFingerprints":{"codehealthFindingId/v1":"1783956be4b38dfc461cfcf2753cb78901eba367d624580a392087185473bb34"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (14 lines \u00D7 3): Sources/FluxTextEncoders/Model/MistralAttention.swift:397-410 | Sources/FluxTextEncoders/Model/Qwen3/Qwen3Attention.swift:95-108 | Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLAttention.swift:66-79 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Model/MistralAttention.swift\u0060 and \u0060Sources/FluxTextEncoders/Model/Qwen3/Qwen3Attention.swift\u0060 as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 85 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/FluxTextEncoders/Model/MistralAttention.swift:397\u0060 it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows \u2014 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\u0027 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 \u2014 a one-line delegation has no helper inside it to lift \u2014 so generate the run from the set it enumerates, or accept it and keep each member\u0027s own documentation with it. \u2605 These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, \u0060Sources/FluxTextEncoders/Model/Qwen3/Qwen3Attention.swift:112\u0060 calls \u0060q_norm\u0060, \u0060k_norm\u0060 and \u0060Sources/FluxTextEncoders/Model/MistralAttention.swift:413\u0060 does not \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/MistralAttention.swift"},"region":{"startLine":397}}}],"partialFingerprints":{"codehealthFindingId/v1":"f64b599e8bbd70c10e57da337302a4dbb01921b13f4102dca3901081c1587386"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (12\u201314 lines \u00D7 2): Sources/Flux2Core/Training/Data/LatentCache.swift:447-458 | Sources/Flux2Core/Training/LoRATrainingHelper.swift:332-345 \u2014 the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach \u2014 a location they all depend on today, or a new shared one if there is none \u2014 and call it from each site; until then, every change has to be made twice. The \u0060return\u0060 at the foot of the matched lines is the enclosing body\u0027s own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that \u0060return\u0060 occupied \u2014 no decision has to be handed back and re-acted on."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Data/LatentCache.swift"},"region":{"startLine":447}}}],"partialFingerprints":{"codehealthFindingId/v1":"4aaf4c9afa3ed3c1c6f43905fb9f676fd82e8f04bd2d9c6e690f29cf54356cf8"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (13\u201314 lines \u00D7 2): Sources/Flux2Core/Transformer/Flux2Attention.swift:424-437 | Sources/Flux2Core/Transformer/Flux2ParallelAttention.swift:274-286 \u2014 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 \u2014 a file they already depend on, or a new one alongside them \u2014 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 \u0060Sources/Flux2Core/Transformer/Flux2ParallelAttention.swift:274\u0060 it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows \u2014 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\u0027 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 \u2014 a one-line delegation has no helper inside it to lift \u2014 so generate the run from the set it enumerates, or accept it and keep each member\u0027s own documentation with it. The \u0060return\u0060 at the foot of the matched lines is the enclosing body\u0027s own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that \u0060return\u0060 occupied \u2014 no decision has to be handed back and re-acted on."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Transformer/Flux2Attention.swift"},"region":{"startLine":424}}}],"partialFingerprints":{"codehealthFindingId/v1":"b4fa03f73e6c06e2f8fe9f1b646044a7ca81b9c4429423dbd05f40af461d4974"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (14 lines \u00D7 2): Sources/FluxTextEncoders/Embeddings/KleinEmbeddingExtractor.swift:118-134 | Sources/FluxTextEncoders/Embeddings/KleinVLEmbeddingExtractor.swift:100-113 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Embeddings/KleinEmbeddingExtractor.swift\u0060 and \u0060Sources/FluxTextEncoders/Embeddings/KleinVLEmbeddingExtractor.swift\u0060 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. 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 \u2014 extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/FluxTextEncoders/Embeddings/KleinEmbeddingExtractor.swift:118\u0060 it runs out through the closing brace of the declaration holding it \u2014 the window is that declaration\u0027s tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Embeddings/KleinEmbeddingExtractor.swift"},"region":{"startLine":118}}}],"partialFingerprints":{"codehealthFindingId/v1":"1056faa1412e339c197f0b3c6c32e096b828a8cccfd3ba349fc0b0ef50263f6f"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (14 lines \u00D7 2): Sources/FluxTextEncoders/Generation/Qwen3Generator.swift:134-147 | Sources/FluxTextEncoders/Generation/Qwen3Generator.swift:259-272 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/FluxTextEncoders/Generation/Qwen3Generator.swift:134\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Generation/Qwen3Generator.swift"},"region":{"startLine":134}}}],"partialFingerprints":{"codehealthFindingId/v1":"76a2f7a5fcb883715a084eca4a7980d84cc05e95606115cd3726bf973e0d4e3b"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (12\u201313 lines \u00D7 4): Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1809-1820 | Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1839-1850 | Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1930-1942 | Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1961-1973 \u2014 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 \u2014 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 \u0060Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1809\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":1809}}}],"partialFingerprints":{"codehealthFindingId/v1":"81b0c6f58166b4dafc9d498a039db635fb2cac371c526cda7bb4a2d88b19fd67"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (12\u201313 lines \u00D7 4): Sources/FluxTextEncoders/Model/MistralModel.swift:286-298 | Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift:342-354 | Sources/FluxTextEncoders/Model/Qwen35/Qwen35Model.swift:225-236 | Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLModel.swift:306-317 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Model/MistralModel.swift\u0060 and \u0060Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift\u0060 as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 169 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/MistralModel.swift"},"region":{"startLine":286}}}],"partialFingerprints":{"codehealthFindingId/v1":"affe6fbb1c8b760853d3da1afb12dc49f3e8ddd859078b73653e2e4cf9ce041f"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (13 lines \u00D7 2): Sources/Flux2App/Views/ContentView.swift:2052-2064 | Sources/Flux2App/Views/ContentView.swift:2160-2172 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2App/Views/ContentView.swift:2052\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ContentView.swift"},"region":{"startLine":2052}}}],"partialFingerprints":{"codehealthFindingId/v1":"3f1e4241264522159551d89fc54758f93df0ce280b4c2c073c0239e215242b21"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (12\u201313 lines \u00D7 2): Sources/Flux2Core/Loading/WeightLoader.swift:235-247 | Sources/Flux2Core/Loading/WeightLoader.swift:278-289 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2Core/Loading/WeightLoader.swift:235\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Loading/WeightLoader.swift"},"region":{"startLine":235}}}],"partialFingerprints":{"codehealthFindingId/v1":"e6c3edc515c9e023c587b004a681764225f2cc1bb096f5d050635b1c1824ba21"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (12\u201313 lines \u00D7 2): Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1276-1288 | Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1325-1336 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1276\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":1276}}}],"partialFingerprints":{"codehealthFindingId/v1":"917e7b1ee28908f4d13a2c1129bfc74fc6388f086cde90ce078ed42e74be4d51"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (13 lines \u00D7 2): Sources/FluxTextEncoders/Configuration/Qwen3Configuration.swift:111-123 | Sources/FluxTextEncoders/Configuration/Qwen3VLConfiguration.swift:132-144 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Configuration/Qwen3Configuration.swift\u0060 and \u0060Sources/FluxTextEncoders/Configuration/Qwen3VLConfiguration.swift\u0060 as WHOLE FILES: this scan already matched 4 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. 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 \u2014 extracting one helper per block leaves the fork in place."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Configuration/Qwen3Configuration.swift"},"region":{"startLine":111}}}],"partialFingerprints":{"codehealthFindingId/v1":"56df94546e41739ce045ec8e2f336b98b17ce15e02d0cf9f9a1efc1415a892eb"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (12\u201313 lines \u00D7 2): Sources/FluxTextEncoders/Generation/MistralGenerator.swift:426-438 | Sources/FluxTextEncoders/Generation/Qwen3Generator.swift:415-426 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Generation/MistralGenerator.swift\u0060 and \u0060Sources/FluxTextEncoders/Generation/Qwen3Generator.swift\u0060 as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 158 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 \u2014 extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/FluxTextEncoders/Generation/MistralGenerator.swift:426\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Generation/MistralGenerator.swift"},"region":{"startLine":426}}}],"partialFingerprints":{"codehealthFindingId/v1":"98fc6b26bbe335784c69be65c6a5e299d6c462c8d2668564271109cfe56afa94"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (13 lines \u00D7 2): Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:232-244 | Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:329-341 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:232\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that. \u2605 These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, \u0060Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:247\u0060 calls \u0060ensureTekkenJson\u0060 and \u0060Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:343\u0060 does not \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift"},"region":{"startLine":232}}}],"partialFingerprints":{"codehealthFindingId/v1":"a94f1c03ac91aeaa348eb890ff15b9d620cccfb5e71fbc3b4e2fe1b2ba6524b3"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (11\u201313 lines \u00D7 2): Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:414-426 | Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:557-567 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:414\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift"},"region":{"startLine":414}}}],"partialFingerprints":{"codehealthFindingId/v1":"c10e1574b2c6cedcc4a5836fe6342f8b5602d9718c9216cb80eef9ca9ec00ffe"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (13 lines \u00D7 2): Sources/FluxTextEncoders/Model/MistralModel.swift:325-337 | Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift:388-400 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Model/MistralModel.swift\u0060 and \u0060Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift\u0060 as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 169 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 \u0060Sources/FluxTextEncoders/Model/MistralModel.swift:325\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/MistralModel.swift"},"region":{"startLine":325}}}],"partialFingerprints":{"codehealthFindingId/v1":"486c9087fa8edd520af4816eadd5edeeb408d306d26d91017e95754326944bb3"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (12 lines \u00D7 4): Sources/Flux2Core/Transformer/Flux2Attention.swift:445-456 | Sources/Flux2Core/Transformer/Flux2ParallelAttention.swift:321-332 | Sources/Flux2Core/Transformer/Flux2ParallelAttention.swift:446-457 | Sources/Flux2Core/Transformer/Flux2RoPE.swift:220-231 \u2014 there are 4 copies across 3 file(s) \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Transformer/Flux2Attention.swift"},"region":{"startLine":445}}}],"partialFingerprints":{"codehealthFindingId/v1":"589c45b996536c4c431c5917cf9493bafe6900484f39049940433b6e7b1fcb3c"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (12 lines \u00D7 3): Sources/FluxTextEncoders/Model/MistralModel.swift:111-127 | Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift:70-84 | Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLModel.swift:80-91 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Model/MistralModel.swift\u0060 and \u0060Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift\u0060 as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 169 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 \u0060Sources/FluxTextEncoders/Model/MistralModel.swift:111\u0060 it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows \u2014 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\u0027 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 \u2014 a one-line delegation has no helper inside it to lift \u2014 so generate the run from the set it enumerates, or accept it and keep each member\u0027s own documentation with it."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/MistralModel.swift"},"region":{"startLine":111}}}],"partialFingerprints":{"codehealthFindingId/v1":"bb960601cc19c1668540281acd3fab3fd0473c3195fb0cf280dcc65265ca2097"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (12 lines \u00D7 2): Sources/Flux2App/Views/ContentView.swift:2355-2366 | Sources/Flux2App/Views/ContentView.swift:2418-2429 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2App/Views/ContentView.swift:2355\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ContentView.swift"},"region":{"startLine":2355}}}],"partialFingerprints":{"codehealthFindingId/v1":"dfbbdd04fad0433afd511db744ac9b3891486dd29c0c3a1d4989ad8072481e6b"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (12 lines \u00D7 2): Sources/Flux2App/Views/ContentView.swift:2352-2363 | Sources/Flux2App/Views/TextToImageView.swift:126-137 \u2014 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 \u2014 a file they already depend on, or a new one alongside them \u2014 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 \u0060Sources/Flux2App/Views/ContentView.swift:2352\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ContentView.swift"},"region":{"startLine":2352}}}],"partialFingerprints":{"codehealthFindingId/v1":"23b32ab2147e4fa69afd9bbab339f7159d5d21353addd9e493b325123f4811ac"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (12 lines \u00D7 2): Sources/Flux2CLI/TrainLoRACommand.swift:440-451 | Sources/Flux2CLI/TrainLoRACommand.swift:525-536 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2CLI/TrainLoRACommand.swift:440\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/TrainLoRACommand.swift"},"region":{"startLine":440}}}],"partialFingerprints":{"codehealthFindingId/v1":"f2290037179db99d3bafe9ddb554838b519e32ba8a0575e270de6534d2f6a0f2"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (12 lines \u00D7 2): Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:1162-1173 | Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:1216-1227 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/Flux2Pipeline.swift"},"region":{"startLine":1162}}}],"partialFingerprints":{"codehealthFindingId/v1":"0899ec7a339aba3024a9e8a36cf3f59477b0e882964b0ad86ade4016f27e731f"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (12 lines \u00D7 2): Sources/Flux2Core/Pipeline/LatentUtils.swift:153-164 | Sources/Flux2Core/Pipeline/LatentUtils.swift:187-198 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2Core/Pipeline/LatentUtils.swift:153\u0060 it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows \u2014 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\u0027 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 \u2014 a one-line delegation has no helper inside it to lift \u2014 so generate the run from the set it enumerates, or accept it and keep each member\u0027s own documentation with it."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/LatentUtils.swift"},"region":{"startLine":153}}}],"partialFingerprints":{"codehealthFindingId/v1":"d52d94acd834d452e132899e2732f038fccce2519882f7e00435f81b04eefb8e"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (19\u201320 lines \u00D7 2): Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:2235-2253 | Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:2261-2280 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:2235\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 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 \u2014 the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. \u2605 These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, \u0060Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:2255\u0060 calls \u0060log\u0060 and \u0060Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:2280\u0060 does not \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":2235}}}],"partialFingerprints":{"codehealthFindingId/v1":"a40eb4ef9ec6ad76ea5883ab322ffc57a06330f37a4605a4cfd94f44b519fda5"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (10\u201312 lines \u00D7 2): Sources/FluxTextEncoders/Model/MistralAttention.swift:375-384 | Sources/FluxTextEncoders/Model/Qwen3/Qwen3Attention.swift:65-76 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Model/MistralAttention.swift\u0060 and \u0060Sources/FluxTextEncoders/Model/Qwen3/Qwen3Attention.swift\u0060 as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 85 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Note first that the copies are not typed on the same thing: the declarations holding them bind \u0060config\u0060 to \u0060MistralTextConfig\u0060 in one and \u0060Qwen3TextConfig\u0060 in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH \u2014 their common supertype where they have one, or a new abstraction over them where they do not \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/MistralAttention.swift"},"region":{"startLine":375}}}],"partialFingerprints":{"codehealthFindingId/v1":"2070767e9fd724f412e9be834d4939ec4a0976e0871469dc40601ad8d26d38bb"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (10\u201312 lines \u00D7 2): Sources/FluxTextEncoders/Model/Qwen35/Qwen35Model.swift:242-251 | Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLModel.swift:323-334 \u2014 the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach \u2014 a location they all depend on today, or a new shared one if there is none \u2014 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 \u0060Sources/FluxTextEncoders/Model/Qwen35/Qwen35Model.swift:242\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/Qwen35/Qwen35Model.swift"},"region":{"startLine":242}}}],"partialFingerprints":{"codehealthFindingId/v1":"ba16ff8c2c3f03f089c8ef41291a8e2895f0de3dcad67418b0149c4492e582f5"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (11 lines \u00D7 4): Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:966-976 | Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:1009-1019 | Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:1082-1092 | Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:1125-1135 \u2014 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 \u2014 resolving only two of them leaves the rest to drift apart the first time one is edited."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/Flux2Pipeline.swift"},"region":{"startLine":966}}}],"partialFingerprints":{"codehealthFindingId/v1":"d5c76f7c5ba4f12e9e5eafa2e4d582af6a358e7fa75cd5361a6fa6834fc1e627"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (11 lines \u00D7 3): Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:93-103 | Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:385-395 | Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:438-448 \u2014 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 \u2014 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 \u0060Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:93\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that. \u2605 These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, \u0060Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:397\u0060 calls \u0060verifyShardedModel\u0060 and \u0060Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:104\u0060 does not \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift"},"region":{"startLine":93}}}],"partialFingerprints":{"codehealthFindingId/v1":"6dc15883107d5c731b51e792dce6455fd25449c2c965ccde46bc81fbf6234eef"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (11 lines \u00D7 3): Sources/FluxTextEncoders/Model/MistralModel.swift:127-137 | Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift:84-94 | Sources/FluxTextEncoders/Vision/MistralVLM.swift:412-422 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Model/MistralModel.swift\u0060 and \u0060Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift\u0060 as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 169 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 \u0060Sources/FluxTextEncoders/Model/MistralModel.swift:127\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/MistralModel.swift"},"region":{"startLine":127}}}],"partialFingerprints":{"codehealthFindingId/v1":"385d0c0e31566dbe915cffc5cd2846b0a9351c06db30fc1d50fd9a379229bae9"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (7\u201311 lines \u00D7 3): Sources/FluxTextEncoders/Model/Qwen3/Qwen3Attention.swift:108-118 | Sources/FluxTextEncoders/Model/Qwen35/Qwen35Attention.swift:93-99 | Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLAttention.swift:79-88 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Model/Qwen3/Qwen3Attention.swift\u0060 and \u0060Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLAttention.swift\u0060 as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 77 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/Qwen3/Qwen3Attention.swift"},"region":{"startLine":108}}}],"partialFingerprints":{"codehealthFindingId/v1":"387b3ea83b41e2601d23aedb2b62b0d87adfaea25820d84ee6d39ce7743096b8"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (11 lines \u00D7 2): Sources/Flux2App/Views/ContentView.swift:2415-2425 | Sources/Flux2App/Views/TextToImageView.swift:148-158 \u2014 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 \u2014 a file they already depend on, or a new one alongside them \u2014 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 \u0060Sources/Flux2App/Views/ContentView.swift:2415\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ContentView.swift"},"region":{"startLine":2415}}}],"partialFingerprints":{"codehealthFindingId/v1":"f882f515cf124ce7c8c8fcdd6a67d1db83163dd57bab426b3638b1b148ca59a5"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (11 lines \u00D7 2): Sources/Flux2CLI/InpaintCommand.swift:139-149 | Sources/Flux2CLI/OutpaintCommand.swift:75-85 \u2014 before extracting anything, compare \u0060Sources/Flux2CLI/InpaintCommand.swift\u0060 and \u0060Sources/Flux2CLI/OutpaintCommand.swift\u0060 as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 31 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together \u2014 extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2CLI/InpaintCommand.swift:139\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that. \u2605 These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, \u0060Sources/Flux2CLI/InpaintCommand.swift:150\u0060 calls \u0060loadCGImage\u0060, \u0060ValidationError\u0060 and \u0060Sources/Flux2CLI/OutpaintCommand.swift:86\u0060 does not \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/InpaintCommand.swift"},"region":{"startLine":139}}}],"partialFingerprints":{"codehealthFindingId/v1":"d782b91165c71194c1ef99c0b49b37a7d0c80e946952ed796dc543adb24e3c92"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (10\u201311 lines \u00D7 2): Sources/Flux2Chains/Flux2MaskedInpaintingChain.swift:488-497 | Sources/Flux2Chains/Flux2OutpaintingChain.swift:283-293 \u2014 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 \u2014 a file they already depend on, or a new one alongside them \u2014 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 \u0060Sources/Flux2Chains/Flux2OutpaintingChain.swift:283\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Chains/Flux2MaskedInpaintingChain.swift"},"region":{"startLine":488}}}],"partialFingerprints":{"codehealthFindingId/v1":"4b915ac754ddafaa964132dc5e149a115abb6f4c068acbadb708d0b710786b61"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (2\u201311 lines \u00D7 3): Sources/Flux2Core/LoRA/LoRALoader.swift:259-267 | Sources/Flux2Core/Loading/WeightLoader.swift:404-414 | Sources/Flux2Core/Loading/WeightLoader.swift:508-509 \u2014 there are 3 copies across 2 file(s) \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/LoRA/LoRALoader.swift"},"region":{"startLine":259}}}],"partialFingerprints":{"codehealthFindingId/v1":"5f229cf3e94d941c22a82f90a93e4eb2c2e8c9f98fae975387282613207c9ab8"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (11 lines \u00D7 2): Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1439-1450 | Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1495-1505 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1439\u0060 it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows \u2014 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\u0027 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 \u2014 a one-line delegation has no helper inside it to lift \u2014 so generate the run from the set it enumerates, or accept it and keep each member\u0027s own documentation with it."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":1439}}}],"partialFingerprints":{"codehealthFindingId/v1":"f733769dbc4f703fdfb2ec44db476890ba68a059fd9ca5d681cf1e88c8a292b7"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (9\u201311 lines \u00D7 2): Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:2551-2561 | scripts/fix_learning_curve.swift:239-247 \u2014 the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach \u2014 a location they all depend on today, or a new shared one if there is none \u2014 and call it from each site; until then, every change has to be made twice."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":2551}}}],"partialFingerprints":{"codehealthFindingId/v1":"bcfc331f3f3d0ae7d1b869785245c3a8588bbd36fbbafb8086d1f2fece94e368"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (11 lines \u00D7 2): Sources/Flux2Core/Transformer/Flux2Attention.swift:394-404 | Sources/Flux2Core/Transformer/Flux2ParallelAttention.swift:252-262 \u2014 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 \u2014 a file they already depend on, or a new one alongside them \u2014 and call it from both call sites, so a change lands once."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Transformer/Flux2Attention.swift"},"region":{"startLine":394}}}],"partialFingerprints":{"codehealthFindingId/v1":"be2ceae1bcc733fa98dbfe4ed53d579c4477dbaceef3fdc751e93a0eacdda475"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (11 lines \u00D7 2): Sources/FluxEncodersCLI/FluxEncodersCLI.swift:352-362 | Sources/FluxEncodersCLI/FluxEncodersCLI.swift:405-415 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/FluxEncodersCLI/FluxEncodersCLI.swift:352\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that. The \u0060return\u0060 at the foot of the matched lines is the enclosing body\u0027s own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that \u0060return\u0060 occupied \u2014 no decision has to be handed back and re-acted on."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxEncodersCLI/FluxEncodersCLI.swift"},"region":{"startLine":352}}}],"partialFingerprints":{"codehealthFindingId/v1":"23d700cac90ce7196993528789003899a4bc2f4c2aa79cc5b9f98216ec974652"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (10 lines \u00D7 3): Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1245-1254 | Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1270-1279 | Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1319-1328 \u2014 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 \u2014 resolving only two of them leaves the rest to drift apart the first time one is edited."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":1245}}}],"partialFingerprints":{"codehealthFindingId/v1":"ffa30ff14892f1fa29fc927a4a737d5a5f86f3e965846f157a6ca1a232df33e8"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (10 lines \u00D7 3): Sources/FluxTextEncoders/Configuration/EncoderConfiguration.swift:107-116 | Sources/FluxTextEncoders/Configuration/Qwen3Configuration.swift:110-119 | Sources/FluxTextEncoders/Configuration/Qwen3VLConfiguration.swift:131-140 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Configuration/EncoderConfiguration.swift\u0060 and \u0060Sources/FluxTextEncoders/Configuration/Qwen3Configuration.swift\u0060 as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 32 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 \u2014 extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/FluxTextEncoders/Configuration/EncoderConfiguration.swift:107\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Configuration/EncoderConfiguration.swift"},"region":{"startLine":107}}}],"partialFingerprints":{"codehealthFindingId/v1":"b305e83d266959991b7448720ae5227e68cf344ba96d4f3a700b0a21a8ceebf9"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (10 lines \u00D7 3): Sources/FluxTextEncoders/FluxTextEncoders.swift:430-439 | Sources/FluxTextEncoders/FluxTextEncoders.swift:469-478 | Sources/FluxTextEncoders/FluxTextEncoders.swift:496-505 \u2014 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 \u2014 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 \u0060Sources/FluxTextEncoders/FluxTextEncoders.swift:430\u0060 it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows \u2014 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\u0027 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 \u2014 a one-line delegation has no helper inside it to lift \u2014 so generate the run from the set it enumerates, or accept it and keep each member\u0027s own documentation with it."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/FluxTextEncoders.swift"},"region":{"startLine":430}}}],"partialFingerprints":{"codehealthFindingId/v1":"10c476025067d7c8adc87b6d251a1023d953a01877fd3afb8be6183e56954f79"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (10 lines \u00D7 2): Sources/Flux2App/Views/ContentView.swift:214-223 | Sources/Flux2App/Views/ContentView.swift:301-310 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2App/Views/ContentView.swift:214\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ContentView.swift"},"region":{"startLine":214}}}],"partialFingerprints":{"codehealthFindingId/v1":"fba49d579152510f5a58555f8193eb538532b39cbffbbf9ca4360fdb8560ab1d"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (10 lines \u00D7 2): Sources/Flux2Core/Loading/WeightLoader.swift:825-834 | Sources/Flux2Core/Loading/WeightLoader.swift:851-860 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Loading/WeightLoader.swift"},"region":{"startLine":825}}}],"partialFingerprints":{"codehealthFindingId/v1":"7e156fa7c081ae639cae96efba980a1e888632ddea32ee3bdc0a5a32d8b57406"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (7\u201310 lines \u00D7 2): Sources/Flux2Core/Training/Data/LatentCache.swift:308-314 | Sources/Flux2Core/Training/Data/LatentCache.swift:414-423 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Data/LatentCache.swift"},"region":{"startLine":308}}}],"partialFingerprints":{"codehealthFindingId/v1":"5f03226f3809e1c5c1e5e8811165832e7bb4ae312f5959aa3cf974dc6688396f"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (10 lines \u00D7 2): Sources/Flux2Core/Transformer/Flux2ParallelAttention.swift:75-84 | Sources/Flux2Core/Transformer/Flux2ParallelAttention.swift:217-226 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2Core/Transformer/Flux2ParallelAttention.swift:75\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Transformer/Flux2ParallelAttention.swift"},"region":{"startLine":75}}}],"partialFingerprints":{"codehealthFindingId/v1":"c38183a6ed39ba5d5258cb1fd2f6a7e66bb8a11d106e14ea8e52c70474b62ac7"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (10\u201311 lines \u00D7 2): Sources/FluxTextEncoders/Embeddings/EmbeddingExtractor.swift:207-217 | Sources/FluxTextEncoders/Embeddings/EmbeddingExtractor.swift:285-294 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. \u2605 These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, \u0060Sources/FluxTextEncoders/Embeddings/EmbeddingExtractor.swift:219\u0060 calls \u0060log\u0060 and \u0060Sources/FluxTextEncoders/Embeddings/EmbeddingExtractor.swift:297\u0060 does not \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Embeddings/EmbeddingExtractor.swift"},"region":{"startLine":207}}}],"partialFingerprints":{"codehealthFindingId/v1":"b9e5db22d5bb08d72aac8eb2786026e94a134d0cd90be4b5f37564596eddc431"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (10 lines \u00D7 2): Sources/FluxTextEncoders/Model/MistralModel.swift:152-161 | Sources/FluxTextEncoders/Vision/MistralVLM.swift:534-543 \u2014 the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach \u2014 a location they all depend on today, or a new shared one if there is none \u2014 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 \u0060Sources/FluxTextEncoders/Model/MistralModel.swift:152\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/MistralModel.swift"},"region":{"startLine":152}}}],"partialFingerprints":{"codehealthFindingId/v1":"d7670c66fbbc79cf75ddd73cd30589794e6105c7be7f6732d4183d88b45f2472"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (10 lines \u00D7 2): Sources/FluxTextEncoders/Model/MistralModel.swift:309-318 | Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift:365-374 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Model/MistralModel.swift\u0060 and \u0060Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift\u0060 as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 169 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/MistralModel.swift"},"region":{"startLine":309}}}],"partialFingerprints":{"codehealthFindingId/v1":"e0e870e85972a7693d08752676f0f170c17a672e68be4421771083d985d73d98"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (8\u20139 lines \u00D7 4): Sources/Flux2Core/Loading/WeightLoader.swift:31-39 | Sources/FluxTextEncoders/Loading/TextEncoderWeightLoader.swift:30-37 | Sources/FluxTextEncoders/Model/MistralModel.swift:307-314 | Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift:363-370 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Model/MistralModel.swift\u0060 and \u0060Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift\u0060 as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 169 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 \u0060Sources/Flux2Core/Loading/WeightLoader.swift:31\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Loading/WeightLoader.swift"},"region":{"startLine":31}}}],"partialFingerprints":{"codehealthFindingId/v1":"eda1377627d0519fa9e8877f9b09eac2c3839ddfb1ea35bab6bccde8c94df085"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (9 lines \u00D7 3): Sources/Flux2CLI/Flux2CLI.swift:153-161 | Sources/Flux2CLI/Flux2CLI.swift:512-520 | Sources/Flux2CLI/Flux2CLI.swift:877-885 \u2014 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 \u2014 resolving only two of them leaves the rest to drift apart the first time one is edited."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/Flux2CLI.swift"},"region":{"startLine":153}}}],"partialFingerprints":{"codehealthFindingId/v1":"8934e10e077e00a33a5d8799f61b7b98c6d032cb80b86961893e1f975fe4e00d"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (9 lines \u00D7 3): Sources/FluxTextEncoders/Generation/Qwen3Generator.swift:59-69 | Sources/FluxTextEncoders/Generation/Qwen3Generator.swift:188-197 | Sources/FluxTextEncoders/Generation/Qwen3VLGenerator.swift:48-56 \u2014 there are 3 copies across 2 file(s) \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Generation/Qwen3Generator.swift"},"region":{"startLine":59}}}],"partialFingerprints":{"codehealthFindingId/v1":"cae8aadf6f7679c3f6accd1b27643d906e16c9a23ae00c58b3d26cb1b3eb0add"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (9 lines \u00D7 2): Sources/Flux2App/Views/ContentView.swift:178-186 | Sources/Flux2App/Views/ContentView.swift:373-381 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ContentView.swift"},"region":{"startLine":178}}}],"partialFingerprints":{"codehealthFindingId/v1":"9de58295b84fe7af98b9c8e559dab1a39d83315ff2a80edc70fee9fa5874502e"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (8\u20139 lines \u00D7 2): Sources/Flux2App/Views/ContentView.swift:1873-1881 | Sources/Flux2App/Views/ContentView.swift:2482-2489 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2App/Views/ContentView.swift:2482\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 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 \u2014 the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. \u2605 These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, \u0060Sources/Flux2App/Views/ContentView.swift:2480\u0060 calls \u0060Spacer\u0060 and \u0060Sources/Flux2App/Views/ContentView.swift:1871\u0060 does not \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ContentView.swift"},"region":{"startLine":1873}}}],"partialFingerprints":{"codehealthFindingId/v1":"c16869847b991799392ffe96af69b0de992878fac9da41be675c8744029110c6"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (9 lines \u00D7 2): Sources/Flux2App/Views/ContentView.swift:2283-2291 | Sources/Flux2App/Views/ContentView.swift:2446-2454 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2App/Views/ContentView.swift:2283\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ContentView.swift"},"region":{"startLine":2283}}}],"partialFingerprints":{"codehealthFindingId/v1":"fa17ccf96c48f1bb8d9b2adc363a15d4e36f505094a6ff2f1585930cc654f588"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (9 lines \u00D7 2): Sources/Flux2CLI/CompareEncoders.swift:104-112 | Sources/Flux2CLI/CompareEncoders.swift:134-142 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/CompareEncoders.swift"},"region":{"startLine":104}}}],"partialFingerprints":{"codehealthFindingId/v1":"8200de69305128591bf29e647d4eaba9ded9256512a2287246526480e5675b28"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (9 lines \u00D7 2): Sources/Flux2Core/Pipeline/LatentUtils.swift:461-469 | Sources/Flux2Core/Pipeline/LatentUtils.swift:484-492 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2Core/Pipeline/LatentUtils.swift:461\u0060 it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows \u2014 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\u0027 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 \u2014 a one-line delegation has no helper inside it to lift \u2014 so generate the run from the set it enumerates, or accept it and keep each member\u0027s own documentation with it."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/LatentUtils.swift"},"region":{"startLine":461}}}],"partialFingerprints":{"codehealthFindingId/v1":"a79760656fb34f7fee168bdae5b19f29bb85840d5becb302bc87770cceebcecd"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (9 lines \u00D7 2): Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1406-1414 | Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1467-1475 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1406\u0060 it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows \u2014 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\u0027 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 \u2014 a one-line delegation has no helper inside it to lift \u2014 so generate the run from the set it enumerates, or accept it and keep each member\u0027s own documentation with it. \u2605 These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, \u0060Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1416\u0060 calls \u0060value\u0060 and \u0060Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1476\u0060 does not \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":1406}}}],"partialFingerprints":{"codehealthFindingId/v1":"8475ecbcda915e7239685aa8905b1e14b70537e013951f14dbad33be7f4f66e7"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (8\u20139 lines \u00D7 2): Sources/FluxTextEncoders/Generation/Qwen3VLGenerator.swift:142-150 | Sources/FluxTextEncoders/Model/Qwen35/Qwen35VLM.swift:267-274 \u2014 the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach \u2014 a location they all depend on today, or a new shared one if there is none \u2014 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 \u0060Sources/FluxTextEncoders/Generation/Qwen3VLGenerator.swift:142\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Generation/Qwen3VLGenerator.swift"},"region":{"startLine":142}}}],"partialFingerprints":{"codehealthFindingId/v1":"7161bc6af01014b257fe7689587174ab163d674929d948f201d8f310f6c4cbbd"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (8 lines \u00D7 4): Sources/Flux2Core/Loading/ModelDownloader.swift:177-184 | Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:93-100 | Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:385-392 | Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:438-445 \u2014 there are 4 copies across 2 file(s) \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Loading/ModelDownloader.swift"},"region":{"startLine":177}}}],"partialFingerprints":{"codehealthFindingId/v1":"ccbf18ec106ed823bfc91791b0fd060f9ed3129c9e8fd104ba3b5d600aebe089"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (6\u20138 lines \u00D7 4): Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:364-371 | Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:519-525 | Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:631-636 | Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:644-649 \u2014 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 \u2014 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 \u0060Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:364\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift"},"region":{"startLine":364}}}],"partialFingerprints":{"codehealthFindingId/v1":"d0a9d03fc9af902ed4409fe76a257e1e3417efa1770691f3a9ee76a8efde7243"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (8 lines \u00D7 3): Sources/FluxEncodersCLI/FluxEncodersCLI.swift:100-107 | Sources/FluxEncodersCLI/FluxEncodersCLI.swift:164-171 | Sources/FluxEncodersCLI/FluxEncodersCLI.swift:365-372 \u2014 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 \u2014 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 \u0060Sources/FluxEncodersCLI/FluxEncodersCLI.swift:100\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxEncodersCLI/FluxEncodersCLI.swift"},"region":{"startLine":100}}}],"partialFingerprints":{"codehealthFindingId/v1":"221271544f72c188f52a09ab92c94920b6aa707aab045142384f3df924e2737b"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (8 lines \u00D7 3): Sources/FluxTextEncoders/FluxTextEncoders.swift:1038-1047 | Sources/FluxTextEncoders/Generation/MistralGenerator.swift:401-408 | Sources/FluxTextEncoders/Generation/Qwen3Generator.swift:335-342 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Generation/MistralGenerator.swift\u0060 and \u0060Sources/FluxTextEncoders/Generation/Qwen3Generator.swift\u0060 as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 158 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 \u2014 extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/FluxTextEncoders/FluxTextEncoders.swift:1038\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 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 \u2014 the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/FluxTextEncoders.swift"},"region":{"startLine":1038}}}],"partialFingerprints":{"codehealthFindingId/v1":"4c03047d7752f6703e615f080a85a55b09010fe6bcc13dfb4467da45a1b16570"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (8 lines \u00D7 3): Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:86-93 | Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:378-385 | Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:532-539 \u2014 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 \u2014 resolving only two of them leaves the rest to drift apart the first time one is edited."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift"},"region":{"startLine":86}}}],"partialFingerprints":{"codehealthFindingId/v1":"b6387f250926117cf59d10d4696aadf5958258049c32208953e841f50399b661"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (8 lines \u00D7 3): Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:561-572 | Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:633-640 | Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:646-653 \u2014 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 \u2014 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 \u0060Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:561\u0060 it runs out through the closing brace of the declaration holding it \u2014 the window is that declaration\u0027s tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift"},"region":{"startLine":561}}}],"partialFingerprints":{"codehealthFindingId/v1":"5324b37752c3feed5cf2b0164b1cecddb93c5dc622c565e3052d4909d55765eb"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (9 lines \u00D7 2): Sources/Flux2Core/Training/Configuration/LoRATrainingConfig.swift:407-415 | Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:108-116 \u2014 the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach \u2014 a location they all depend on today, or a new shared one if there is none \u2014 and call it from each site; until then, every change has to be made twice."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Configuration/LoRATrainingConfig.swift"},"region":{"startLine":407}}}],"partialFingerprints":{"codehealthFindingId/v1":"563e60af4cd6d2aae3ba1456f633147e77a2b2869c2a90c7b46862026e0cdc32"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (8 lines \u00D7 2): Sources/FluxTextEncoders/Model/MistralAttention.swift:413-420 | Sources/FluxTextEncoders/Model/Qwen3/Qwen3Attention.swift:116-123 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Model/MistralAttention.swift\u0060 and \u0060Sources/FluxTextEncoders/Model/Qwen3/Qwen3Attention.swift\u0060 as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 85 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. \u2605 These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, \u0060Sources/FluxTextEncoders/Model/Qwen3/Qwen3Attention.swift:112\u0060 calls \u0060q_norm\u0060, \u0060k_norm\u0060 and \u0060Sources/FluxTextEncoders/Model/MistralAttention.swift:410\u0060 does not \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/MistralAttention.swift"},"region":{"startLine":413}}}],"partialFingerprints":{"codehealthFindingId/v1":"9d5b3e003133003e97052eff4f4130bbe58d9b737bd92743873db02f3c904ecc"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (7 lines \u00D7 7): Sources/FluxEncodersCLI/FluxEncodersCLI.swift:106-112 | Sources/FluxEncodersCLI/FluxEncodersCLI.swift:170-176 | Sources/FluxEncodersCLI/FluxEncodersCLI.swift:310-316 | Sources/FluxEncodersCLI/FluxEncodersCLI.swift:371-377 | Sources/FluxEncodersCLI/FluxEncodersCLI.swift:547-553 | Sources/FluxEncodersCLI/FluxEncodersCLI.swift:561-567 | Sources/FluxEncodersCLI/FluxEncodersCLI.swift:691-697 \u2014 all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites \u2014 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 \u0060Sources/FluxEncodersCLI/FluxEncodersCLI.swift:106\u0060 it runs out through the closing brace of the declaration holding it \u2014 the window is that declaration\u0027s tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxEncodersCLI/FluxEncodersCLI.swift"},"region":{"startLine":106}}}],"partialFingerprints":{"codehealthFindingId/v1":"77b199ee6be5871fcaa6e421178e068bc5788bb656066304f53ca3e6977cd455"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (10 lines \u00D7 2): Sources/Flux2App/ViewModels/ModelManager.swift:617-626 | Sources/Flux2App/Views/ContentView.swift:789-798 \u2014 the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach \u2014 a location they all depend on today, or a new shared one if there is none \u2014 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 \u0060return\u0060 inside it is the body\u0027s own exit and keeps its meaning in the moved unit. \u2605 These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, \u0060Sources/Flux2App/Views/ContentView.swift:800\u0060 calls \u0060formatDeltaBytesUI\u0060, \u0060formatBytesUI\u0060 and \u0060Sources/Flux2App/ViewModels/ModelManager.swift:627\u0060 does not \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/ViewModels/ModelManager.swift"},"region":{"startLine":617}}}],"partialFingerprints":{"codehealthFindingId/v1":"e6cd784a59b8f04f7f71890619e9d7c8f8ad16e8552453a60710e0f3d9f7d40f"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (7 lines \u00D7 2): Sources/Flux2Core/Loading/ModelDownloader.swift:365-371 | Sources/Flux2Core/Loading/ModelDownloader.swift:416-422 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2Core/Loading/ModelDownloader.swift:365\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Loading/ModelDownloader.swift"},"region":{"startLine":365}}}],"partialFingerprints":{"codehealthFindingId/v1":"1f6a4e88e73e8f5aaf593009dc628e6fe51749ce09bfc3dae335dd720f1b9499"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (7 lines \u00D7 2): Sources/Flux2Core/Pipeline/LatentUtils.swift:268-274 | Sources/Flux2Core/Transformer/Flux2RoPE.swift:252-258 \u2014 the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach \u2014 a location they all depend on today, or a new shared one if there is none \u2014 and call it from each site; until then, every change has to be made twice."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/LatentUtils.swift"},"region":{"startLine":268}}}],"partialFingerprints":{"codehealthFindingId/v1":"af7a1e460050ab54d9d45b0b1a08db45b60c28282679775312ee32af93f869e9"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (7 lines \u00D7 2): Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:2474-2480 | Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:2485-2491 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:2474\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":2474}}}],"partialFingerprints":{"codehealthFindingId/v1":"f0c2470f2494e1eaca3178d0b01e2a492be6f617a6446a784ac422df362cdfed"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (7 lines \u00D7 2): Sources/Flux2Core/Transformer/Flux2Attention.swift:320-327 | Sources/Flux2Core/Transformer/Flux2Attention.swift:404-410 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2Core/Transformer/Flux2Attention.swift:320\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Transformer/Flux2Attention.swift"},"region":{"startLine":320}}}],"partialFingerprints":{"codehealthFindingId/v1":"481051604fc4f2c75053dc25fcb9029be828778b2d6de156224aa23382aab622"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (7 lines \u00D7 2): Sources/FluxTextEncoders/Loading/SafetensorsDirectory.swift:75-81 | Sources/FluxTextEncoders/Loading/SafetensorsDirectory.swift:136-142 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Loading/SafetensorsDirectory.swift"},"region":{"startLine":75}}}],"partialFingerprints":{"codehealthFindingId/v1":"379c3cd0fe9b88123a6c4677012106d1b5b3ed8b68dd5dc4a1a82fc6ae856c78"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (3\u20137 lines \u00D7 3): Sources/FluxTextEncoders/Model/Qwen3/Qwen3MLP.swift:28-36 | Sources/FluxTextEncoders/Model/Qwen35/Qwen35MLP.swift:20-22 | Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLMLP.swift:27-33 \u2014 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 \u2014 a location they all depend on today, or a new shared one if there is none \u2014 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 \u0060config\u0060 to \u0060Qwen3TextConfig\u0060 in one and \u0060Qwen3VLTextConfig\u0060 in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH \u2014 their common supertype where they have one, or a new abstraction over them where they do not \u2014 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. \u2605 These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, \u0060Sources/FluxTextEncoders/Model/Qwen3/Qwen3MLP.swift:37\u0060 calls \u0060ModuleInfo\u0060, \u0060Linear\u0060 and \u0060Sources/FluxTextEncoders/Model/Qwen35/Qwen35MLP.swift:23\u0060 does not \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/Qwen3/Qwen3MLP.swift"},"region":{"startLine":28}}}],"partialFingerprints":{"codehealthFindingId/v1":"2771ab8544681de2206a728df6647b7df90dcb44c43ef635f52e232a01d1e3d4"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (6 lines \u00D7 6): Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:366-375 | Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:419-428 | Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:521-529 | Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:561-569 | Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:633-638 | Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:646-651 \u2014 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 \u2014 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 \u0060Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:366\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that. The \u0060return\u0060 at the foot of the matched lines is the enclosing body\u0027s own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that \u0060return\u0060 occupied \u2014 no decision has to be handed back and re-acted on."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift"},"region":{"startLine":366}}}],"partialFingerprints":{"codehealthFindingId/v1":"c5383e6e5fd6ce4d82c7f8f41860db340c6016d10bb53605f2b8eb2834af336f"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (6 lines \u00D7 2): Sources/Flux2CLI/InpaintCommand.swift:235-240 | Sources/Flux2Core/Utils/MemoryManager.swift:108-114 \u2014 the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach \u2014 a location they all depend on today, or a new shared one if there is none \u2014 and call it from each site; until then, every change has to be made twice."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/InpaintCommand.swift"},"region":{"startLine":235}}}],"partialFingerprints":{"codehealthFindingId/v1":"d27e428b34a40f8108056015a560572e7059225cae8abce5853ee1cbd6efb007"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (6 lines \u00D7 2): Sources/Flux2Core/Pipeline/LatentUtils.swift:293-298 | Sources/Flux2Core/Transformer/Flux2RoPE.swift:278-285 \u2014 the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach \u2014 a location they all depend on today, or a new shared one if there is none \u2014 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 \u0060return\u0060 inside it is the body\u0027s own exit and keeps its meaning in the moved unit."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/LatentUtils.swift"},"region":{"startLine":293}}}],"partialFingerprints":{"codehealthFindingId/v1":"63af13677e6447d5d978aaa347a7e1c1a0685c80861328d4f3861afec53a1fac"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (6 lines \u00D7 2): Sources/Flux2Core/Training/LoRATrainingHelper.swift:148-153 | Sources/Flux2Core/Training/LoRATrainingHelper.swift:680-685 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2Core/Training/LoRATrainingHelper.swift:148\u0060 it runs out through the closing brace of the declaration holding it \u2014 the window is that declaration\u0027s tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/LoRATrainingHelper.swift"},"region":{"startLine":148}}}],"partialFingerprints":{"codehealthFindingId/v1":"aadcc9cc47e1dda3c6c449685789c6c9763c60b22a51d9966946f7518c0d7f76"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (6 lines \u00D7 3): Sources/FluxTextEncoders/Vision/MistralVLM.swift:267-272 | Sources/FluxTextEncoders/Vision/MistralVLM.swift:273-278 | Sources/FluxTextEncoders/Vision/MistralVLM.swift:279-284 \u2014 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 \u2014 resolving only two of them leaves the rest to drift apart the first time one is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names \u2014 the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Vision/MistralVLM.swift"},"region":{"startLine":267}}}],"partialFingerprints":{"codehealthFindingId/v1":"1686021e1158b73f3077c2321292b29c761dd7127751a4489b251434bd67e5fa"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (5 lines \u00D7 4): Sources/FluxTextEncoders/Generation/MistralGenerator.swift:438-453 | Sources/FluxTextEncoders/Generation/Qwen3Generator.swift:426-440 | Sources/FluxTextEncoders/Generation/Qwen3VLGenerator.swift:151-155 | Sources/FluxTextEncoders/Model/Qwen35/Qwen35VLM.swift:275-279 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Generation/MistralGenerator.swift\u0060 and \u0060Sources/FluxTextEncoders/Generation/Qwen3Generator.swift\u0060 as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 158 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 \u2014 extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/FluxTextEncoders/Generation/MistralGenerator.swift:438\u0060 it runs out through the closing brace of the declaration holding it \u2014 the window is that declaration\u0027s tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that. The \u0060return\u0060 at the foot of the matched lines is the enclosing body\u0027s own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that \u0060return\u0060 occupied \u2014 no decision has to be handed back and re-acted on."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Generation/MistralGenerator.swift"},"region":{"startLine":438}}}],"partialFingerprints":{"codehealthFindingId/v1":"f3f74750cb6fb542d561cc04ef0258a7ef2e7a61fd48a9de4539c6e16bfe2736"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (5 lines \u00D7 2): Sources/Flux2Core/Pipeline/Flux2Pipeline\u002BChainHelpers.swift:189-193 | Sources/Flux2Core/Pipeline/Flux2Pipeline\u002BChainHelpers.swift:225-229 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2Core/Pipeline/Flux2Pipeline\u002BChainHelpers.swift:189\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/Flux2Pipeline\u002BChainHelpers.swift"},"region":{"startLine":189}}}],"partialFingerprints":{"codehealthFindingId/v1":"37b2aa767d2c003ecf67c16dd307ee490cbc146e5c19339258351b941e940a41"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (5 lines \u00D7 2): Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:2463-2467 | Sources/Flux2Core/Training/Data/LatentCache.swift:475-480 \u2014 the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach \u2014 a location they all depend on today, or a new shared one if there is none \u2014 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 \u0060Sources/Flux2Core/Pipeline/Flux2Pipeline.swift:2463\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/Flux2Pipeline.swift"},"region":{"startLine":2463}}}],"partialFingerprints":{"codehealthFindingId/v1":"1e0f727c1d65235f1dc33903ef407f3b13869446bb66996e5b8e7750d6a41f08"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (8 lines \u00D7 2): Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1430-1437 | Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1486-1493 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1430\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":1430}}}],"partialFingerprints":{"codehealthFindingId/v1":"27f8b4da2378753f4291d706cbbb20a6ca1ba205cd08ef76f6609bd1c7565b63"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (6 lines \u00D7 2): Sources/FluxTextEncoders/Embeddings/EmbeddingExtractor.swift:89-94 | Sources/FluxTextEncoders/Embeddings/KleinConfig.swift:150-155 \u2014 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 \u2014 a file they already depend on, or a new one alongside them \u2014 and call it from both call sites, so a change lands once."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Embeddings/EmbeddingExtractor.swift"},"region":{"startLine":89}}}],"partialFingerprints":{"codehealthFindingId/v1":"50214a354daafdb57215f3c6cbaa066268012f602fbe2a9b6ee3a94c3ae7295b"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (6 lines \u00D7 2): Sources/FluxTextEncoders/FluxTextEncoders.swift:455-460 | Sources/FluxTextEncoders/FluxTextEncoders.swift:568-573 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/FluxTextEncoders/FluxTextEncoders.swift:455\u0060 it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows \u2014 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\u0027 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 \u2014 a one-line delegation has no helper inside it to lift \u2014 so generate the run from the set it enumerates, or accept it and keep each member\u0027s own documentation with it."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/FluxTextEncoders.swift"},"region":{"startLine":455}}}],"partialFingerprints":{"codehealthFindingId/v1":"645f339307c41d704d393bf05d089c75025a2a0407adc5e35697ff3861d28239"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (5 lines \u00D7 2): Sources/FluxTextEncoders/FluxTextEncoders.swift:901-905 | Sources/FluxTextEncoders/FluxTextEncoders.swift:1242-1246 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/FluxTextEncoders/FluxTextEncoders.swift:901\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 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 \u2014 the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/FluxTextEncoders.swift"},"region":{"startLine":901}}}],"partialFingerprints":{"codehealthFindingId/v1":"8e4ef1e94568aa7300c5a4d6f43d83f55ae248156beb9e551155e96794382657"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (24 lines \u00D7 2): Sources/Flux2Core/Training/Optimizer/ResumableAdamW.swift:71-101 | Sources/Flux2Core/Training/Optimizer/ResumableLion.swift:72-95 \u2014 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 \u2014 a file they already depend on, or a new one alongside them \u2014 and call it from both call sites, so a change lands once. \u2605 These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, \u0060Sources/Flux2Core/Training/Optimizer/ResumableLion.swift:66\u0060 calls \u0060MLXArray\u0060, \u0060Int32\u0060 and \u0060Sources/Flux2Core/Training/Optimizer/ResumableAdamW.swift:63\u0060 does not \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Optimizer/ResumableAdamW.swift"},"region":{"startLine":71}}}],"partialFingerprints":{"codehealthFindingId/v1":"1fc31daef0d3788e77a22e2dc8c1dfbc07dbc565620b9ce482234ac4a7f657f2"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (5 lines \u00D7 3): Sources/Flux2CLI/InpaintCommand.swift:275-279 | Sources/Flux2CLI/MaskSubjectCommand.swift:66-70 | Sources/Flux2CLI/OutpaintCommand.swift:137-141 \u2014 before extracting anything, compare \u0060Sources/Flux2CLI/InpaintCommand.swift\u0060 and \u0060Sources/Flux2CLI/OutpaintCommand.swift\u0060 as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 31 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together \u2014 extracting one helper per block leaves the fork in place."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/InpaintCommand.swift"},"region":{"startLine":275}}}],"partialFingerprints":{"codehealthFindingId/v1":"de7c20af969de22ab42f3698c3d27389dcd3bade631395d3a7dd6c234df2a3b6"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (8 lines \u00D7 6): Sources/Flux2Core/Configuration/ModelRegistry.swift:260-272 | Sources/Flux2Core/Configuration/QuantizationConfig.swift:23-30 | Sources/FluxTextEncoders/Configuration/TextEncoderModelRegistry.swift:35-42 | Sources/FluxTextEncoders/Configuration/TextEncoderModelRegistry.swift:44-51 | Sources/FluxTextEncoders/Configuration/TextEncoderModelRegistry.swift:63-70 | Sources/FluxTextEncoders/Configuration/TextEncoderModelRegistry.swift:73-84 \u2014 there are 6 copies across 3 file(s) \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Configuration/ModelRegistry.swift"},"region":{"startLine":260}}}],"partialFingerprints":{"codehealthFindingId/v1":"c2603cb08fd36a07c35ea94122fac3f0e8c88c5b4b3cac478bfb140c61ef6813"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (8 lines \u00D7 3): Sources/Flux2Core/Configuration/ModelRegistry.swift:279-286 | Sources/Flux2Core/Configuration/QuantizationConfig.swift:14-21 | Sources/FluxTextEncoders/Configuration/TextEncoderModelRegistry.swift:54-61 \u2014 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 \u2014 a location they all depend on today, or a new shared one if there is none \u2014 and call it from each site; until then, every change has to be made 3 times."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Configuration/ModelRegistry.swift"},"region":{"startLine":279}}}],"partialFingerprints":{"codehealthFindingId/v1":"a25d109b7741cf532592594b05c3f3fff19d09815601d6471da6f3694407df27"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (6 lines \u00D7 2): Sources/Flux2Core/Loading/ModelDownloader.swift:472-477 | Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift:712-717 \u2014 the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach \u2014 a location they all depend on today, or a new shared one if there is none \u2014 and call it from each site; until then, every change has to be made twice."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Loading/ModelDownloader.swift"},"region":{"startLine":472}}}],"partialFingerprints":{"codehealthFindingId/v1":"ebc6d5116abeec4a7d760dcdd488975da1d504d692b52d5182f8cbd8f5b4cf40"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (10 lines \u00D7 2): Sources/FluxTextEncoders/Embeddings/EmbeddingExtractor.swift:73-82 | Sources/FluxTextEncoders/Embeddings/KleinConfig.swift:133-142 \u2014 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 \u2014 a file they already depend on, or a new one alongside them \u2014 and call it from both call sites, so a change lands once."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Embeddings/EmbeddingExtractor.swift"},"region":{"startLine":73}}}],"partialFingerprints":{"codehealthFindingId/v1":"c5a2defb78e029fd4231924fa9ccfc394331f3ac29dbd72ec0ebaf1229f9472b"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (16 lines \u00D7 2): Sources/FluxTextEncoders/Embeddings/KleinEmbeddingExtractor.swift:143-162 | Sources/FluxTextEncoders/Embeddings/KleinVLEmbeddingExtractor.swift:116-131 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Embeddings/KleinEmbeddingExtractor.swift\u0060 and \u0060Sources/FluxTextEncoders/Embeddings/KleinVLEmbeddingExtractor.swift\u0060 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. 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 \u2014 extracting one helper per block leaves the fork in place."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Embeddings/KleinEmbeddingExtractor.swift"},"region":{"startLine":143}}}],"partialFingerprints":{"codehealthFindingId/v1":"544898152440e9c91621a005771e3ff9ad4075e620ce58e2391c856d4e9ece8b"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (7 lines \u00D7 2): Sources/FluxTextEncoders/Model/MistralAttention.swift:342-348 | Sources/FluxTextEncoders/Model/Qwen3/Qwen3Attention.swift:21-27 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Model/MistralAttention.swift\u0060 and \u0060Sources/FluxTextEncoders/Model/Qwen3/Qwen3Attention.swift\u0060 as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 85 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Note first that the copies are not typed on the same thing: the declarations holding them bind \u0060base\u0060 to \u0060Float = 10000.0\u0060 in one and \u0060Float = 1_000_000.0\u0060 in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH \u2014 their common supertype where they have one, or a new abstraction over them where they do not \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/MistralAttention.swift"},"region":{"startLine":342}}}],"partialFingerprints":{"codehealthFindingId/v1":"920de241900255dd064a9a7f67e3d914f6af786deffbd875c3f68d1635409614"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (7 lines \u00D7 2): Sources/FluxTextEncoders/Model/MistralAttention.swift:350-356 | Sources/FluxTextEncoders/Model/Qwen3/Qwen3Attention.swift:29-35 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Model/MistralAttention.swift\u0060 and \u0060Sources/FluxTextEncoders/Model/Qwen3/Qwen3Attention.swift\u0060 as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 85 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/MistralAttention.swift"},"region":{"startLine":350}}}],"partialFingerprints":{"codehealthFindingId/v1":"f42923fc458a6bdf4ac1feed11e66d635df9efc0acf59c661afdd18e46175387"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (5 lines \u00D7 3): Sources/FluxTextEncoders/Model/MistralMLP.swift:39-44 | Sources/FluxTextEncoders/Model/Qwen3/Qwen3MLP.swift:42-47 | Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLMLP.swift:39-43 \u2014 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 \u2014 a location they all depend on today, or a new shared one if there is none \u2014 and call it from each site; until then, every change has to be made 3 times."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/MistralMLP.swift"},"region":{"startLine":39}}}],"partialFingerprints":{"codehealthFindingId/v1":"bf9e8e6c19f002a2a363ee75496a1f379fc6ee6917ccc04ed6430fdaaef4e227"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (5 lines \u00D7 3): Sources/FluxTextEncoders/Model/MistralModel.swift:61-65 | Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift:20-24 | Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLModel.swift:25-29 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Model/MistralModel.swift\u0060 and \u0060Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift\u0060 as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 169 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/MistralModel.swift"},"region":{"startLine":61}}}],"partialFingerprints":{"codehealthFindingId/v1":"1c016bbafb52f0ac505d43d00f9f66dbccdff1282a608f85d02af2d57d5b71c5"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (14 lines \u00D7 2): Sources/Flux2Core/Configuration/MemoryOptimizationConfig.swift:143-156 | Sources/FluxTextEncoders/Configuration/TextEncoderMemoryConfig.swift:57-70 \u2014 the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach \u2014 a location they all depend on today, or a new shared one if there is none \u2014 and call it from each site; until then, every change has to be made twice."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Configuration/MemoryOptimizationConfig.swift"},"region":{"startLine":143}}}],"partialFingerprints":{"codehealthFindingId/v1":"2e03ea00dd945f6b03b84bc0d593935230279253167d912d28cb5fb69fd8262a"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (6 lines \u00D7 2): Sources/Flux2Core/LoRA/LoRAConfig.swift:79-84 | Sources/FluxTextEncoders/Configuration/Qwen3Configuration.swift:143-148 \u2014 the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach \u2014 a location they all depend on today, or a new shared one if there is none \u2014 and call it from each site; until then, every change has to be made twice."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/LoRA/LoRAConfig.swift"},"region":{"startLine":79}}}],"partialFingerprints":{"codehealthFindingId/v1":"f7801109d71bcff2e6e7967dc456d725c3099932db66940bba7a9791c8572c91"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (10 lines \u00D7 2): Sources/FluxTextEncoders/Embeddings/KleinEmbeddingExtractor.swift:31-41 | Sources/FluxTextEncoders/Embeddings/KleinVLEmbeddingExtractor.swift:30-39 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Embeddings/KleinEmbeddingExtractor.swift\u0060 and \u0060Sources/FluxTextEncoders/Embeddings/KleinVLEmbeddingExtractor.swift\u0060 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. 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 \u2014 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 \u0060model\u0060 to \u0060Qwen3ForCausalLM\u0060 in one and \u0060Qwen3VLForCausalLM\u0060 in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH \u2014 their common supertype where they have one, or a new abstraction over them where they do not \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Embeddings/KleinEmbeddingExtractor.swift"},"region":{"startLine":31}}}],"partialFingerprints":{"codehealthFindingId/v1":"2a6da9ce14ca58771a812df7a4c4a9c8ca47f03eeb1287d09b2ee375bb1e2408"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (6 lines \u00D7 2): Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift:228-237 | Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLModel.swift:217-222 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift\u0060 and \u0060Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLModel.swift\u0060 as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 195 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 \u0060config\u0060 to \u0060Qwen3TextConfig\u0060 in one and \u0060Qwen3VLTextConfig\u0060 in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH \u2014 their common supertype where they have one, or a new abstraction over them where they do not \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift"},"region":{"startLine":228}}}],"partialFingerprints":{"codehealthFindingId/v1":"89e1b18b8f8e1695c9b4013e65af72f3ef24d155bcdd96b6d049e0b31be41765"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (6 lines \u00D7 2): Sources/Flux2CLI/ProfileCommand.swift:124-129 | Sources/Flux2CLI/ProfileCommand.swift:237-242 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/ProfileCommand.swift"},"region":{"startLine":124}}}],"partialFingerprints":{"codehealthFindingId/v1":"cc9c7322966cc6016e109f35a634ce6fe27289411ef94ec903cb3f88b2d40fbb"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (6 lines \u00D7 2): Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1423-1428 | Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1479-1484 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:1423\u0060 it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":1423}}}],"partialFingerprints":{"codehealthFindingId/v1":"d07b3a64c1eb107b323e6f0cfe354ac713b807fefb35a79a40c6d8fc819b9244"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (8 lines \u00D7 4): Sources/FluxTextEncoders/Configuration/EncoderConfiguration.swift:61-68 | Sources/FluxTextEncoders/Configuration/Qwen35Configuration.swift:79-86 | Sources/FluxTextEncoders/Configuration/Qwen3Configuration.swift:51-58 | Sources/FluxTextEncoders/Configuration/Qwen3VLConfiguration.swift:65-72 \u2014 before extracting anything, compare \u0060Sources/FluxTextEncoders/Configuration/EncoderConfiguration.swift\u0060 and \u0060Sources/FluxTextEncoders/Configuration/Qwen3Configuration.swift\u0060 as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 32 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 \u2014 extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at \u0060Sources/FluxTextEncoders/Configuration/EncoderConfiguration.swift:61\u0060 it does not close everything it opens, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that. \u2605 These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, \u0060Sources/FluxTextEncoders/Configuration/Qwen3Configuration.swift:59\u0060 calls \u0060decode\u0060, \u0060decodeIfPresent\u0060 and \u0060Sources/FluxTextEncoders/Configuration/Qwen35Configuration.swift:87\u0060 does not \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Configuration/EncoderConfiguration.swift"},"region":{"startLine":61}}}],"partialFingerprints":{"codehealthFindingId/v1":"75e866dc9a830b168eb254d19631ea3ec8f0bf6e594769b2f68b7ae8237cb85d"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (5 lines \u00D7 2): Sources/FluxTextEncoders/FluxTextEncoders.swift:829-833 | Sources/FluxTextEncoders/Vision/MistralVLM.swift:580-584 \u2014 the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach \u2014 a location they all depend on today, or a new shared one if there is none \u2014 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 \u0060Sources/FluxTextEncoders/FluxTextEncoders.swift:829\u0060 it runs out through the closing brace of the declaration holding it \u2014 the window is that declaration\u0027s tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand \u2014 widen the region to the smallest complete statement or declaration that contains it, and extract that."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/FluxTextEncoders.swift"},"region":{"startLine":829}}}],"partialFingerprints":{"codehealthFindingId/v1":"f747044c6ca9c50bd0fdd40b84baeb8f758c432e979bff23d65bd795c64fee50"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (5 lines \u00D7 3): Sources/FluxTextEncoders/FluxTextEncoders.swift:929-933 | Sources/FluxTextEncoders/Vision/MistralVLM.swift:178-182 | Sources/FluxTextEncoders/Vision/MistralVLM.swift:199-203 \u2014 there are 3 copies across 2 file(s) \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/FluxTextEncoders.swift"},"region":{"startLine":929}}}],"partialFingerprints":{"codehealthFindingId/v1":"b437aba17d1a336430d5b9fd40190715b1e0d7a5592fc94f7541744e860e0a51"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (11 lines \u00D7 2): scripts/fix_learning_curve.swift:87-97 | scripts/fix_learning_curve.swift:109-119 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"scripts/fix_learning_curve.swift"},"region":{"startLine":87}}}],"partialFingerprints":{"codehealthFindingId/v1":"23ff75569a0ac8c4fbe659c159216f5025223912d046cad9a3d5446159afc82f"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (5 lines \u00D7 2): Sources/Flux2CLI/TestQwen35.swift:164-169 | Sources/Flux2CLI/TestVLGeneration.swift:77-81 \u2014 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 \u2014 a file they already depend on, or a new one alongside them \u2014 and call it from both call sites, so a change lands once."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/TestQwen35.swift"},"region":{"startLine":164}}}],"partialFingerprints":{"codehealthFindingId/v1":"7a38932308205005f0412938634a05aa9acb58f231cf1acd658743b08b868661"}},{"ruleId":"D4","level":"warning","message":{"text":"Duplicated block (5 lines \u00D7 2): scripts/fix_learning_curve.swift:176-180 | scripts/fix_learning_curve.swift:182-186 \u2014 both copies are in the same file, so extract the block into one function there and call it from each site \u2014 the copies drift apart the first time only one of them is edited."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"scripts/fix_learning_curve.swift"},"region":{"startLine":176}}}],"partialFingerprints":{"codehealthFindingId/v1":"e203a789d2e51f8f7d9e422bee03fc1ef8efd34a97461fe3e82a12e721f3f9e8"}},{"ruleId":"D5","level":"warning","message":{"text":"Off the main sequence: FluxTextEncoders: FluxTextEncoders: abstractness 0.01, instability 0.00, distance 0.99 \u2014 zone of pain \u2014 concrete and depended on by 5 project(s), so it\u0027s rigid to change."},"locations":[],"partialFingerprints":{"codehealthFindingId/v1":"71e3797d51dcc1c11a6fc48fe77bf78254f8f26cfaaa4d695fea62fd09f5f75b"}},{"ruleId":"D5","level":"warning","message":{"text":"Off the main sequence: Flux2Core: Flux2Core: abstractness 0.03, instability 0.25, distance 0.72 \u2014 zone of pain \u2014 concrete and depended on by 3 project(s), so it\u0027s rigid to change."},"locations":[],"partialFingerprints":{"codehealthFindingId/v1":"c5b1b9c7d5095f3065eb43cc4e838bca2606405afe9ef53dfe699854fa201839"}},{"ruleId":"D6","level":"warning","message":{"text":"Low cohesion: FluxTextEncoders (LCOM4 14): FluxTextEncoders\u0027s methods fall into 14 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable \u2014 your repository\u0027s bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 14 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected \u2014 and which would otherwise dominate this list \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/FluxTextEncoders.swift"},"region":{"startLine":33}}}],"partialFingerprints":{"codehealthFindingId/v1":"79a2bb98fe148b31fd3f992374425dae56c76e3f005af81cb2ad91a1000da672"}},{"ruleId":"D6","level":"warning","message":{"text":"Low cohesion: FlowMatchEulerScheduler (LCOM4 5): FlowMatchEulerScheduler\u0027s 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 \u2014 your repository\u0027s 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 \u2014 and which would otherwise dominate this list \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Scheduler/FlowMatchEulerScheduler.swift"},"region":{"startLine":34}}}],"partialFingerprints":{"codehealthFindingId/v1":"4ec9733a29787de1790493b7fb5a964f9fb7da617f8221367dd4d2eab7a840b9"}},{"ruleId":"D6","level":"warning","message":{"text":"Low cohesion: AutoencoderKLFlux2 (LCOM4 5): AutoencoderKLFlux2\u0027s 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 \u2014 your repository\u0027s 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 \u2014 and which would otherwise dominate this list \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/VAE/AutoencoderKL.swift"},"region":{"startLine":46}}}],"partialFingerprints":{"codehealthFindingId/v1":"e1468f3b72224777a22c93388e4645042dda67cdeae4c36e3b154ae7ebeb1fd7"}},{"ruleId":"D6","level":"warning","message":{"text":"Low cohesion: Flux2MemoryManager (LCOM4 4): Flux2MemoryManager\u0027s 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 \u2014 your repository\u0027s 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 \u2014 and which would otherwise dominate this list \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Utils/MemoryManager.swift"},"region":{"startLine":11}}}],"partialFingerprints":{"codehealthFindingId/v1":"c8e772ae264f907202b6a17ac09c054ca26a938a82e2e315ce98c3b69ffe4313"}},{"ruleId":"D6","level":"warning","message":{"text":"Low cohesion: TextEncoderModelRegistry (LCOM4 4): TextEncoderModelRegistry\u0027s 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 \u2014 your repository\u0027s 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 \u2014 and which would otherwise dominate this list \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Configuration/TextEncoderModelRegistry.swift"},"region":{"startLine":441}}}],"partialFingerprints":{"codehealthFindingId/v1":"b9bd250fdc25f4e75e35c2c3fea52d48da6c11511025c8af3b31e58c15a608dd"}},{"ruleId":"D6","level":"warning","message":{"text":"Low cohesion: TextEncoderModelDownloader (LCOM4 4): TextEncoderModelDownloader\u0027s 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 \u2014 your repository\u0027s 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 \u2014 and which would otherwise dominate this list \u2014 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."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift"},"region":{"startLine":17}}}],"partialFingerprints":{"codehealthFindingId/v1":"9f6e669def44020d08f05ed70edf8c37c49c7a6771a52a98753ca29e16f49a63"}},{"ruleId":"D10","level":"warning","message":{"text":"Skipped test: testDirectorySizeEmptySymlinkTargetContributesZero: Skipped \u2014 throws XCTSkip"},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Tests/Flux2CoreTests/ModelDownloaderSizeTests.swift"},"region":{"startLine":299}}}],"partialFingerprints":{"codehealthFindingId/v1":"f8a8ff3266af20d80b150bbd65a9d620215968986acf2f31ca78ee52720d0a5f"}},{"ruleId":"D10","level":"warning","message":{"text":"Skipped test: testDownloadRefusesReadOnlyDestinationBeforeAnyNetworkCall: Skipped \u2014 throws XCTSkip"},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Tests/Flux2CoreTests/ModelPathOverrideTests.swift"},"region":{"startLine":263}}}],"partialFingerprints":{"codehealthFindingId/v1":"f4d6510c8a3b3f1d6b297bde2f031b73e2590a678b78b4c033b2fb0365a9467a"}},{"ruleId":"D10","level":"warning","message":{"text":"Skipped test: testLoadDescribeUnload: Skipped \u2014 throws XCTSkip"},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Tests/FluxGemma4VLMTests/Gemma4VLMProviderTests.swift"},"region":{"startLine":148}}}],"partialFingerprints":{"codehealthFindingId/v1":"8fca956427b5a4ab2c4ba51642879d0476bafb7a6d16b709548529afb650c33a"}},{"ruleId":"D10","level":"warning","message":{"text":"No assertions: testMemoryManagerCanRunCheck: This method\u0027s body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) \u2014 so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as \u0027no assertion this check knows how to see\u0027, and if that is right, add one."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Tests/Flux2CoreTests/Flux2CoreTests.swift"},"region":{"startLine":860}}}],"partialFingerprints":{"codehealthFindingId/v1":"f27aed1da3f6c5a0fe74479b7f3fd9c54dc94253a37be3850c5c8ebf50b8030b"}},{"ruleId":"D10","level":"warning","message":{"text":"No assertions: testEnableThinkingParameterExists: This method\u0027s body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) \u2014 so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as \u0027no assertion this check knows how to see\u0027, and if that is right, add one."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Tests/Flux2CoreTests/LoRATrainingSetupTests.swift"},"region":{"startLine":191}}}],"partialFingerprints":{"codehealthFindingId/v1":"b6cdf911984d180baeec5433a22700f40c502a5adfb543964c703e7bc6653e44"}},{"ruleId":"D10","level":"warning","message":{"text":"No assertions: testIsModelLoadedInitiallyFalse: This method\u0027s body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) \u2014 so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as \u0027no assertion this check knows how to see\u0027, and if that is right, add one."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Tests/FluxTextEncodersTests/FluxTextEncodersTests.swift"},"region":{"startLine":34}}}],"partialFingerprints":{"codehealthFindingId/v1":"ed1cce2428c697b15efecd4462e1cb7b95454e244bc57cf7f9feeed3e9377f37"}},{"ruleId":"D10","level":"warning","message":{"text":"No assertions: testIsVLMLoadedInitiallyFalse: This method\u0027s body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) \u2014 so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as \u0027no assertion this check knows how to see\u0027, and if that is right, add one."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Tests/FluxTextEncodersTests/FluxTextEncodersTests.swift"},"region":{"startLine":41}}}],"partialFingerprints":{"codehealthFindingId/v1":"cfae29fdb3b7ddbb71a64775388f9dcea37d1405dba8cfac764666ebd6818381"}},{"ruleId":"D10","level":"warning","message":{"text":"No assertions: testTextEncoderModelRegistryFindByVariantNotFound: This method\u0027s body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) \u2014 so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as \u0027no assertion this check knows how to see\u0027, and if that is right, add one."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Tests/FluxTextEncodersTests/ModelRegistryTests.swift"},"region":{"startLine":132}}}],"partialFingerprints":{"codehealthFindingId/v1":"deba8fd0fd4b3de91895d974e8633d76c445ce208d91208006c2537dd6c7404f"}},{"ruleId":"D10","level":"warning","message":{"text":"No assertions: testReconfigureHubApiDoesNotCrash: This method\u0027s body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) \u2014 so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as \u0027no assertion this check knows how to see\u0027, and if that is right, add one."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Tests/FluxTextEncodersTests/TextEncoderModelDirectoryTests.swift"},"region":{"startLine":51}}}],"partialFingerprints":{"codehealthFindingId/v1":"cf04086b6100ddc8b205756b43693b8f1ed9381e4588429992cfc5921e59baf8"}},{"ruleId":"D15","level":"warning","message":{"text":"Hotspot: Sources/Flux2Core/Pipeline/Flux2Pipeline.swift: Sources/Flux2Core/Pipeline/Flux2Pipeline.swift changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 93 in Flux2Pipeline.generateWithResult at line 1215. 6 of those changes were fix/bug commits, and the other 8 changed it for other reasons \u2014 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 \u2014 a file this often edited pays the complexity back every time. Counted over 2026-06-14..2026-09-12, the 90 days ending at the analysed commit. Reproduce with \u0060git log --since=\u00272026-06-14 11:04:31 \u002B02:00\u0027 --until=\u00272026-09-12 11:04:31 \u002B02:00\u0027 --full-history --no-merges -- Sources/Flux2Core/Pipeline/Flux2Pipeline.swift\u0060: 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 \u2014 a difference of several commits on a file whose history was re-landed or reverted inside the window."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Pipeline/Flux2Pipeline.swift"},"region":{"startLine":1215}}}],"partialFingerprints":{"codehealthFindingId/v1":"9c15b11c804b6918e78b7a1e55f1b6619432d72688973fb81738cfc8494fd213"}},{"ruleId":"D15","level":"warning","message":{"text":"Hotspot: Sources/Flux2CLI/Flux2CLI.swift: Sources/Flux2CLI/Flux2CLI.swift changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 67 in ImageToImage.run at line 486. 3 of those changes were fix/bug commits, and the other 7 changed it for other reasons \u2014 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 \u2014 a file this often edited pays the complexity back every time. Counted over 2026-06-14..2026-09-12, the 90 days ending at the analysed commit. Reproduce with \u0060git log --since=\u00272026-06-14 11:04:31 \u002B02:00\u0027 --until=\u00272026-09-12 11:04:31 \u002B02:00\u0027 --full-history --no-merges -- Sources/Flux2CLI/Flux2CLI.swift\u0060: 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 \u2014 a difference of several commits on a file whose history was re-landed or reverted inside the window."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/Flux2CLI.swift"},"region":{"startLine":486}}}],"partialFingerprints":{"codehealthFindingId/v1":"a1f8a480c025e841a97a59390edfd6ed0b177d4bc2e3c4c9f1e45e7f4798fb5c"}},{"ruleId":"D15","level":"warning","message":{"text":"Hotspot: Sources/Flux2CLI/InpaintCommand.swift: Sources/Flux2CLI/InpaintCommand.swift changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in Inpaint.run at line 139. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-14..2026-09-12, the 90 days ending at the analysed commit. Reproduce with \u0060git log --since=\u00272026-06-14 11:04:31 \u002B02:00\u0027 --until=\u00272026-09-12 11:04:31 \u002B02:00\u0027 --full-history --no-merges -- Sources/Flux2CLI/InpaintCommand.swift\u0060: 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 \u2014 a difference of several commits on a file whose history was re-landed or reverted inside the window."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2CLI/InpaintCommand.swift"},"region":{"startLine":139}}}],"partialFingerprints":{"codehealthFindingId/v1":"57074085bff346a4b25ec33327e941f7f1c55a8d8c155862a8a252bc7b3b1d61"}},{"ruleId":"D15","level":"warning","message":{"text":"Repeated repair: Sources/Flux2Core/Loading/ModelDownloader.swift: Sources/Flux2Core/Loading/ModelDownloader.swift changed 8 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file\u0027s churn. Its max cyclomatic complexity is 13 (its worst body is Flux2ModelDownloader.download at line 242), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn \u00D7 complexity hotspot \u2014 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: \u201Cfix(loading): sixth review pass \u2014 load only the verified series, protect in-place relocation\u201D; \u201Cfix(loading): fourth review pass \u2014 one shared weight-directory inspector\u201D; \u201Cfix(loading): third review pass \u2014 relocation guards everywhere, no resident garbage\u201D; \u201Cfix(loading): harden path overrides after review \u2014 no regression for symlinked layouts\u201D. 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-06-14..2026-09-12, the 90 days ending at the analysed commit. Reproduce with \u0060git log --since=\u00272026-06-14 11:04:31 \u002B02:00\u0027 --until=\u00272026-09-12 11:04:31 \u002B02:00\u0027 --full-history --no-merges -- Sources/Flux2Core/Loading/ModelDownloader.swift\u0060: 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 \u2014 a difference of several commits on a file whose history was re-landed or reverted inside the window."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Loading/ModelDownloader.swift"},"region":{"startLine":242}}}],"partialFingerprints":{"codehealthFindingId/v1":"e06abf9429e786afc40e8602b788bf5d347e5a71410faed191f8dbaa89960ab1"}},{"ruleId":"D15","level":"warning","message":{"text":"Repeated repair: Sources/Flux2Core/Configuration/ModelRegistry.swift: Sources/Flux2Core/Configuration/ModelRegistry.swift changed 7 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file\u0027s churn. Its max cyclomatic complexity is 12 (its worst body is ModelRegistry.localPath at line 543), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn \u00D7 complexity hotspot \u2014 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: \u201Cfix(loading): third review pass \u2014 relocation guards everywhere, no resident garbage\u201D; \u201Cfix(loading): harden path overrides after review \u2014 no regression for symlinked layouts\u201D; \u201Crevert: descope ask #2 (pathOverrides) after two review rounds\u201D; \u201Cfix: address code review findings on relocated-model storage PR\u201D. 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-06-14..2026-09-12, the 90 days ending at the analysed commit. Reproduce with \u0060git log --since=\u00272026-06-14 11:04:31 \u002B02:00\u0027 --until=\u00272026-09-12 11:04:31 \u002B02:00\u0027 --full-history --no-merges -- Sources/Flux2Core/Configuration/ModelRegistry.swift\u0060: 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 \u2014 a difference of several commits on a file whose history was re-landed or reverted inside the window."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Configuration/ModelRegistry.swift"},"region":{"startLine":543}}}],"partialFingerprints":{"codehealthFindingId/v1":"af92654e11761986923f4b62a88a1ef7dc19531b5bdfdaa0da8fb194a365b122"}},{"ruleId":"D15","level":"warning","message":{"text":"Repeated repair: Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift: Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift changed 5 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file\u0027s churn. Its max cyclomatic complexity is 11 (its worst body is TextEncoderModelDownloaderError.errorDescription at line 733), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn \u00D7 complexity hotspot \u2014 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: \u201Cfix(loading): sixth review pass \u2014 load only the verified series, protect in-place relocation\u201D; \u201Cfix(loading): fourth review pass \u2014 one shared weight-directory inspector\u201D; \u201Cfix(loading): third review pass \u2014 relocation guards everywhere, no resident garbage\u201D; \u201Cfix(loading): harden path overrides after review \u2014 no regression for symlinked layouts\u201D. 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-06-14..2026-09-12, the 90 days ending at the analysed commit. Reproduce with \u0060git log --since=\u00272026-06-14 11:04:31 \u002B02:00\u0027 --until=\u00272026-09-12 11:04:31 \u002B02:00\u0027 --full-history --no-merges -- Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift\u0060: 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 \u2014 a difference of several commits on a file whose history was re-landed or reverted inside the window."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Loading/TextEncoderModelDownloader.swift"},"region":{"startLine":733}}}],"partialFingerprints":{"codehealthFindingId/v1":"45a06c7975a9fbd6536c3fc9ea6a09f00425554bd3cf8ab7b8c8775152769e23"}},{"ruleId":"D17","level":"warning","message":{"text":"TodoComment: // TODO: Make scale mutable in LoRAConfig \u2014 source code is not a task system: move the work to your tracker and leave a reference instead (e.g. \u0060// REF: #123\u0060), so the task is planned where tasks live and the ticket links back to the code."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/LoRA/LoRAAdapter.swift"},"region":{"startLine":127}}}],"partialFingerprints":{"codehealthFindingId/v1":"96517792be918812e36bba9b9468c6562340ded722924d3290324f4a453e2e56"}},{"ruleId":"D21","level":"note","message":{"text":"\u0060runtimeID\u0060 spells \u0060ID\u0060 where 58 names in the project spell it \u0060Id\u0060: 58 of 59 names in project Flux2App spell the token \u0060Id\u0060 (58 of 59; unit: names in project Flux2App containing \u0060Id\u0060). Peers: ModelManager.currentLoadedModelId (Sources/Flux2App/ViewModels/ModelManager.swift:38); Flux2ModelDownloader.repoId (Sources/Flux2Core/Loading/ModelDownloader.swift:208); Flux2ModelDownloader.fetchFileList(repoId) (Sources/Flux2Core/Loading/ModelDownloader.swift:358); Flux2ModelDownloader.downloadFile(repoId) (Sources/Flux2Core/Loading/ModelDownloader.swift:412); SimpleLoRATrainer.positionIdCache (Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift:202). Rename to \u0060runtimeId\u0060. [rule N6]"},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Utils/RuntimeBeacon.swift"},"region":{"startLine":55}}}],"partialFingerprints":{"codehealthFindingId/v1":"de5dad26f81b91ff90b5a3e5676061f01c4bfb7644beaeaf45d3ac6911740085"}},{"ruleId":"P1","level":"warning","message":{"text":"No CI pipeline: No CI workflow found (.github/workflows, azure-pipelines.yml, .gitlab-ci.yml, \u2026) \u2014 changes aren\u0027t gated by an automated build/test."},"locations":[],"partialFingerprints":{"codehealthFindingId/v1":"44f01af96e50474fba2df84d95ddf4f7e1d34c29c307830b9efc9057daa6b670"}},{"ruleId":"P2","level":"warning","message":{"text":"No structured logging: No logging or diagnostics emission found. This repository ships a binary its users launch rather than a service you operate, so there is no operator to page \u2014 but when a run fails on a user\u0027s machine, neither they nor you have anything to read."},"locations":[],"partialFingerprints":{"codehealthFindingId/v1":"9f10d71351c6778ebe84e761f82a90d4f9ed6c64f5e01975ede8fda7e4e2ebc5"}},{"ruleId":"P3","level":"note","message":{"text":"No SAST: No static application security testing detected. For this repository\u0027s stack, add CodeQL\u0027s Swift pack (Swift/Xcode) (or \u0060semgrep --config=auto\u0060, which runs on any language) \u2014 this repository has no CI pipeline yet, so run it locally to clear the existing findings, then make it a step of the first workflow you add so a regression fails the build. What was searched, so you can tell an absence from a miss: the 0 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\u0027s web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen \u2014 if that is your case the row is wrong, and saying so is more useful than adding a second scanner."},"locations":[],"partialFingerprints":{"codehealthFindingId/v1":"6e54424179c892f03ef2fd003130ac4bd43f39bbf3b1ca0a0143e25acb80ec87"}},{"ruleId":"P6","level":"note","message":{"text":"No changelog: No CHANGELOG/HISTORY/RELEASES file \u2014 what shipped when isn\u0027t easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)"},"locations":[],"partialFingerprints":{"codehealthFindingId/v1":"dda5aa5aed8cbb292c3ef2b733bc138f614293ae6426c85e98bf31ef330d9415"}},{"ruleId":"X10","level":"note","message":{"text":"Duplicated predicate: \u0060FluxProfiler.shared.isEnabled || ProcessInfo.processInfo.environment[\u0022VLM_DEBUG\u0022] != nil\u0060 appears character-identically in 2 files \u2014 Sources/FluxTextEncoders/FluxTextEncoders.swift, Sources/FluxTextEncoders/Vision/MistralVLM.swift. It is one line, so the duplication detector\u0027s token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/FluxTextEncoders.swift"},"region":{"startLine":828}}}],"partialFingerprints":{"codehealthFindingId/v1":"1531ec203ca94bc8d080125f6bf404e90a3d6caee05dc201ae9d1f5e17c7be84"}},{"ruleId":"X10","level":"note","message":{"text":"Duplicated predicate: \u0060layerSet.contains(layerIdx) || (memoryConfig.evalFrequency \u003E 0 \u0026\u0026 (i \u002B 1) % memoryConfig.evalFrequency == 0)\u0060 appears character-identically in 2 files \u2014 Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift, Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLModel.swift. It is one line, so the duplication detector\u0027s token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift"},"region":{"startLine":149}}}],"partialFingerprints":{"codehealthFindingId/v1":"9af2fef4ca87fb0d13a8bf4a66fff2466c213ff030658d873d27a484220190d7"}},{"ruleId":"X10","level":"note","message":{"text":"Duplicated predicate: \u0060memoryConfig.evalFrequency \u003E 0 \u0026\u0026 (i \u002B 1) % memoryConfig.evalFrequency == 0\u0060 appears character-identically in 6 files \u2014 Sources/FluxTextEncoders/Model/MistralModel.swift, Sources/FluxTextEncoders/Model/Qwen3/Qwen3Model.swift, Sources/FluxTextEncoders/Model/Qwen35/Qwen35Model.swift, Sources/FluxTextEncoders/Model/Qwen3VL/Qwen3VLModel.swift. It is one line, so the duplication detector\u0027s token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Model/MistralModel.swift"},"region":{"startLine":131}}}],"partialFingerprints":{"codehealthFindingId/v1":"6aa8c8f9580c031f56597570217748f2a9f69eace93dd5721284f20ef1c6234c"}},{"ruleId":"X10","level":"note","message":{"text":"Duplicated predicate: \u0060nextToken == eosTokenId || nextToken == padTokenId\u0060 appears character-identically in 2 files \u2014 Sources/FluxTextEncoders/Generation/Qwen3Generator.swift, Sources/FluxTextEncoders/Generation/Qwen3VLGenerator.swift. It is one line, so the duplication detector\u0027s token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Generation/Qwen3Generator.swift"},"region":{"startLine":94}}}],"partialFingerprints":{"codehealthFindingId/v1":"8f77a010224a09624cb6cadbd69dccdeb210cc80b80daf4d3d8aa0064d5cf223"}},{"ruleId":"X10","level":"note","message":{"text":"Duplicated predicate: \u0060repetitionPenalty != 1.0 \u0026\u0026 !generatedTokens.isEmpty\u0060 appears character-identically in 3 files \u2014 Sources/FluxTextEncoders/Generation/MistralGenerator.swift, Sources/FluxTextEncoders/Generation/Qwen3Generator.swift, Sources/FluxTextEncoders/Generation/Qwen3VLGenerator.swift. It is one line, so the duplication detector\u0027s token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Generation/MistralGenerator.swift"},"region":{"startLine":399}}}],"partialFingerprints":{"codehealthFindingId/v1":"c86dab46fa09a52bdb5d28177289211e77e688a1de74aa4d3833de3a14bde61a"}},{"ruleId":"X10","level":"note","message":{"text":"Duplicated predicate: \u0060stream \u0026\u0026 hasCallback \u0026\u0026 !pendingTokens.isEmpty\u0060 appears character-identically in 2 files \u2014 Sources/FluxTextEncoders/Generation/MistralGenerator.swift, Sources/FluxTextEncoders/Generation/Qwen3Generator.swift. It is one line, so the duplication detector\u0027s token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/Generation/MistralGenerator.swift"},"region":{"startLine":328}}}],"partialFingerprints":{"codehealthFindingId/v1":"c28ad006132b46471817567a36e4f80e8346d56603e049969948556a586d9705"}},{"ruleId":"X10","level":"note","message":{"text":"Duplicated predicate: \u0060tokenId \u003E= 0 \u0026\u0026 tokenId \u003C logitsArray.count\u0060 appears character-identically in 4 files \u2014 Sources/FluxTextEncoders/FluxTextEncoders.swift, Sources/FluxTextEncoders/Generation/MistralGenerator.swift, Sources/FluxTextEncoders/Generation/Qwen3Generator.swift, Sources/FluxTextEncoders/Generation/Qwen3VLGenerator.swift. It is one line, so the duplication detector\u0027s token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/FluxTextEncoders/FluxTextEncoders.swift"},"region":{"startLine":1046}}}],"partialFingerprints":{"codehealthFindingId/v1":"f62137346e0ed58b2dd483980f6501b45deeab9a8cd19d05d700f1780ec88eb8"}},{"ruleId":"X10","level":"note","message":{"text":"Duplicated predicate: \u0060viewModel.selectedModel != .klein9B || quant == .bf16\u0060 appears character-identically in 2 files \u2014 Sources/Flux2App/Views/ImageToImageView.swift, Sources/Flux2App/Views/TextToImageView.swift. It is one line, so the duplication detector\u0027s token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ImageToImageView.swift"},"region":{"startLine":168}}}],"partialFingerprints":{"codehealthFindingId/v1":"f01852706de6d384087d43e062913920b0665ca57ec54343420ea793d7f7fe0a"}},{"ruleId":"X10","level":"note","message":{"text":"Duplicated predicate: \u0060viewModel.showCheckpoints \u0026\u0026 !viewModel.checkpointImages.isEmpty\u0060 appears character-identically in 2 files \u2014 Sources/Flux2App/Views/ImageToImageView.swift, Sources/Flux2App/Views/TextToImageView.swift. It is one line, so the duplication detector\u0027s token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2App/Views/ImageToImageView.swift"},"region":{"startLine":447}}}],"partialFingerprints":{"codehealthFindingId/v1":"c04fb7c98e43f0fa9ccf83b3a9169cffa4688eab134a4a71200079ed341cd664"}},{"ruleId":"X7","level":"note","message":{"text":"Silent fallback default in catch: \u0060sizeOfItem\u0060 turns every thrown error into \u00600\u0060 \u2014 a data error becomes a silent behavior change with no trail. Log the error or let it propagate (\u0060throws\u0060). 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 \u0060catch\u0060, \u0060guard\u0060 or \u0060??\u0060, or in the doc comment, and the row stops firing."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Loading/ModelDownloader.swift"},"region":{"startLine":574}}}],"partialFingerprints":{"codehealthFindingId/v1":"cfe0f9bacde5120fd1981070500e0982c309f487dced9b5eb7af6a6f8b6ce940"}},{"ruleId":"X7","level":"note","message":{"text":"Silent fallback default in catch: \u0060sourceFingerprint\u0060 turns every thrown error into \u0060\u0022unknown\u0022\u0060 \u2014 a data error becomes a silent behavior change with no trail. Log the error or let it propagate (\u0060throws\u0060). 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 \u0060catch\u0060, \u0060guard\u0060 or \u0060??\u0060, or in the doc comment, and the row stops firing."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Loading/PrequantizedCheckpoint.swift"},"region":{"startLine":120}}}],"partialFingerprints":{"codehealthFindingId/v1":"13c38462c5e37a6446d305074d3fe1ddf9c3ee660e5404864ec6920474a0e0d5"}},{"ruleId":"X7","level":"note","message":{"text":"Silent fallback default in catch: \u0060selectVLMReferenceImages\u0060 turns every thrown error into \u0060[]\u0060 \u2014 a data error becomes a silent behavior change with no trail. Log the error or let it propagate (\u0060throws\u0060). 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 \u0060catch\u0060, \u0060guard\u0060 or \u0060??\u0060, or in the doc comment, and the row stops firing."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"Sources/Flux2Core/Training/Loop/SimpleLoRATrainer.swift"},"region":{"startLine":2050}}}],"partialFingerprints":{"codehealthFindingId/v1":"41bfcc805b6262f7c60425532425fd01772a1aefdac264c3d7731cce644567cd"}}],"taxonomies":[{"name":"CWE","guid":"c3a2b1d0-7f3e-4b2a-9c1d-5e6f7a8b9c0d","organization":"MITRE","informationUri":"https://cwe.mitre.org/","isComprehensive":false,"shortDescription":{"text":"The MITRE Common Weakness Enumeration (CWE)."},"taxa":[{"id":"CWE-259","guid":"ae9ad959-fbb6-9d5e-892d-3dca66da0b69","name":"Use of Hard-coded Password","shortDescription":{"text":"Use of Hard-coded Password"},"helpUri":"https://cwe.mitre.org/data/definitions/259.html"},{"id":"CWE-77","guid":"332c8ade-6612-9f56-a06b-d8d90b1a8750","name":"Improper Neutralization of Special Elements used in a Command (\u0027Command Injection\u0027)","shortDescription":{"text":"Improper Neutralization of Special Elements used in a Command (\u0027Command Injection\u0027)"},"helpUri":"https://cwe.mitre.org/data/definitions/77.html"},{"id":"CWE-78","guid":"2e31ceaf-c7ae-2e5e-9661-cfb1362789cf","name":"Improper Neutralization of Special Elements used in an OS Command (\u0027OS Command Injection\u0027)","shortDescription":{"text":"Improper Neutralization of Special Elements used in an OS Command (\u0027OS Command Injection\u0027)"},"helpUri":"https://cwe.mitre.org/data/definitions/78.html"},{"id":"CWE-79","guid":"fd45580b-e8c4-fc5e-8c2f-aa8fab0b4dbf","name":"Improper Neutralization of Input During Web Page Generation (\u0027Cross-site Scripting\u0027)","shortDescription":{"text":"Improper Neutralization of Input During Web Page Generation (\u0027Cross-site Scripting\u0027)"},"helpUri":"https://cwe.mitre.org/data/definitions/79.html"},{"id":"CWE-798","guid":"5e8f057d-fee3-995a-a0cb-9fc5b0d174d1","name":"Use of Hard-coded Credentials","shortDescription":{"text":"Use of Hard-coded Credentials"},"helpUri":"https://cwe.mitre.org/data/definitions/798.html"},{"id":"CWE-89","guid":"6d08fdad-37eb-c150-bbf0-d7d946863407","name":"Improper Neutralization of Special Elements used in an SQL Command (\u0027SQL Injection\u0027)","shortDescription":{"text":"Improper Neutralization of Special Elements used in an SQL Command (\u0027SQL Injection\u0027)"},"helpUri":"https://cwe.mitre.org/data/definitions/89.html"},{"id":"CWE-94","guid":"75e7f50c-6c2f-dd52-bf40-bf6c52b861fd","name":"Improper Control of Generation of Code (\u0027Code Injection\u0027)","shortDescription":{"text":"Improper Control of Generation of Code (\u0027Code Injection\u0027)"},"helpUri":"https://cwe.mitre.org/data/definitions/94.html"}]},{"name":"OWASP Top 10","guid":"7d1f0c2e-4b6a-4e39-9a51-0b2e8c3d5f61","version":"2025","organization":"OWASP Foundation","informationUri":"https://top10.owasp.org/2025/","isComprehensive":false,"shortDescription":{"text":"The OWASP Top 10:2025 web application security risks."},"taxa":[{"id":"A05:2025","guid":"87e86033-3231-8458-8e4a-5cb82743553a","name":"Injection","shortDescription":{"text":"Injection"},"helpUri":"https://top10.owasp.org/2025/A05_2025-Injection/"},{"id":"A07:2025","guid":"334ddd78-539d-d35c-83dd-253647eb7eaf","name":"Authentication Failures","shortDescription":{"text":"Authentication Failures"},"helpUri":"https://top10.owasp.org/2025/A07_2025-Authentication_Failures/"}]}],"properties":{"codehealthPublication":{"public":true,"notice":"This is the PUBLIC form of this artifact. Findings are listed in full, but the details of SECURITY findings \u2014 which rule fired, in which file, on which line, and how to fix it \u2014 are deliberately withheld, and any secret-scanner results are excluded entirely. Where detail is absent here it was REMOVED FOR PUBLICATION; it is not missing from the analysis. The complete artifact is available from the repository owner.","securityFindingsRedacted":0,"secretScannerRunsExcluded":0}}}]}