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

invoke-ai/InvokeAI

Measured 4 November 2026, 12:31 UTC, at code version af8d9e0

CAI score 42out of 100 Weak
CriticalWeakAdequateStrongExemplary
Up 6 since the last survey

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

A very large codebase: 734,441 lines of product code in 7 projects, tests not counted · Estimated rebuild effort: about 8.8 person-years · Weakest lens: Production Readiness, 33

Findings by how serious they are

64 critical 4327 serious 912 minor

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

This survey was produced by

Assert small markCanine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
4 November 2026, 12:31 UTC

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

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

91of 91 dimensions measured by tools.
5279of 5303 findings point to an exact file and line, so you can open each one in the code. The other 24 concern the repository as a whole, such as missing documentation.
91dimensions across 7 lenses, read from 734,441 lines of product code in 7 projects.
Chapters

Executive summary

invoke-ai/InvokeAI falls short of our standard for production, in part because we found no automated security scanning of the code, its secrets or its dependencies. It scores 42 out of 100 and is rated Weak, and 39 of its 64 critical findings are security problems.

Production Readiness, at 33, is the weakest lens and counts most in the score. The best first step is making the two tests that check nothing check their results, worth about 5 points. Adding automated security scanning would lift Production Readiness itself, also worth about 5. Raising Production Readiness to 70 would lift the score to about 50.

Twenty-nine pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Three known security holes in the packages the code depends on can be used by attackers, and twenty parts of the code are no longer understood by anyone working on it. Pinning each tool to an exact version, updating the vulnerable packages and having someone learn the forgotten files would close these risks. Fixing the weaknesses the scanner points to would fix the two security weaknesses in the code, and the three places where the code runs text as code or as a command need a direct call instead. The two tests that check nothing need to check the result they produce.

The product code is 734,441 lines, about €1,300,000 to rebuild.

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

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

If Production Readiness rose from 33 to 70, the lowest score rated Strong, the score would rise from 42 to about 50.

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

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

  • Cyclomatic Complexity · workbenchState.reduceWorkbenchAction (cyclomatic 412) invokeai/frontend/webv2/src/workbench/workbenchState.ts
  • Cyclomatic Complexity · InvokeButton.InvokeButton (cyclomatic 63) invokeai/frontend/webv2/src/workbench/shell/topbar/InvokeButton.tsx
  • Cyclomatic Complexity · WorkingMemorySection.WorkingMemoryBody (cyclomatic 61) invokeai/frontend/webv2/src/features/models/ui/detail/WorkingMemorySection.tsx
  • Cyclomatic Complexity · RegionalGuidanceSettings.RegionalGuidanceSettings (cyclomatic 51) invokeai/frontend/webv2/src/workbench/widgets/layers/RegionalGuidanceSettings.tsx
  • Cyclomatic Complexity · working_memory_calibration_fits.model_lines (cyclomatic 41) invokeai/app/services/working_memory_calibration/working_memory_calibration_fits.py
  • Cyclomatic Complexity · imageRecall.getMetadataExternalProvider (cyclomatic 41) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts
  • Cyclomatic Complexity · ExternalModelSection.ExternalModelSection (cyclomatic 40) invokeai/frontend/webv2/src/features/models/ui/detail/ExternalModelSection.tsx
  • Cyclomatic Complexity · MergeLayerController.mergeSelectedInto (cyclomatic 38) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts
  • Cyclomatic Complexity · useProjectActions.useProjectActions (cyclomatic 38) invokeai/frontend/webv2/src/workbench/projects/useProjectActions.ts
  • Cyclomatic Complexity · DefaultSettingsSection.DefaultSettingsSection (cyclomatic 34) invokeai/frontend/webv2/src/features/models/ui/detail/DefaultSettingsSection.tsx
  • Cyclomatic Complexity · ControlLayerCanvasOverlay.SelectedControlLayerOverlay (cyclomatic 34) invokeai/frontend/webv2/src/workbench/widgets/canvas/ControlLayerCanvasOverlay.tsx
  • Cyclomatic Complexity · working_memory_calibration_plan.build_plan (cyclomatic 33) invokeai/app/services/working_memory_calibration/working_memory_calibration_plan.py
  • Cyclomatic Complexity · mock-working-memory.createWorkingMemoryMock.calibrate (cyclomatic 33) invokeai/frontend/webv2/scripts/mock-working-memory.mjs
  • Cyclomatic Complexity · GraphPreviewOpenAsMenu.GraphPreviewOpenAsMenu (cyclomatic 32) invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/GraphPreviewOpenAsMenu.tsx
  • Cyclomatic Complexity · ControlDerivationController.commitControlMap (cyclomatic 32) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/controlDerivationController.ts
  • Cyclomatic Complexity · controlPanelModel.deriveModel (cyclomatic 30) invokeai/frontend/webv2/src/workbench/widgets/layers/controlPanelModel.ts
  • Cyclomatic Complexity · ImageStorageSettings.ImageStorageEditor (cyclomatic 29) invokeai/frontend/webv2/src/workbench/settings/ImageStorageSettings.tsx
  • Cyclomatic Complexity · workingMemory.deriveCalibrationProgress (cyclomatic 28) invokeai/frontend/webv2/src/features/models/core/workingMemory.ts
  • Cyclomatic Complexity · CropLayerController.cropAll (cyclomatic 28) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/cropLayerController.ts
  • Cyclomatic Complexity · rasterComposite.renderRasterComposite (cyclomatic 28) invokeai/frontend/webv2/src/workbench/canvas-engine/render/rasterComposite.ts
  • Cyclomatic Complexity · Flux3DenoiseInvocation._run_diffusion (cyclomatic 27) invokeai/app/invocations/flux3/flux3_denoise.py
  • Cyclomatic Complexity · color.restore_lightness (cyclomatic 27) invokeai/backend/image_util/color.py
  • Cyclomatic Complexity · groupSurfaceCache.createGroupSurfaceCache.damagedRegion (cyclomatic 27) invokeai/frontend/webv2/src/workbench/canvas-engine/render/groupSurfaceCache.ts
  • Cyclomatic Complexity · CanvasHeaderActions.CanvasHeaderActionsInner (cyclomatic 26) invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasHeaderActions.tsx
  • Cyclomatic Complexity · canvasToolCommands.executeCanvasToolCommand (cyclomatic 26) invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasToolCommands.ts
  • Cyclomatic Complexity · LayerMutationController.convertToControl (cyclomatic 26) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/layerMutationController.ts
  • Cyclomatic Complexity · InstallStagingLedger._sweep_stale_claims_locked (cyclomatic 25) invokeai/app/services/model_install/install_staging_ledger.py
  • Cyclomatic Complexity · parseSchema.parseSchema.invocations (cyclomatic 25) invokeai/frontend/webv1/src/features/nodes/util/schema/parseSchema.ts
  • Cyclomatic Complexity · mock-working-memory.createWorkingMemoryMock.linesOf (cyclomatic 25) invokeai/frontend/webv2/scripts/mock-working-memory.mjs
  • Cyclomatic Complexity · installsStore.refreshInstalls (cyclomatic 25) invokeai/frontend/webv2/src/features/models/data/installsStore.ts
  • Cyclomatic Complexity · PreviewDetailsPanel.PreviewDetailsPanel (cyclomatic 25) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewDetailsPanel.tsx
  • Cyclomatic Complexity · CopyLayerController.copy (cyclomatic 25) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/copyLayerController.ts
  • Cyclomatic Complexity · ControlDetectionRow.ControlDetectionRow (cyclomatic 25) invokeai/frontend/webv2/src/workbench/widgets/layers/ControlDetectionRow.tsx
  • Cyclomatic Complexity · calibrate_flux3_denoise_working_memory._summarize_fit (cyclomatic 24) scripts/calibrate_flux3_denoise_working_memory.py
  • Cyclomatic Complexity · baseGenerationPolicies.getReferenceImageValidationIssues (cyclomatic 24) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts
  • Cyclomatic Complexity · RasterizeLayerController.rasterize (cyclomatic 24) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/rasterizeLayerController.ts
  • Cyclomatic Complexity · controlPanelModel.deriveDetection (cyclomatic 24) invokeai/frontend/webv2/src/workbench/widgets/layers/controlPanelModel.ts
  • Cyclomatic Complexity · nvfp4.find_nvfp4_layers (cyclomatic 23) invokeai/backend/quantization/nvfp4.py
  • Cyclomatic Complexity · build_shipped.main (cyclomatic 23) scripts/working_memory/build_shipped.py
  • Cyclomatic Complexity · GenerateProviderOptionsSection.GenerateProviderOptionsSection (cyclomatic 23) invokeai/frontend/webv2/src/features/generation/ui/GenerateProviderOptionsSection.tsx
  • Cyclomatic Complexity · alphaFill.propagateNearestVisibleLabels (cyclomatic 23) invokeai/frontend/webv2/src/workbench/canvas-engine/render/spatial/alphaFill.ts
  • Cyclomatic Complexity · ControlModelRow.ControlModelRow (cyclomatic 23) invokeai/frontend/webv2/src/workbench/widgets/layers/ControlModelRow.tsx
  • Cyclomatic Complexity · graphInputMedia.collectSubmissionInputMediaNames (cyclomatic 22) invokeai/frontend/webv2/src/features/queue/core/graphInputMedia.ts
  • Cyclomatic Complexity · controlModelResolution.resolveControlModel (cyclomatic 22) invokeai/frontend/webv2/src/workbench/controlModelResolution.ts
  • Cyclomatic Complexity · GalleryUiAdapter.GalleryUiAdapterProvider (cyclomatic 21) invokeai/frontend/webv2/src/app/GalleryUiAdapter.tsx
  • Cyclomatic Complexity · ExternalSizeSelect.ExternalSizeSelect (cyclomatic 21) invokeai/frontend/webv2/src/features/generation/ui/shared/ExternalSizeSelect.tsx
  • Cyclomatic Complexity · GenerateModelCard.GenerateModelCard (cyclomatic 21) invokeai/frontend/webv2/src/features/generation/ui/GenerateModelCard.tsx
  • Cyclomatic Complexity · loaders.parse_gguf_convrot_markers (cyclomatic 20) invokeai/backend/quantization/gguf/loaders.py
  • Cyclomatic Complexity · coefficients.resolve_coefficients (cyclomatic 20) invokeai/backend/working_memory/coefficients.py
  • Cyclomatic Complexity · fit.fit_points (cyclomatic 20) invokeai/backend/working_memory/fit.py
  • Cyclomatic Complexity · fit._lowest_rounded (cyclomatic 20) invokeai/backend/working_memory/fit.py
  • Cyclomatic Complexity · ReferenceImageControls.IPAdapterControls (cyclomatic 20) invokeai/frontend/webv2/src/features/generation/ui/reference-images/ReferenceImageControls.tsx
  • Cyclomatic Complexity · baseGenerationPolicies.getReferenceImageConfigSupported (cyclomatic 20) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts
  • Cyclomatic Complexity · QueueHeaderActions.InvocationCacheSection (cyclomatic 20) invokeai/frontend/webv2/src/features/queue/ui/QueueHeaderActions.tsx
  • Cyclomatic Complexity · CanvasColorFeed.ColorSampleRouting (cyclomatic 20) invokeai/frontend/webv2/src/workbench/widgets/canvas/color-system/CanvasColorFeed.tsx
  • Cyclomatic Complexity · StagingBar.StagingBar::handleKeyDown (cyclomatic 20) invokeai/frontend/webv2/src/workbench/widgets/canvas/StagingBar.tsx
  • Cyclomatic Complexity · controlSourceActions.sendGalleryImageAsControl (cyclomatic 20) invokeai/frontend/webv2/src/workbench/canvas-operations/controlSourceActions.ts
  • Cyclomatic Complexity · QueueCluster.QueueTooltip (cyclomatic 20) invokeai/frontend/webv2/src/workbench/shell/topbar/QueueCluster.tsx
  • Cyclomatic Complexity · calibrate_vae_tiling_working_memory._summarize (cyclomatic 19) scripts/calibrate_vae_tiling_working_memory.py
  • Cyclomatic Complexity · ConceptRow.ConceptRowContent (cyclomatic 19) invokeai/frontend/webv2/src/features/generation/ui/shared/ConceptRow.tsx
  • Cyclomatic Complexity · PromptTemplatesPanel.PromptTemplatesPanel (cyclomatic 19) invokeai/frontend/webv2/src/features/generation/ui/promptFields/PromptTemplatesPanel.tsx
  • Cyclomatic Complexity · WorkingMemorySection.OutcomePanel (cyclomatic 19) invokeai/frontend/webv2/src/features/models/ui/detail/WorkingMemorySection.tsx
  • Cyclomatic Complexity · WorkflowFieldInput.BoardInput (cyclomatic 19) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx
  • Cyclomatic Complexity · paintTool.createPaintTool.onPointerDown (cyclomatic 19) invokeai/frontend/webv2/src/workbench/canvas-engine/tools/paintTool.ts
  • Cyclomatic Complexity · CustomSettingsEditors.CustomSettingField (cyclomatic 19) invokeai/frontend/webv2/src/workbench/settings/CustomSettingsEditors.tsx
  • Cyclomatic Complexity · ModelInstallService._restart_remote_download (cyclomatic 18) invokeai/app/services/model_install/model_install_default.py
  • Cyclomatic Complexity · Krea2MemoryEfficientAttnProcessor.__call__ (cyclomatic 18) invokeai/backend/krea2/attention.py
  • Cyclomatic Complexity · layout._compile_draft_item (cyclomatic 18) invokeai/backend/moss_image/layout.py
  • Cyclomatic Complexity · int8_convrot.reject_unmarked_int8_weights (cyclomatic 18) invokeai/backend/quantization/int8_convrot.py
  • Cyclomatic Complexity · calibrate_z_image_working_memory._summarize_fit (cyclomatic 18) scripts/calibrate_z_image_working_memory.py
  • Cyclomatic Complexity · installsStore.handleModelInstallSocketEvent (cyclomatic 18) invokeai/frontend/webv2/src/features/models/data/installsStore.ts
  • Cyclomatic Complexity · clipboard.getBridgingConnectorIds (cyclomatic 18) invokeai/frontend/webv2/src/features/workflow/ui/editor/clipboard.ts
  • Cyclomatic Complexity · useCanvasGallerySave.useCanvasGallerySave.save (cyclomatic 18) invokeai/frontend/webv2/src/workbench/widgets/canvas/useCanvasGallerySave.ts
  • Cyclomatic Complexity · exportRasterComposite.exportRasterComposite (cyclomatic 18) invokeai/frontend/webv2/src/workbench/canvas-engine/exportRasterComposite.ts
  • Cyclomatic Complexity · prepareCanvasInvocation.runCanvasInvocation (cyclomatic 18) invokeai/frontend/webv2/src/workbench/widgets/canvas/invoke/prepareCanvasInvocation.ts
  • Cyclomatic Complexity · OrphanedModelsService.find_orphaned_models (cyclomatic 17) invokeai/app/services/orphaned_models/orphaned_models_service.py
  • Cyclomatic Complexity · WorkingMemoryCalibrationService._canceled_runs (cyclomatic 17) invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py
  • Cyclomatic Complexity · counted_dtypes.return_to_counted_dtypes (cyclomatic 17) invokeai/backend/model_manager/load/model_cache/counted_dtypes.py
  • Cyclomatic Complexity · attention._report_unpinned_call (cyclomatic 17) invokeai/backend/util/attention.py
  • Cyclomatic Complexity · ProbeScope.open_window (cyclomatic 17) invokeai/backend/working_memory/probe.py
  • Cyclomatic Complexity · calibrate_flux2_denoise_working_memory._summarize_fit (cyclomatic 17) scripts/calibrate_flux2_denoise_working_memory.py
  • Cyclomatic Complexity · build_shipped.build_points (cyclomatic 17) scripts/working_memory/build_shipped.py
  • Cyclomatic Complexity · addRegionalGuidance.getDraftRejectionReason (cyclomatic 17) invokeai/frontend/webv2/src/features/generation/core/canvas/addRegionalGuidance.ts
  • Cyclomatic Complexity · resolveGenerateWidgetValues.resolveGenerateWidgetValues (cyclomatic 17) invokeai/frontend/webv2/src/features/generation/core/resolveGenerateWidgetValues.ts
  • Cyclomatic Complexity · GenerateSettingsForm.GenerateSettingsForm (cyclomatic 17) invokeai/frontend/webv2/src/features/generation/ui/GenerateSettingsForm.tsx
  • Cyclomatic Complexity · WorkingMemorySection.WorkingMemorySection (cyclomatic 17) invokeai/frontend/webv2/src/features/models/ui/detail/WorkingMemorySection.tsx
  • Cyclomatic Complexity · queueMenuActions.useQueueActions (cyclomatic 17) invokeai/frontend/webv2/src/features/queue/ui/queueMenuActions.tsx
  • Cyclomatic Complexity · utilityGraph.submitUtilityGraph (cyclomatic 17) invokeai/frontend/webv2/src/features/queue/runtime/utilityGraph.ts
  • Cyclomatic Complexity · layerRowSummary.layerRowSummary (cyclomatic 17) invokeai/frontend/webv2/src/workbench/widgets/layers/layerRowSummary.ts
  • Cyclomatic Complexity · groupSurfaceCache.createGroupSurfaceCache.showSpatial (cyclomatic 17) invokeai/frontend/webv2/src/workbench/canvas-engine/render/groupSurfaceCache.ts
  • Cyclomatic Complexity · filterOperationSession.createFilterOperationSession.process (cyclomatic 17) invokeai/frontend/webv2/src/workbench/canvas-operations/filterOperationSession.ts
  • Cyclomatic Complexity · keys.eventToHotkeyString (cyclomatic 17) invokeai/frontend/webv2/src/workbench/hotkeys/keys.ts
  • Cyclomatic Complexity · invokeIssueActions.useInvokeIssueActions (cyclomatic 17) invokeai/frontend/webv2/src/workbench/shell/topbar/invokeIssueActions.ts
  • Cyclomatic Complexity · LayoutPresetStrip.LayoutPresetStrip (cyclomatic 17) invokeai/frontend/webv2/src/workbench/shell/topbar/LayoutPresetStrip.tsx
  • Cyclomatic Complexity · MossImageDenoiseInvocation._run_diffusion (cyclomatic 16) invokeai/app/invocations/moss_image/moss_image_denoise.py
  • Cyclomatic Complexity · gallery._conditions (cyclomatic 16) invokeai/app/services/shared/database/queries/gallery.py
  • Cyclomatic Complexity · WorkingMemoryCalibrationService._prepare_run (cyclomatic 16) invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py
  • Cyclomatic Complexity · WorkingMemoryCalibrationService._attempt_blocks (cyclomatic 16) invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py
  • Cyclomatic Complexity · WorkingMemoryCalibrationService._held_back (cyclomatic 16) invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py
  • Cyclomatic Complexity · ModelCache._load_locked_model (cyclomatic 16) invokeai/backend/model_manager/load/model_cache/model_cache.py

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

Fixed since the last survey: 7484 findings

These 7484 critical or serious findings were in the previous survey, on 20 October 2026, and are gone from this one. The first 100 are listed here.

  • Cyclomatic Complexity · workbenchState.__workbenchReducerInternal (cyclomatic 384) invokeai/frontend/webv2/src/workbench/workbenchState.ts
  • Cyclomatic Complexity · MergeLayerController.mergeSelected (cyclomatic 36) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts
  • Cyclomatic Complexity · GallerySettingField.GallerySettingField (cyclomatic 35) invokeai/frontend/webv2/src/features/gallery/ui/GallerySettingField.tsx
  • Cyclomatic Complexity · parseSchema.parseSchema (cyclomatic 27) invokeai/frontend/webv1/src/features/nodes/util/schema/parseSchema.ts
  • Cyclomatic Complexity · ModelInstallService._remove_stale_install_source_claims_locked (cyclomatic 25) invokeai/app/services/model_install/model_install_default.py
  • Cyclomatic Complexity · nvfp4._find_nvfp4_layers (cyclomatic 22) invokeai/backend/quantization/nvfp4.py
  • Cyclomatic Complexity · calibrate_flux2_working_memory.report_vae (cyclomatic 22) scripts/calibrate_flux2_working_memory.py
  • Cyclomatic Complexity · ZImageControlTransformer2DModel.forward (cyclomatic 20) invokeai/backend/z_image/z_image_control_transformer.py
  • Cyclomatic Complexity · FilterOperationCoordinator.createFilterOperationCoordinator.start (cyclomatic 20) invokeai/frontend/webv2/src/workbench/canvas-operations/FilterOperationCoordinator.ts
  • Cyclomatic Complexity · ModelInstallService._register_or_install (cyclomatic 19) invokeai/app/services/model_install/model_install_default.py
  • Cyclomatic Complexity · assetTransport.createAssetResponseReader (cyclomatic 19) invokeai/frontend/webv2/src/workbench/projects/invk/assetTransport.ts
  • Cyclomatic Complexity · projectAssets.createOpenProjectsHeldMediaReader (cyclomatic 19) invokeai/frontend/webv2/src/workbench/projects/projectAssets.ts
  • Cyclomatic Complexity · ModelInstallService.restart_failed (cyclomatic 18) invokeai/app/services/model_install/model_install_default.py
  • Cyclomatic Complexity · calibrate_flux2_working_memory.main (cyclomatic 18) scripts/calibrate_flux2_working_memory.py
  • Cyclomatic Complexity · forLoops.getForLoopBodyBoundaries (cyclomatic 18) invokeai/frontend/webv2/src/features/workflow/core/forLoops.ts
  • Cyclomatic Complexity · useMaskTintEditor.useMaskTintEditor (cyclomatic 18) invokeai/frontend/webv2/src/workbench/widgets/canvas/color-system/useMaskTintEditor.ts
  • Cyclomatic Complexity · z_image._convert_z_image_gguf_to_diffusers (cyclomatic 17) invokeai/backend/model_manager/load/model_loaders/z_image.py
  • Cyclomatic Complexity · QwenImagePiDDecodeInvocation.invoke (cyclomatic 16) invokeai/app/invocations/pid/qwen_image_pid_decode.py
  • Cyclomatic Complexity · ModelInstallService._resume_remote_download (cyclomatic 16) invokeai/app/services/model_install/model_install_default.py
  • Cyclomatic Complexity · HuggingFaceMetadataFetch.from_id (cyclomatic 16) invokeai/backend/model_manager/metadata/fetch/huggingface.py
  • Cyclomatic Complexity · calibrate_wan_vae_working_memory._measure (cyclomatic 16) scripts/calibrate_wan_vae_working_memory.py
  • Cyclomatic Complexity · promptAttention.selectTerminals (cyclomatic 16) invokeai/frontend/webv1/src/common/util/promptAttention.ts
  • Cyclomatic Complexity · GalleryImage.buildOnClick (cyclomatic 16) invokeai/frontend/webv1/src/features/gallery/components/ImageGrid/GalleryImage.tsx
  • Cyclomatic Complexity · InvocationCacheFooter.InvocationCacheFooter (cyclomatic 16) invokeai/frontend/webv2/src/features/queue/ui/InvocationCacheFooter.tsx
  • Cyclomatic Complexity · ImageMapDataRuntime.attachImageMapDataRuntime (cyclomatic 16) invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapDataRuntime.tsx
  • Cyclomatic Complexity · PreviewHeaderActions.PreviewHeaderActions (cyclomatic 16) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewHeaderActions.tsx
  • Cyclomatic Complexity · LayerMutationController.convert (cyclomatic 16) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/layerMutationController.ts
  • Cyclomatic Complexity · documentMirror.createDocumentMirror.refresh (cyclomatic 16) invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentMirror.ts
  • Cyclomatic Complexity · SelectObjectCoordinator.createSelectObjectOperationCoordinator.apply (cyclomatic 16) invokeai/frontend/webv2/src/workbench/canvas-operations/SelectObjectCoordinator.ts
  • Cyclomatic Complexity · videoRecall.getRecallableReferences (cyclomatic 16) invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts
  • Cognitive Complexity · workbenchState.__workbenchReducerInternal (cognitive 460) invokeai/frontend/webv2/src/workbench/workbenchState.ts
  • Cognitive Complexity · calibrate_flux2_working_memory.report_vae (cognitive 54) scripts/calibrate_flux2_working_memory.py
  • Cognitive Complexity · ModelInstallService._remove_stale_install_source_claims_locked (cognitive 46) invokeai/app/services/model_install/model_install_default.py
  • Cognitive Complexity · ZImageControlTransformer2DModel.forward (cognitive 33) invokeai/backend/z_image/z_image_control_transformer.py
  • Cognitive Complexity · GallerySettingField.GallerySettingField (cognitive 32) invokeai/frontend/webv2/src/features/gallery/ui/GallerySettingField.tsx
  • Cognitive Complexity · MergeLayerController.mergeSelected (cognitive 30) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts
  • Cognitive Complexity · calibrate_flux2_working_memory.report_denoise (cognitive 26) scripts/calibrate_flux2_working_memory.py
  • Cognitive Complexity · parseSchema.parseSchema (cognitive 26) invokeai/frontend/webv1/src/features/nodes/util/schema/parseSchema.ts
  • Cognitive Complexity · ModelInstallService._multifile_download (cognitive 25) invokeai/app/services/model_install/model_install_default.py
  • Cognitive Complexity · nvfp4._find_nvfp4_layers (cognitive 24) invokeai/backend/quantization/nvfp4.py
  • Cognitive Complexity · assetTransport.createAssetResponseReader (cognitive 24) invokeai/frontend/webv2/src/workbench/projects/invk/assetTransport.ts
  • Cognitive Complexity · onModelInstallError.buildOnModelInstallError (cognitive 23) invokeai/frontend/webv1/src/services/events/onModelInstallError.tsx
  • Cognitive Complexity · ModelInstallService._resume_remote_download (cognitive 22) invokeai/app/services/model_install/model_install_default.py
  • Cognitive Complexity · ModelInstallService._download_cancelled_callback (cognitive 22) invokeai/app/services/model_install/model_install_default.py
  • Cognitive Complexity · GalleryImage.buildOnClick (cognitive 22) invokeai/frontend/webv1/src/features/gallery/components/ImageGrid/GalleryImage.tsx
  • Cognitive Complexity · flux_bfl_peft_lora_conversion_utils._convert_bfl_layer_to_diffusers (cognitive 21) invokeai/backend/patches/lora_conversions/flux_bfl_peft_lora_conversion_utils.py
  • Cognitive Complexity · extract_metadata.extract_metadata (cognitive 20) invokeai/app/api/extract_metadata.py
  • Cognitive Complexity · ZImageControlTransformer2DModel.forward_control (cognitive 20) invokeai/backend/z_image/z_image_control_transformer.py
  • Cognitive Complexity · ZImageControlNetExtension.compute_hints (cognitive 20) invokeai/backend/z_image/z_image_controlnet_extension.py
  • Cognitive Complexity · z_image_controlnet_extension.z_image_forward_with_control (cognitive 20) invokeai/backend/z_image/z_image_controlnet_extension.py
  • Cognitive Complexity · InvocationCacheFooter.InvocationCacheFooter (cognitive 20) invokeai/frontend/webv2/src/features/queue/ui/InvocationCacheFooter.tsx
  • Cognitive Complexity · filterOperationSession.createFilterOperationSession.commit (cognitive 20) invokeai/frontend/webv2/src/workbench/canvas-operations/filterOperationSession.ts
  • Cognitive Complexity · videoRecall.getRecallableReferences (cognitive 20) invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts
  • Cognitive Complexity · useProjectActions.useProjectActions.closeProject (cognitive 20) invokeai/frontend/webv2/src/workbench/projects/useProjectActions.ts
  • Cognitive Complexity · QwenImagePiDDecodeInvocation.invoke (cognitive 19) invokeai/app/invocations/pid/qwen_image_pid_decode.py
  • Cognitive Complexity · OrphanedModelsService.delete_orphaned_models (cognitive 19) invokeai/app/services/orphaned_models/orphaned_models_service.py
  • Cognitive Complexity · ZImageControlCheckpointModel._load_control_adapter (cognitive 19) invokeai/backend/model_manager/load/model_loaders/z_image.py
  • Cognitive Complexity · GalleryVideoItem.buildOnClick (cognitive 19) invokeai/frontend/webv1/src/features/gallery/components/ImageGrid/GalleryVideoItem.tsx
  • Cognitive Complexity · forLoops.getForLoopBodyBoundaries (cognitive 19) invokeai/frontend/webv2/src/features/workflow/core/forLoops.ts
  • Cognitive Complexity · previewPublisher.createPreviewPublisher.decodePreview (cognitive 19) invokeai/frontend/webv2/src/workbench/canvas-engine/previewPublisher.ts
  • Cognitive Complexity · Flux2RefImageExtension._prepare_ref_images (cognitive 18) invokeai/backend/flux2/ref_image_extension.py
  • Cognitive Complexity · LTX2Gemma4EncoderModel._load_text_encoder (cognitive 18) invokeai/backend/model_manager/load/model_loaders/ltx2.py
  • Cognitive Complexity · calibrate_z_image_working_memory.report (cognitive 18) scripts/calibrate_z_image_working_memory.py
  • Cognitive Complexity · promptAttention.selectTerminals (cognitive 18) invokeai/frontend/webv1/src/common/util/promptAttention.ts
  • Cognitive Complexity · baseGenerationPolicies.getReferenceImageValidationReasons (cognitive 18) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts
  • Cognitive Complexity · ProjectWidgetView.DetailsSection (cognitive 18) invokeai/frontend/webv2/src/workbench/widgets/project/ProjectWidgetView.tsx
  • Cognitive Complexity · useMaskTintEditor.useMaskTintEditor (cognitive 18) invokeai/frontend/webv2/src/workbench/widgets/canvas/color-system/useMaskTintEditor.ts
  • Cognitive Complexity · ModelInstallService.restart_failed (cognitive 17) invokeai/app/services/model_install/model_install_default.py
  • Cognitive Complexity · HuggingFaceMetadata.download_urls (cognitive 17) invokeai/backend/model_manager/metadata/metadata_base.py
  • Cognitive Complexity · AddNodeCmdk.useAddNode (cognitive 17) invokeai/frontend/webv1/src/features/nodes/components/flow/AddNodeCmdk/AddNodeCmdk.tsx
  • Cognitive Complexity · baseGenerationPolicies.getModelFamilyValidationReasons (cognitive 17) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts
  • Cognitive Complexity · PreviewHeaderActions.PreviewHeaderActions (cognitive 17) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewHeaderActions.tsx
  • Cognitive Complexity · model_manager._reidentify_model (cognitive 16) invokeai/app/api/routers/model_manager.py
  • Cognitive Complexity · InstantXControlNetFlux.forward (cognitive 16) invokeai/backend/flux/controlnet/instantx_controlnet_flux.py
  • Cognitive Complexity · loaders.parse_q8_cr_markers (cognitive 16) invokeai/backend/quantization/gguf/loaders.py
  • Cognitive Complexity · baseGenerationPolicies.getGenerationModelAvailabilityReasons (cognitive 16) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts
  • Cognitive Complexity · runtime.createQueueRuntime.flushJournalRecords (cognitive 16) invokeai/frontend/webv2/src/features/queue/runtime.ts
  • Cognitive Complexity · editorSession.createEditorSessionProvider (cognitive 16) invokeai/frontend/webv2/src/workbench/projects/editorSession.ts
  • Cognitive Complexity · FilterOperationCoordinator.createFilterOperationCoordinator.start (cognitive 16) invokeai/frontend/webv2/src/workbench/canvas-operations/FilterOperationCoordinator.ts
  • Cognitive Complexity · InvokeButton.InvokeTooltipContent (cognitive 16) invokeai/frontend/webv2/src/workbench/shell/topbar/InvokeButton.tsx
  • God Classes · FunctionTooLong: WorkflowEditorView.WorkflowFlow invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowEditorView.tsx
  • God Classes · FunctionTooLong: usePreviewLoupe.usePreviewLoupe invokeai/frontend/webv2/src/workbench/widgets/preview/usePreviewLoupe.ts
  • God Classes · FunctionTooLong: GenerateAdvancedFields.GenerateAdvancedFields invokeai/frontend/webv2/src/features/generation/ui/GenerateAdvancedFields.tsx
  • God Classes · FunctionTooLong: GalleryMediaSlot.GalleryMediaSlot invokeai/frontend/webv2/src/features/gallery/ui/picker/GalleryMediaSlot.tsx
  • God Classes · FunctionTooLong: groupSurfaceCache.createGroupSurfaceCache invokeai/frontend/webv2/src/workbench/canvas-engine/render/groupSurfaceCache.ts
  • God Classes · FunctionTooLong: AdjustmentSettings.CurvesEditor invokeai/frontend/webv2/src/workbench/widgets/layers/AdjustmentSettings.tsx
  • God Classes · FunctionTooLong: CanvasHeaderActions.CanvasHeaderActionsInner invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasHeaderActions.tsx
  • God Classes · FunctionTooLong: GeneratePresetsPopover.GeneratePresetsPopover invokeai/frontend/webv2/src/features/generation/ui/GeneratePresetsPopover.tsx
  • God Classes · FunctionTooLong: EditorToolbar.EditorToolbar invokeai/frontend/webv2/src/features/workflow/ui/editor/EditorToolbar.tsx
  • God Classes · FunctionTooLong: LayoutPresetStrip.LayoutPresetStrip invokeai/frontend/webv2/src/workbench/shell/topbar/LayoutPresetStrip.tsx
  • God Classes · FunctionTooLong: WildcardsPanel.WildcardsPanel invokeai/frontend/webv2/src/features/generation/ui/promptFields/WildcardsPanel.tsx
  • God Classes · FunctionTooLong: GenerateReferenceImagesSection.GenerateReferenceImagesContent invokeai/frontend/webv2/src/features/generation/ui/reference-images/GenerateReferenceImagesSection.tsx
  • God Classes · FunctionTooLong: ListItem.ListItem invokeai/frontend/webv2/src/platform/ui/list/ListItem.tsx
  • God Classes · FunctionTooLong: PreviewCompare.PreviewCompare invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewCompare.tsx
  • God Classes · MethodTooLong: MergeLayerController.mergeSelected invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts
  • God Classes · FunctionTooLong: ColorPane.ColorPane invokeai/frontend/webv2/src/workbench/widgets/layers/panes/ColorPane.tsx
  • God Classes · FunctionTooLong: AddNodesView.AddNodesView invokeai/frontend/webv2/src/features/nodes/ui/add-nodes/AddNodesView.tsx
  • God Classes · FileTooLong: z_image/z_image_denoise.py invokeai/app/invocations/z_image/z_image_denoise.py
  • God Classes · FunctionTooLong: PreviewFilmstrip.FilmstripLiveThumb invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFilmstrip.tsx
  • God Classes · FunctionTooLong: LayoutPresetStrip.PresetTab invokeai/frontend/webv2/src/workbench/shell/topbar/LayoutPresetStrip.tsx
Rebuild cost: about €1,300,000 · Estimate
Cost to rebuild€420,000 to €2,100,000, for 7,059 to 22,394 hours of work, about 8.8 person-years for 5 to 17 engineers
Difficulty of the problemStandard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor×0.7 at a score of 42. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
SizeVery large: 734,441 lines of product code
What it is notNot a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.

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

Top priorities

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

1
Resolve the 2 No assertions (empty test) finding(s) in Test Quality — start with CanvasHeaderActions.browser.test.tsx, ClearSavedDataSettings.browser.test.tsx.
Raises the score by about 5 points · Low effort · Test Quality
2
Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.
Raises the score by about 5 points · Medium effort · Security & performance tooling
3
Resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion.
Raises the score by about 2 points · Low effort · Project Cohesion

Diagnosis: what the measurements show together

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

Where the investment is most exposed · Value at risk
This code would cost about €1,300,000 to build again, about 8.8 person-years of work. Its weakest lens is Production Readiness, at 33 (Weak). Production Readiness is about whether the product is ready to run in production and to change without breaking. Because the weakest lens counts most in the score, work on Production Readiness also moves the score most.
Based on: the rebuild estimate · the Production Readiness grade · how much each lens counts
What to do: Start with the Production Readiness actions in Top priorities.
If you do one thing first · First action
Resolve the 2 No assertions (empty test) finding(s) in Test Quality. Of all the actions in this report, it raises the score most for the work it takes: about 5 points for low effort, because it clears the 2 Test Quality findings. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 6.1 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 5% to 11% on every change. The history of the code shows how much it changes: about 1,318,281 lines over the last 90 days, which is about 5,346,362 lines a year. At that pace, the extra work comes to an estimated 643.6 to 3861.6 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.

Architecture: which parts of the code depend on which

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

2432 modules, with 4133 dependencies between them. 5 loops run through 24 of the modules, marked above the diagonal.

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

Which modules use which. The module on each row uses the module in each column, and the number counts the pairs of types that connect them. A cell above the diagonal is part of a loop.
uses →1 app.invocations.fields2 app.services.config.config_default3 app.services.invoker4 app.services.shared.database.database5 app.services.shared.database.queries6 backend.model_manager.model_on_disk7 backend.model_manager.taxonomy8 frontend.webv1.src.features.controlLayers.components.Filters.FilterAdjustImage9 frontend.webv2.src.features.generation.core.types10 frontend.webv2.src.features.generation.ui.promptFields11 frontend.webv2.src.features.models.core.types12 frontend.webv2.src.features.workflow.core.types13 frontend.webv2.src.platform.logging.contracts14 frontend.webv2.src.platform.state.accountLifecycle15 frontend.webv2.src.platform.ui16 frontend.webv2.src.workbench.canvas-engine.contracts17 frontend.webv2.src.workbench.canvas-engine.render.raster18 frontend.webv2.src.workbench.widgetContracts19 app.api.routers20 app.services.shared.invocation_context21 backend.model_manager.configs.base22 backend.model_manager.load.load_default23 frontend.webv1.src.features.controlLayers.konva.CanvasModuleBase24 frontend.webv2.src.features.generation.core.canvas.types25 frontend.webv2.src.features.generation.ui26 frontend.webv2.src.workbench.projectContracts27 app.invocations.baseinvocation28 frontend.webv1.src.features.controlLayers.konva.CanvasManager29 frontend.webv2.src.workbench30 frontend.webv2.src.workbench.canvas-engine.types31 frontend.webv2.src.workbench.projects32 app.invocations.model33 app.invocations.primitives34 frontend.webv2.src.workbench.canvas-engine.capabilities35 frontend.webv2.src.workbench.canvas-engine.render36 frontend.webv2.src.workbench.canvas-engine.tools.tool37 frontend.webv2.src.workbench.canvas-operations38 frontend.webv2.src.workbench.widgets.canvas39 frontend.webv2.src.workbench.widgets.layers40 frontend.webv2.src.workbench.canvas-engine
1 app.invocations.fields
2 app.services.config.config_default
3 app.services.invoker
4 app.services.shared.database.database
5 app.services.shared.database.queries
6 backend.model_manager.model_on_disk
7 backend.model_manager.taxonomy
8 frontend.webv1.src.features.controlLayers.components.Filters.FilterAdjustImage
9 frontend.webv2.src.features.generation.core.types
10 frontend.webv2.src.features.generation.ui.promptFields
11 frontend.webv2.src.features.models.core.types
12 frontend.webv2.src.features.workflow.core.types
13 frontend.webv2.src.platform.logging.contracts
14 frontend.webv2.src.platform.state.accountLifecycle
15 frontend.webv2.src.platform.ui
16 frontend.webv2.src.workbench.canvas-engine.contracts
17 frontend.webv2.src.workbench.canvas-engine.render.raster
18 frontend.webv2.src.workbench.widgetContracts
19 app.api.routers14
20 app.services.shared.invocation_context13
21 backend.model_manager.configs.base23
22 backend.model_manager.load.load_default1
23 frontend.webv1.src.features.controlLayers.konva.CanvasModuleBase11
24 frontend.webv2.src.features.generation.core.canvas.types2
25 frontend.webv2.src.features.generation.ui713
26 frontend.webv2.src.workbench.projectContracts14
27 app.invocations.baseinvocation1
28 frontend.webv1.src.features.controlLayers.konva.CanvasManager11
29 frontend.webv2.src.workbench26112423118
30 frontend.webv2.src.workbench.canvas-engine.types12
31 frontend.webv2.src.workbench.projects848
32 app.invocations.model121018
33 app.invocations.primitives291755
34 frontend.webv2.src.workbench.canvas-engine.capabilities1255
35 frontend.webv2.src.workbench.canvas-engine.render202499
36 frontend.webv2.src.workbench.canvas-engine.tools.tool1253
37 frontend.webv2.src.workbench.canvas-operations1325236
38 frontend.webv2.src.workbench.widgets.canvas722519
39 frontend.webv2.src.workbench.widgets.layers4261112
40 frontend.webv2.src.workbench.canvas-engine814351
Uses a module listed above itPart of a loopThe module itself
1 app.invocations.fields2 app.services.config.config_default3 app.services.invoker4 app.services.shared.database.database5 app.services.shared.database.queries6 backend.model_manager.model_on_disk7 backend.model_manager.taxonomy8 frontend.webv1.src.features.controlLayers.components.Filters.FilterAdjustImage9 frontend.webv2.src.features.generation.core.types10 frontend.webv2.src.features.generation.ui.promptFields11 frontend.webv2.src.features.models.core.types12 frontend.webv2.src.features.workflow.core.types13 frontend.webv2.src.platform.logging.contracts14 frontend.webv2.src.platform.state.accountLifecycle15 frontend.webv2.src.platform.ui16 frontend.webv2.src.workbench.canvas-engine.contracts17 frontend.webv2.src.workbench.canvas-engine.render.raster18 frontend.webv2.src.workbench.widgetContracts19 app.api.routers20 app.services.shared.invocation_context21 backend.model_manager.configs.base22 backend.model_manager.load.load_default23 frontend.webv1.src.features.controlLayers.konva.CanvasModuleBase24 frontend.webv2.src.features.generation.core.canvas.types25 frontend.webv2.src.features.generation.ui26 frontend.webv2.src.workbench.projectContracts27 app.invocations.baseinvocation28 frontend.webv1.src.features.controlLayers.konva.CanvasManager29 frontend.webv2.src.workbench30 frontend.webv2.src.workbench.canvas-engine.types31 frontend.webv2.src.workbench.projects32 app.invocations.model33 app.invocations.primitives34 frontend.webv2.src.workbench.canvas-engine.capabilities35 frontend.webv2.src.workbench.canvas-engine.render36 frontend.webv2.src.workbench.canvas-engine.tools.tool37 frontend.webv2.src.workbench.canvas-operations38 frontend.webv2.src.workbench.widgets.canvas39 frontend.webv2.src.workbench.widgets.layers40 frontend.webv2.src.workbench.canvas-engineapp.invocations.fields1app.services.config.config_default2app.services.invoker3app.services.shared.database.database4app.services.shared.database.queries5backend.model_manager.model_on_disk6backend.model_manager.taxonomy7frontend.webv1.src.features.controlLayers.components.Filters.FilterAdjustImage8frontend.webv2.src.features.generation.core.types9frontend.webv2.src.features.generation.ui.promptFields10frontend.webv2.src.features.models.core.types11frontend.webv2.src.features.workflow.core.types12frontend.webv2.src.platform.logging.contracts13frontend.webv2.src.platform.state.accountLifecycle14frontend.webv2.src.platform.ui15frontend.webv2.src.workbench.canvas-engine.contracts16frontend.webv2.src.workbench.canvas-engine.render.raster17frontend.webv2.src.workbench.widgetContracts18app.api.routers19app.services.shared.invocation_context20backend.model_manager.configs.base21backend.model_manager.load.load_default22frontend.webv1.src.features.controlLayers.konva.CanvasModuleBase23frontend.webv2.src.features.generation.core.canvas.types24frontend.webv2.src.features.generation.ui25frontend.webv2.src.workbench.projectContracts26app.invocations.baseinvocation27frontend.webv1.src.features.controlLayers.konva.CanvasManager28frontend.webv2.src.workbench29frontend.webv2.src.workbench.canvas-engine.types30frontend.webv2.src.workbench.projects31app.invocations.model32app.invocations.primitives33frontend.webv2.src.workbench.canvas-engine.capabilities34frontend.webv2.src.workbench.canvas-engine.render35frontend.webv2.src.workbench.canvas-engine.tools.tool36frontend.webv2.src.workbench.canvas-operations37frontend.webv2.src.workbench.widgets.canvas38frontend.webv2.src.workbench.widgets.layers39frontend.webv2.src.workbench.canvas-engine4014132311127131411126112423118128481210182917551255202499125313252367225194261112814351+2392 more modules (most-connected shown)

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

At a glance — Architecture · 47% · Weak · gated by D26, R9, AX7 ·

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

At a glance — Readiness · 33% · Weak · gated by D12, P3, P7, P8 ·

At a glance — Security · 70% · Adequate · gated by D29 ·

At a glance — Accessibility · 44% · Weak · gated by AC2, AC4 ·

At a glance — Performance · 85% · Strong ·

Security & Compliance — OWASP Top-10 mapping

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

OWASP categoryFindingsSeverity
A05:2025 — Injection48High / Critical
A03:2025 — Software Supply Chain Failures17High / Critical
A02:2025 — Security Misconfiguration3Medium
A07:2025 — Authentication Failures2High / Critical

Roadmap

Top priorities: Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing; Resolve the 2 No assertions (empty test) finding(s) in Test Quality — start with CanvasHeaderActions.browser.test.tsx, ClearSavedDataSettings.browser.test.tsx; Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.

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

Do thisHelpsEffortDimension
Resolve the 2 No assertions (empty test) finding(s) in Test Quality — start with CanvasHeaderActions.browser.test.tsx, ClearSavedDataSettings.browser.test.tsx.+4.6 ptsLowTest Quality
Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.+5.2 ptsMediumSecurity & performance tooling
Resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion.+2.2 ptsLowProject Cohesion
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.+2.6 ptsMediumKeyboard semantics
Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.+2.2 ptsMediumForms & labels
Break each cycle by extracting the shared piece into a module both sides can import.+2.2 ptsMediumCircular Imports
Pass `timeout=` on every `requests`/`httpx` call (requests has no default and will wait forever), mount an `HTTPAdapter(max_retries=Retry(...))` on shared sessions, and wrap calls to flaky dependencies in `tenacity` retries or a `pybreaker` circuit breaker.+2.1 ptsMediumOutbound HTTP resilience
Replace SQLAlchemy create_all() with Alembic (`alembic revision --autogenerate` + `alembic upgrade head`) so the production schema can evolve safely and reproducibly.+2.1 ptsMediumSchema migrations

File quality

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

FileScoreBandWorst signal
REDACTED2.7SlopDependency Vulnerabilities: High CVE: REDACTED
REDACTED3.2SlopStatic Analysis (SAST): High: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.5MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.6MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.8MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.0MixedStatic Analysis (SAST): Medium: REDACTED
invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasHeaderActions.browser.test.tsx5.0MixedTest Quality: No assertions (empty test): drops a destination answered for the project that was open before a switch
REDACTED5.1MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.1MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.3MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED5.3MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED5.3MixedStatic Analysis (SAST): Medium: REDACTED
invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts5.5MixedCyclomatic Complexity: videoPolicies.getVideoValidationReasons (cyclomatic 96)
invokeai/frontend/webv2/src/features/video/ui/VideoReferenceListField.tsx5.5MixedCyclomatic Complexity: VideoReferenceListField.VideoReferenceListField (cyclomatic 50)
invokeai/frontend/webv2/src/features/gallery/ui/galleryStateView.ts5.7MixedCyclomatic Complexity: galleryStateView.getGallerySelectedImageQuery (cyclomatic 24)
invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts5.7MixedCyclomatic Complexity: engine.createCanvasEngine::getDuplicateRasterPlan (cyclomatic 19)
REDACTED5.8MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.8MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.8MixedDependency Vulnerabilities: Medium CVE: REDACTED

How the grades work

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

Critical — 64

A definite problem that already costs you something and drags the score down: a missing authorisation check, a dependency with a known exploit, a build that does not reproduce. Failure here tends to cause failures elsewhere.

Serious — 4327

Likely wrong, but not failing yet. It degrades the codebase over a longer horizon and can cause failures elsewhere — not urgent this week, not something to carry for two years either.

Minor — 912

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

Could not be resolved — 11

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

Methodology & how to trust this report

This survey is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. All 91 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 0.9, the weighted average across measured dimensions.

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

What we checked — 91 dimensions across the health lenses
D1D2D3D4D5D6D9D10D12D13D14D15D16D17D19D20D21D24D26D28D29D30D31D34D35D36D37D43D44AC1AC2AC3AC4AC5AC6AC7AX10AX2AX3AX5AX6AX7C2C4GD1IC1M1M2M3M4P1P10P2P3P4P6P7P8PF3R1R10R2R3R4R6R7R8R9X1X12X13X14X15X16X17X18X19X2X21X22X23X24X25X26X27X28X29X3X30X4X5

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

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

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

Tools & methods

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

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

Every finding is locatable in findings.md. Run 01a1a68a-96b3-79df-aa64-5ad9b359c9c3.

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

Run transparency — what happened this run

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

  • D8 Code Coverage — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT MEASURED: this repository's production source spans .ts, .tsx, .py, and our analyzer cannot run the .py test suite(s) — so no coverage was collected for the repository as a whole. The JavaScript/TypeScript half did build and run, and its own line coverage came back at 97.8% — but that is a figure for one half of the product, and we do not publish a partial one as if it were complete. This is OUR limitation, not a defect in the repo — coverage is excluded from the score rather than counted as a near-zero. In the meantime, produce a coverage report in a standard format (lcov — `vitest --coverage`, `jest --coverage`, `bun test --coverage --coverage-reporter=lcov`, or `nyc`, or `coverage run -m pytest` then `coverage xml`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures and real coverage will be read. You can widen what we reach: optional: produce a coverage report in a standard format (`coverage run -m pytest` then `coverage xml`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures — then both halves are read on the next scan.
  • D10 Test Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 16,273 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 1,041 test source file(s) (.py) that it cannot: it reads JavaScript/TypeScript test declarations off disk, so a JUnit/pytest-style suite is invisible to it. Skipped tests, zero-assertion tests and the other quality signals on this row are UNMEASURED in that suite — their absence from the counts above is a gap in this analyzer's language coverage, not a finding that those tests are sound.
  • D11 Test Reliability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability not included — the JavaScript/TypeScript suite (node:test via `pnpm install --frozen-lockfile --ignore-scripts` in docs/ (16 tests); node:test via `pnpm install --frozen-lockfile --ignore-scripts` in invokeai/frontend/api/ (2 tests); vitest via `pnpm install --frozen-lockfile --ignore-scripts` in invokeai/frontend/webv1/; vitest via `pnpm install --frozen-lockfile --ignore-scripts` in invokeai/frontend/webv2/ (12443 tests)) did not finish re-running within its budget: too large to re-run within its budget.
  • D14 License Compliance — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares package.json, but the licence verdict published here was taken over its Python distribution dependencies. Nothing was read about its npm dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
  • D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
  • D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This kind did not reach the 95 % precision gate in three adjudicated runs (docs/plans/deterministic-engine/adjudication/D19-sample3-v3.md), so by the pre-registered fallback it publishes no row until a re-measurement shows it does. The candidates are counted here, not reported as findings, and the score does not include them.
  • D21 Naming Consistency — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. D21's deterministic naming rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. Until then its declarations carry no naming verdict this run — this says nothing about whether its names are consistent.
  • D21 Naming Consistency — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
  • D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22 identifies the intentionally-exposed surface from `IsPackable` and `.Contracts` project names, MSBuild conventions read off the loaded project set. This target exposed no such projects, so the probe never ran; this says nothing about whether the repository has a public API. This repository commits no C#/VB source at all, so there was never an MSBuild project set to read these conventions off. That is OUR side and it is an ADMISSION gap, not an environment fault: it declares a published package (REDACTED), but no published-package marker D22 reads admitted any project here. D22 DOES collect the public API of every language in this tree, and admits a project only when its manifest makes that ecosystem's publication act in a form the marker recognises — so what is missing is not a collector but an admission rule for the publication act this repository makes, if it makes one. The remedy is a better discriminator for that marker — not a collector, and no change to the scan image can close it. The marker's rules are measured to refuse applications, so one refused repository is the rule working as calibrated; several are the evidence that it is too strict. For npm the surface is what a published package.json's entry points (exports, main, module, types) export, followed through the source; an entry that names build output the tree does not commit (dist/, build/) is not followed back to source, because only a tsconfig outDir/rootDir pair states that mapping and a bundler's input lives in executable configuration this engine does not evaluate.
  • D24 Comment Value — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each source language's comment syntax, and the code a comment annotates in it, needs its own proof before D24 judges it. Until then those comments are left unread, not counted as clean.
  • D27 Navigability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover the language this repository's product is written in, so it had nothing of the product to read. That is a gap in this analyzer's language reach — not a finding about this repository.
  • D31 IaC & Container Security — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Checkov ran but its report could not be read (checkov produced no output — not a clean result). Every misconfiguration only checkov reports — most of its Terraform, CloudFormation, Bicep and Ansible policies — is absent from this card, so its absence here is not evidence those resources are configured correctly.
  • D32 Data Compliance (PII/GDPR) — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `docs/src/config/head.ts`, `invokeai/frontend/webv1/src/app/hooks/useSyncFaviconQueueStatus.ts`, `invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx`, `invokeai/frontend/webv1/src/common/hooks/useAsyncState.ts`, `invokeai/frontend/webv1/src/common/hooks/useImageUploadButton.tsx`, … (+129 more) produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
  • AC2 Forms & labels — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 161 further occurrence(s) are not listed individually; the score already reflects all 201.
  • AX1 Captive dependencies — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads Microsoft.Extensions.DependencyInjection registrations in C# and Spring beans in Java/Kotlin only, and this repository defines its own container in invokeai/frontend/webv2/src/workbench/diagnostics/DiagnosticsPanel.tsx, whose lifetimes are not modelled yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • AX7 Slice cohesion — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 2027 further occurrence(s) are not listed individually; the score already reflects all 2067.
  • AXR1 Runtime accessibility — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Render strategy: boot via DockerCompose (docker/docker-compose.yml). compose up failed (exit 14 — a file the compose project references is missing) — time="2026-11-04T12:34:49Z" level=warning msg="The \"RENDER_GROUP_ID\" variable is not set. Defaulting to a blank string." env file docker/.env not found: stat docker/.env: no such file or directory; runtime evidence skipped.
  • C1 Data Protection — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
  • M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
  • R10 Code Duplication — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 1596 further occurrence(s) are not listed individually; the score already reflects all 1636.
  • R3 Large Files — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 204 further occurrence(s) are not listed individually; the score already reflects all 244.
  • R4 Test Coverage — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 939 further occurrence(s) are not listed individually; the score already reflects all 979.
  • R7 Dead Code — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 39 further occurrence(s) are not listed individually; the score already reflects all 79.
  • S1 Web-Security Posture — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.
  • X3 Exception handling — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 232 further occurrence(s) are not listed individually; the score already reflects all 272.
  • X4 Structured logging — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 260 further occurrence(s) are not listed individually; the score already reflects all 300.

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

Limitations & what we did not check

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

Per-dimension blind spots

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

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
  • D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
  • D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
  • D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
  • D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
  • D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
  • D13 REDACTED Scanning: REDACTED detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
  • D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
  • D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
  • D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
  • D19 Documentation Quality: Documentation quality publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
  • D20 ADR Quality: ADR quality checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
  • D21 Naming Consistency: Naming consistency compares each name with the convention its structural peers follow in this repository: it cannot tell whether a consistently used name is a good one, and languages other than C# and TypeScript are not measured.
  • D24 Comment Value: Comment value is measured as redundancy only: a comment that repeats its code's words is found, but a paraphrase in other words, a vague comment, or one the code contradicts is not, and whether a comment is valuable is not claimed. Comments in other scripts or languages, and outside C#, are not judged.
  • D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
  • D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
  • D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
  • D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned REDACTED, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
  • D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules — it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
  • D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
  • D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
  • D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
  • D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a REDACTED (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
  • AC1 Text alternatives: Alt-text is detected structurally — the scan sees that an alternative EXISTS, not whether it meaningfully describes the image, and decorative-vs-missing is judged by attribute shape; runtime-injected images and a non-role=img decorative svg are out of scope. This is accessibility readiness, never a WCAG conformance claim.
  • AC2 Forms & labels: Label association is read from static markup — a label wired up at runtime (JS-set aria-labelledby, framework-injected ids) reads as missing, a present label says nothing about whether its text is correct. A known UI-library field component (e.g. a JSX <TextField>) is now checked conservatively — flagged only when it carries NO label/aria-label/aria-labelledby/id/name — but wrapper/context-labelled libraries (Chakra/Radix FormControl+FormLabel) aren't statically visible (possible false positive) and non-JSX lowercased components are still skipped. A click handler on a plain element is now asked for a name too (it is a control the author declared), but the subtree test that answers it is deliberately generous: any DYNAMIC text expression in the subtree counts as a name, so an icon chosen by a ternary ({cond ? <IconA/> : <IconB/>}) reads as named, and a glyph component from a library the icon-import list does not know still names its parent. A clean result is "no unlabelled control found", not a labelling proof.
  • AC3 Page structure: Page structure is read from the static markup tree — landmarks, headings and lang injected at runtime aren't seen, heading ORDER is checked structurally (not against the rendered visual hierarchy), and lang/title/main fire only on full documents, never partials, and the data-table check sees header-cell presence (a <th> exists), not whether each header correctly associates with its cells. Static readiness, not conformance.
  • AC4 Keyboard semantics: Keyboard semantics are inferred from markup attributes — interactivity wired purely in script, focus managed at runtime, and component-level handlers are invisible. A clean result means "no static keyboard-trap shape", not a keyboard-operability proof.
  • AC5 ARIA correctness: ARIA correctness is checked against the static role/attribute shape — roles/attributes set dynamically aren't seen, a valid role says nothing about whether it matches the element's real behaviour, and required-state checks are suppressed when a JSX spread could supply them. The two-branch toggle check (a control whose state is conveyed only by which of two mutually exclusive branches renders) reads CONDITIONALS THAT ARE ATTRIBUTES — Vue v-if/v-else/v-show and Alpine x-if/x-show — so the same toggle written as a Svelte {#if} block or a JSX ternary is control flow the markup model never projects as a branch and is not seen at all.
  • AC6 Visual & motion safety: Contrast and motion safety are PARTIAL by construction — literal colours (hex/rgb/hsl/named) in inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS top-level declarations are read (same-rule/same-element colour+background pairs only); computed/runtime/theme colour, external-CDN stylesheets, CSS-in-JS dynamic (${…}) and nested-selector colours, cross-element pairs and image contrast stay out of reach, so a clean result is bounded by what the static CSS itself shows.
  • AC7 A11y enforcement: Enforcement is scored from in-repo config/CI evidence only — an a11y gate enforced in external tooling with no in-repo trace can't be credited, and a configured linter is presence, not proof the rules actually run or block a merge.
  • AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
  • C4 Data Retention: This control is scored from in-repo evidence only — its real-world effectiveness, exercised only at runtime, is outside a static scan.
  • M4 Documentation accuracy: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
  • P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
  • P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.

Dimensions

D1 · Cyclomatic Complexity2.6 / 10Weak✓ Tool-verified

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

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

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

825 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was mock-backend.startMockBackend.server at 638. A further 24 method(s) were over the threshold but excluded as flat dispatchers (a long switch/match over independent cases: many branches, almost no nesting), the largest being videoComparators.areVideoValuesEqual at 46 — they are counted neither in the figure above nor in this dimension's score. 6 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold methods was excluded, so the exclusion is disclosed nowhere in the file itself: invokeai/frontend/webv2/src/features/video/ui/videoComparators.ts (videoComparators.areVideoValuesEqual at 46), invokeai/frontend/webv1/src/features/queue/hooks/useEnqueueCanvas.ts (useEnqueueCanvas.enqueueCanvas at 22), invokeai/frontend/webv1/src/features/queue/hooks/useEnqueueGenerate.ts (useEnqueueGenerate.enqueueGenerate at 22), invokeai/frontend/webv2/src/features/queue/data/submissionApi.ts (submissionApi.mapEnqueueResult at 21), invokeai/frontend/webv1/src/features/parameters/util/optimalDimension.ts (optimalDimension.getGridSize at 17), and 1 more not listed here. They are named here because the per-file figures other dimensions report are taken BEFORE this exclusion, so such a file can show a high maximum complexity elsewhere in this report and nothing here, with nothing to reconcile the two.

durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject (cyclomatic 31) · ×5invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:1372
promptAST.parseTokens::tryParseUnquotedPromptFunction (cyclomatic 24) · ×3invokeai/frontend/webv1/src/common/util/promptAST.ts:535
forLoops.validateForLoopGraph::getSupportedNestedForBody (cyclomatic 59) · ×2invokeai/frontend/webv2/src/features/workflow/core/forLoops.ts:414
documentModel.createDocumentModel::checkReparent (cyclomatic 23) · ×2invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts:832
mock-backend.startMockBackend.server (cyclomatic 638)invokeai/frontend/webv2/scripts/mock-backend.mjs:1169

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

What to do

  1. Bring the 3 bodies over 240 down to 240 or less in Cyclomatic Complexity — start with mock-backend.startMockBackend.server (cyclomatic 638), workbenchState.reduceWorkbenchAction (cyclomatic 412), GalleryImageGrid.GalleryImageGrid (cyclomatic 318). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 3 together lifts Cyclomatic Complexity from 2.6 to about 4.0/10, projected with the scoring formula itself and assuming each lands exactly at 240; a cleaner split scores higher.
  2. Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

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

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

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

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

1102 method(s) exceeded the cognitive complexity threshold of 15; the worst was mock-backend.startMockBackend.server at 1107.

durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject (cognitive 73) · ×6invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:1372
promptAST.parseTokens::tryParseUnquotedPromptFunction (cognitive 48) · ×4invokeai/frontend/webv1/src/common/util/promptAST.ts:535
documentModel.createDocumentModel::prepareReorder (cognitive 26) · ×4invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts:734
forLoops.validateForLoopGraph::getSupportedNestedForBody (cognitive 76) · ×2invokeai/frontend/webv2/src/features/workflow/core/forLoops.ts:414
onInvocationComplete.buildOnInvocationComplete::addImagesToGallery (cognitive 21) · ×2invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:117

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

What to do

  1. Bring the 22 bodies over 120 down to 120 or less in Cognitive Complexity — start with mock-backend.startMockBackend.server (cognitive 1107), modelSelected.addModelSelectedListener (cognitive 565), workbenchState.reduceWorkbenchAction (cognitive 488). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 22 together lifts Cognitive Complexity from 2.0 to about 4.0/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.
  2. Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D3 · God Classes6.8 / 10Adequate✓ Tool-verified

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

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

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

597 god class(es) detected.

FunctionTooLong: engine.createCanvasEngine · ×362invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts:353
FileTooLong: workbench/workbenchState.ts · ×183invokeai/frontend/webv2/src/workbench/workbenchState.ts
TooManyMethods: ModelInstallService · ×21invokeai/app/services/model_install/model_install_default.py:235
ClassTooLong: GalleryImageGrid · ×16invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx:1
MethodTooLong: MergeLayerController.mergeDown · ×15invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:186

What to do

  1. Resolve the 362 FunctionTooLong finding(s) in God Classes — start with graph.ts (5), workbenchState.ts (3), runtime.ts (3). — One of this dimension's main actionable groups (362 warning-level).
  2. Resolve the 183 FileTooLong finding(s) in God Classes — start with graph.ts (3), settings.ts (3), types.ts (2). — One of this dimension's main actionable groups (183 warning-level).
  3. Resolve the 21 TooManyMethods finding(s) in God Classes — start with model_install_default.py, session_queue_default.py, graph_materializer.py. — One of this dimension's main actionable groups (21 warning-level).
  4. Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D4 · Code Duplication9.7 / 10Stronggated by 505 serious findings✓ Tool-verified

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

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

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

471 duplicated block group(s) detected. A further 34 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. Measured on part of this repository only: .ts, .tsx (65% of production source) was not exposed to THIS dimension's token comparison and is not in this count; duplication there is measured by R10 Code Duplication, the frontend lens's card running the same clone algorithm over the JS/TS token stream.

Duplicated block (7 lines × 2) · ×31invokeai/app/api/routers/utilities.py:213
Duplicated block (6 lines × 2) · ×31invokeai/app/api/routers/model_manager.py:843
Duplicated block (5 lines × 2) · ×28invokeai/app/api/routers/utilities.py:532
Duplicated block (11 lines × 2) · ×22invokeai/app/api/routers/system_prompts.py:83
Duplicated block (9 lines × 2) · ×21invokeai/app/invocations/anima/anima_denoise.py:967

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

What to do

  1. Resolve the 31 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with pixeldit_official.py (3), model.py (2), flux.py (2). — One of this dimension's main actionable groups (31 warning-level).
  2. Resolve the 31 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with graph.py (3), images.py (2), user_management.py (2). — One of this dimension's main actionable groups (31 warning-level).
  3. Resolve the 28 Duplicated block (5 lines × 2) finding(s) in Code Duplication — start with child.py (3), color_conversion.py (3), utilities.py (2). — One of this dimension's main actionable groups (28 warning-level).
  4. Enforce Code Duplication in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

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

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

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

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

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

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

4 production modules (npm+Python), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; 0 module(s) off the main sequence, with abstractness counted on 3 of the 4 (the rest declare no modelled class or interface, export only macros, declare types in source no model reads, or have no source directory of their own).

✓ On the Gold path — maintain.

Detailed fixes: d5_recommendation.md.

D6 · Cohesion (LCOM4)10.0 / 10Stronggated by 1 serious finding✓ Tool-verified

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

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

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

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

1 of 488 classes have LCOM4 above 3.

Low cohesion: PixelDiTModel (LCOM4 4)invokeai/backend/pid/_src/models/pixeldit_model.py:119

What to do

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

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

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

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

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

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

27925 test methods: 27925 unit, 0 integration, 0 BDD, 0 e2e. The JavaScript/TypeScript suite contributes 16273 `it`/`test` case(s) across 1305 test file(s) declaring at least one; its tier split is read from package names and paths only. The Python suite contributes 11652 test function(s) across 910 file(s) declaring at least one — every `def test…` in a file pytest or unittest would collect, which is those frameworks' own definition of a case; a parametrize table counts once, so this is a floor. Its tier split is read from file names and paths only.

✓ On the Gold path — maintain.

Detailed fixes: d9_recommendation.md.

D10 · Test Quality9.9 / 10Adequategated by 2 critical findings✓ Tool-verified

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

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

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

3 skipped (3 with a documented reason), 133 zero-assertion, 2 synchronised by a fixed sleep, no mocking-framework packages referenced (hand-written doubles or no mocking) across 16273 tests. Measured on the JavaScript/TypeScript suite only — at least 1,041 test source file(s) (.py) went unread, so its test quality is unmeasured and is not in these counts.

No assertions (empty test): drops a destination answered for the project that was open before a switch · ×2invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasHeaderActions.browser.test.tsx:590
No assertions: keeps a meaningful settings route when all global bindings are unassigned · ×131invokeai/frontend/webv2/src/workbench/widgets/shortcuts/ShortcutGuide.browser.test.tsx:247
Fixed-sleep synchronisation: extracts through a live unflushed mask whose contract bitmap is still null · ×2invokeai/frontend/webv2/src/workbench/canvas-engine/engine.mask.test.ts:565
Mock-dominated test: reads the board listing alongside generator resolution and dispatches only once both have answered · ×193invokeai/frontend/webv2/src/workbench/invocationSubmit.test.ts:226
Skipped (documented): (unnamed test) · ×3invokeai/frontend/webv2/src/workbench/canvas-engine/render/golden/compositeGolden.browser.test.ts:243

What to do

  1. Resolve the 2 No assertions (empty test) finding(s) in Test Quality — start with CanvasHeaderActions.browser.test.tsx, ClearSavedDataSettings.browser.test.tsx. — One of this dimension's main actionable groups (2 issue-level).
  2. Resolve the 131 No assertions finding(s) in Test Quality — start with PreferencesPage.browser.test.tsx (10), CanvasHeaderActions.browser.test.tsx (9), compositeGolden.browser.test.ts (9). — One of this dimension's main actionable groups (131 warning-level).
  3. Resolve the 2 Fixed-sleep synchronisation finding(s) in Test Quality — start with engine.mask.test.ts, webLocks.browser.test.ts. — One of this dimension's main actionable groups (2 warning-level).
  4. Enforce Test Quality in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D12 · Dependency Hygiene10.0 1.7 / 10Critical✓ Tool-verified

What it measures: Whether dependencies are current, not deprecated, and not bloated. Known vulnerabilities are D30's.

Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (capped-linear for deprecation, prerelease and outdated) per KLoC. Known-vulnerable packages are D30's and are not charged here (rubric-2026.11.2). Exhaustive.

Maturity: Documented → Verified → Prevented · effective 1.7 / 10 · rule-coverage 17% · ceiling Verified

0 outdated, 0 yanked pinned Python distributions. 1 of 6 shipped distributions were graded against pypi.org (0 not published there, 5 declared without an exact pin, which installs the newest release the declaration admits and so cannot be behind one). Only EXACT pins are graded for currency: a floor or a range already installs the newest release it admits, so reporting one would report this repository for being current. Whether a deliberate upper cap has itself gone stale is a different and weaker question, and is not asked. Whether any distribution is UNMAINTAINED is not graded — PyPI publishes no maintenance status, and release age does not stand in for one. Lockfiles are not read (poetry.lock, REDACTED, Pipfile.lock, pdm.lock), so a lock-resolved install is outside this verdict. Known CVEs in this dependency graph are D30's question.

What to do

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

Detailed fixes: d12_recommendation.md.

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

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

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

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

REDACTED scan ran and found no leaked secrets.

✓ On the Gold path — maintain.

Detailed fixes: d13_recommendation.md.

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d14_recommendation.md.

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

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

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

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

Top hotspots: invokeai/frontend/webv2/src/workbench/workbenchState.ts (113×412=46556); invokeai/frontend/webv2/scripts/mock-backend.mjs (37×638=23606); invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts (58×312=18096) Repeated repair below the complexity floor: invokeai/backend/util/vae_working_memory.py (17 of 33 changes were fixes); invokeai/app/services/shared/invocation_context.py (13 of 24 changes were fixes); invokeai/backend/quantization/fp8_scaled.py (12 of 19 changes were fixes)

Hotspot: invokeai/frontend/webv2/src/workbench/workbenchState.ts · ×380invokeai/frontend/webv2/src/workbench/workbenchState.ts:4424
Repeated repair: invokeai/backend/util/vae_working_memory.py · ×63invokeai/backend/util/vae_working_memory.py:561

What to do

  1. Resolve the 380 Hotspot finding(s) in Churn × Complexity Hotspots — start with settings.ts (4), denoise.py (3), graph.ts (2). — One of this dimension's main actionable groups (380 warning-level).
  2. Resolve the 63 Repeated repair finding(s) in Churn × Complexity Hotspots — start with rocm_causal_conv3d.py (2), vae_working_memory.py, invocation_context.py. — One of this dimension's main actionable groups (63 warning-level).

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

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

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

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

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

954 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is invokeai/app/services/shared/graph.py. Counted over 2603 of the 4775 production source files in this repository: 2137 are under the ~2,400-byte size floor this dimension measures over, and the remaining 35 have no attributable history left to measure.

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

What to do

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

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

D17 · Explicit Debt9.9 / 10Stronggated by 307 serious findings✓ Tool-verified

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

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

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

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

TodoComment · ×267tests/test_graph_execution_state.py:3852
HackComment · ×30REDACTED:74
FixmeComment · ×10scripts/generate_vae_linear_approximation.py:44

What to do

  1. Resolve the 267 TodoComment finding(s) in Explicit Debt — start with new_architecture.py (9), diffusers_pipeline.py (8), ip_adapter.py (7). — One of this dimension's main actionable groups (267 warning-level).
  2. Resolve the 30 HackComment finding(s) in Explicit Debt — start with flux.py (4), ip_adapter.py (2), torch_module_autocast.py (2). — One of this dimension's main actionable groups (30 warning-level).
  3. Resolve the 10 FixmeComment finding(s) in Explicit Debt — start with onnx_runtime.py (4), denoise_latents.py (3), generate_vae_linear_approximation.py. — One of this dimension's main actionable groups (10 warning-level).
  4. Enforce Explicit Debt in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D19 · Documentation Quality5.0 / 10Adequate✓ Tool-verified

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

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

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

1 of 2 documentation facets pass in full; short on: F2 example. 148 document(s) read across 5 unit(s).

Documentation: no build, run or usage example · ×2README.md:1

What to do

  1. Resolve the 2 Documentation finding(s) in Documentation Quality — start with README.md (2). — One of this dimension's main actionable groups (2 recommendation-level).

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

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

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

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

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

No architecture decision records were found.

No ADRs found

What to do

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

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

D21 · Naming Consistency9.4 / 10Exemplary✓ Tool-verified

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

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

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

13 naming inconsistencies among 2105 declarations measured against a convention their peers follow.

`selectAspectRatioID` spells `ID` where 1924 names in the project spell it `Id` · ×2invokeai/frontend/webv1/src/features/controlLayers/store/paramsSlice.ts:1542
`addGetOpenAPISchemaListener` spells `API` where 36 names in the project spell it `Api`invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/getOpenAPISchema.ts:13
`getSAMPoints` spells `SAM` where 38 names in the project spell it `Sam`invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts:137
`getSAMPointColor` spells `SAM` where 38 names in the project spell it `Sam`invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts:1531
`isAspectRatioID` spells `ID` where 1924 names in the project spell it `Id`invokeai/frontend/webv1/src/features/controlLayers/store/types.ts:774

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

✓ On the Gold path — maintain.

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

D24 · Comment Value9.3 9.2 / 10Exemplary✓ Tool-verified

What it measures: Whether comments are worth it — explaining WHY (valuable) rather than WHAT (redundant).

Method: Every inline C# comment compared word by word with the identifiers, literals and constructs of the code it annotates (taken from the syntax); a comment whose words that code already contains is redundant, as are closing-brace labels and generator template text. Comments giving a reason or a reference are kept; other scripts and languages are not judged. Deterministic, exhaustive, advisory.

Maturity: Documented → Verified → Prevented · effective 9.2 / 10 · rule-coverage 99% · ceiling Documented

95 of 13009 judged comments only repeat the code they sit on (0.7 %). 196 comment(s) in another language or script were not judged.

redundant comment · ×59invokeai/frontend/api/scripts/typegen.js:18
doc comments repeat the names · ×2invokeai/frontend/webv1/src/app/logging/logger.ts:53

✓ On the Gold path — maintain.

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

D26 · Project Cohesion1.4 / 10Critical✓ Tool-verified

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

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

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

3 of 7 build units (Python, npm) flagged as possibly oversized/incoherent.

Projects may be oversized for their cohesion

What to do

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

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

D28 · Secrets (history)9.0 / 10Adequategated by 1 critical finding✓ Tool-verified

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

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

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

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

REDACTED
REDACTED

What to do

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

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

D29 · Static Analysis (SAST)1.1 / 10Critical✓ Tool-verified

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

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

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

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

50 finding(s): 0 critical, 36 high, 13 medium, 1 low. 27 unpinned-GitHub-Actions row(s) are reported here but scored by D36 (supply-chain provenance), which measures that posture as `pinned_actions` — one pinning decision is charged once, not once per lens. semgrep hit a parse error in 191 file(s) — `REDACTED` (line 105, line 106), `docs/invoke-config.json`, `docs/src/config/head.ts` (line 74, line 76), `invokeai/frontend/webv1/src/app/hooks/useSyncFaviconQueueStatus.ts` (line 19), `invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx` (line 619, line 953, line 1072, …), … (+186 more) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them. Separately, one or more rules could not re-parse an embedded snippet in 4 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

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

What to do

  1. Resolve the 2 REDACTED finding(s) charged to Static Analysis (SAST) — the other 27 are reported here at file:line but scored by D36 (supply-chain provenance), which charges them once. — One of this dimension's main actionable groups (29 issue-level, 2 of them charged here).
  2. Resolve the 2 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2). — One of this dimension's main actionable groups (2 issue-level).
  3. Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).

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

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

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

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

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

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

REDACTED
REDACTED

What to do

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

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

D31 · IaC & Container Security9.7 / 10Stronggated by 3 serious findings✓ Tool-verified

What it measures: Whether Dockerfiles / Terraform / Kubernetes config follow security best practices.

Method: IaC/container misconfiguration scan via trivy config (REDACTED/Terraform/K8s/Helm/CloudFormation); severity rules to 0-10 moderate normalizer. NotApplicable without manifests. Exhaustive, deterministic.

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

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

REDACTED

What to do

  1. Resolve the 3 Medium IaC finding(s) in IaC & Container Security — start with REDACTED (3). — One of this dimension's main actionable groups (3 warning-level).

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

D34 · Knowledge Freshness8.2 / 10Adequategated by 20 critical findings✓ Tool-verified

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

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

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

462 of 2638 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is invokeai/backend/image_util/normal_bae/nets/submodules/efficientnet_repo/geffnet/gen_efficientnet.py. Counted over 2638 of the 4775 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Orphaned knowledge · ×20invokeai/backend/image_util/normal_bae/nets/submodules/efficientnet_repo/geffnet/gen_efficientnet.py:1
Orphaned file · ×442invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityFilterer.ts:1
Further orphaned files (smaller)

What to do

  1. Resolve the 20 Orphaned knowledge finding(s) in Knowledge Freshness — start with gen_efficientnet.py, images.ts, CanvasSegmentAnythingModule.ts. — One of this dimension's main actionable groups (20 issue-level).
  2. Resolve the 442 Orphaned file finding(s) in Knowledge Freshness — start with __init__.py (4), utils.py (3), selectors.ts (2). — One of this dimension's main actionable groups (442 recommendation-level).
  3. Resolve the 1 Further orphaned files (smaller) finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).

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

D35 · Change Coupling9.7 / 10Stronggated by 61 serious findings✓ Tool-verified

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

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

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

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

Strongest change-coupling: canvas-tab-auto-layout.tsx↔generate-tab-auto-layout.tsx 96%; upscaling-tab-auto-layout.tsx↔workflows-tab-auto-layout.tsx 96%; canvas-tab-auto-layout.tsx↔upscaling-tab-auto-layout.tsx 96%

Change coupling: upscaling-tab-auto-layout.tsx ↔ workflows-tab-auto-layout.tsx · ×52invokeai/frontend/webv1/src/features/ui/layouts/upscaling-tab-auto-layout.tsx:1
Change-coupling hub: canvas-tab-auto-layout.tsx → generate-tab-auto-layout.tsx, upscaling-tab-auto-layout.tsx, workflows-tab-auto-layout.tsx · ×8invokeai/frontend/webv1/src/features/ui/layouts/canvas-tab-auto-layout.tsx
Change coupling clique: flux_vae_decode.py, latents_to_image.py, sd3_latents_to_image.pyinvokeai/app/invocations/flux_vae_decode.py

What to do

  1. Resolve the 52 Change coupling finding(s) in Change Coupling — start with types.ts (3), generate-tab-auto-layout.tsx (2), GalleryViewTabs.tsx (2). — One of this dimension's main actionable groups (52 warning-level).
  2. Resolve the 8 Change-coupling hub finding(s) in Change Coupling — start with canvas-tab-auto-layout.tsx, flux_denoise.py, engine.ts. — One of this dimension's main actionable groups (8 warning-level).
  3. Resolve the 1 Change coupling clique finding(s) in Change Coupling — start with flux_vae_decode.py. — One of this dimension's main actionable groups (1 warning-level).

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

D36 · Supply-chain Provenance & Signing5.0 / 10Adequate✓ Tool-verified

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

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

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

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

REDACTED
REDACTED
REDACTED

What to do

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

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

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d37_recommendation.md.

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d43_recommendation.md.

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d44_recommendation.md.

Frontend & cross-cutting dimensions

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

AC1 · Text alternatives5.0 / 10Adequate✓ Tool-verified

Other · Accessibility — Whether non-text content carries a text alternative — img/area/input[type=image] have alt, a meaningful svg has a title or aria-label, video has a captions track, and object/embed/canvas have a name or fallback content. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: every img/area/input[type=image] checked for alt, svg[role=img] for a title/aria-label, video for a captions <track>. Components skipped, spreads suppressed. Deterministic, hard fact per element.

Coverage: Population: image/media elements — img, area, input[type=image], svg, video, object, embed, canvas — across the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and dynamic-attribute elements are skipped. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is NOT read by any producer, so it contributes no element to this population; where such a frontend is present the card discloses it as an analyzer gap rather than scoring around it.

  • A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content. (×4) — invokeai/frontend/webv1/src/features/controlLayers/components/RasterLayer/RasterLayerCurvesAdjustmentsGraph.tsx:421, invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasSurface.tsx:129, invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasSurface.tsx:130, …
  • An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative. — invokeai/frontend/webv1/src/features/controlLayers/konva/util.ts:468
  • Video with no captions <track> offers no captions. This player's source is set at runtime, so there is no caption file to author here: give the player a way to carry captions — accept a track/captions URL alongside the media and render a <track kind="captions"> when one is supplied — and capture that asset wherever the media enters the product (upload, import or generation). — invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.tsx:900

What to do

  • Add a text alternative — alt on images (alt="" for purely decorative ones), a title or aria-label on meaningful svg, an aria-label or inner fallback content on canvas, and a captions <track> on video.
AC2 · Forms & labels1.9 / 10Critical✓ Tool-verified

Other · Accessibility — Whether form controls have a programmatic label (an associated label, aria-label or aria-labelledby), buttons have text, links have an accessible name, a click handler on a plain element names the control it declares, fieldsets have a non-empty legend, known UI-library field components carry a label prop, and a placeholder isn't used as the only label. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: inputs/selects/textareas checked for an associated label[for]/wrapping label/aria-label/aria-labelledby (per document), buttons for accessible text, fieldsets for a legend; placeholder-only labelling flagged. Deterministic, hard fact per control.

Coverage: Population: form controls, buttons, links, fieldsets and known UI-library field components in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and spread/dynamic-attribute elements are skipped, so a control whose label arrives through a spread or a runtime expression is deliberately not judged. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

  • This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed. (×16) — invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx:797, invokeai/frontend/webv1/src/features/controlLayers/components/ControlLayer/ControlLayerControlAdapterControlMode.tsx:49, invokeai/frontend/webv1/src/features/controlLayers/components/Filters/Filter.tsx:84, …
  • This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed. (×22) — invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx:826, invokeai/frontend/webv1/src/features/auth/components/AdministratorSetup.tsx:134, invokeai/frontend/webv1/src/features/auth/components/AdministratorSetup.tsx:155, …
  • This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed. (×2) — invokeai/frontend/webv1/src/features/controlLayers/components/SelectObject/SelectObjectModel.tsx:25, invokeai/frontend/webv1/src/features/controlLayers/components/SelectObject/SelectObjectPointType.tsx:26

What to do

  • Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.
AC3 · Page structure10.0 / 10Exemplary○ Nothing flagged

Other · Accessibility — Whether pages declare a language (well-formed BCP-47) and a non-empty title, expose exactly one main landmark and a sane heading order with non-empty headings, keep zoom enabled, title their iframes, give data tables header cells, and avoid meta-refresh. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: html lang, document <title>, a main landmark and heading order on full documents only, plus zoom-disabling viewports, untitled iframes and meta-refresh anywhere. Deterministic, per structural checkpoint.

Coverage: Population: the PARSED MARKUP documents (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx). The page-level checks — lang, title, single main landmark — fire ONCE PER FULL DOCUMENT (an <html> root) and never on a partial or component fragment, so a repo of fragments is assessed only on the per-element checks (heading order, table headers, iframe titles, meta-refresh, zoom). Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

AC4 · Keyboard semantics1.0 / 10Critical✓ Tool-verified

Other · Accessibility — Whether interactive behaviour is keyboard-reachable — no click handler on a non-interactive element lacking a role, tabindex and key handler, no element the repo's own CSS styles `cursor: pointer` without giving it any of the three, no unfocusable element whose only binding is a mouse enter/leave pair or a double-click, no positive tabindex, no href-less anchor, no placeholder-href (#/javascript) link acting as a button. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: click handlers on non-interactive elements lacking role+tabindex+key handler, positive tabindex values, and href-less anchors. Components skipped, spreads suppressed. Deterministic, hard fact per element.

Coverage: Population: elements that pose a keyboard-semantics question, in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) — a non-natively-interactive element carrying a click handler, a double-click or hover enter/leave binding, a pointer-only gesture on a tabindex="0" element, or `cursor: pointer` from the repo's own CSS; an href-less or placeholder-href (#, javascript:) anchor; and any element with a positive tabindex. Natively interactive elements used correctly (<button>, <a href>, form controls) are NOT in the population — there is nothing to judge — so a page of nothing but correct controls gives AC4 nothing to measure. Keyboard reachability is judged from the markup, never from a rendered page. ★ An interactive element declared in a tagged-template (html`…`) or hyperscript frontend is NOT in this population — no producer reads either — so an empty population is reported as an analyzer gap, never as "this repository has no interactive elements".

  • This <canvas> binds pointerdown, pointerup, pointermove and double-click — pointer gestures with no keyboard form, a double-click among them. No click, no key handler, and no tabIndex={0}, so it cannot even take focus. Nothing synthesises a double-click from the keyboard: Enter and Space fire a single click, and only on a native <button> or <a href>. So this behaviour has no keyboard path at all. Expose the same action on a real control, or add role + tabIndex={0} + a key handler alongside the double-click. — invokeai/frontend/webv1/src/features/controlLayers/components/RasterLayer/RasterLayerCurvesAdjustmentsGraph.tsx:421

What to do

  • Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
AC5 · ARIA correctness10.0 / 10Exemplary○ Nothing flagged

Other · Accessibility — Whether ARIA is used correctly — valid non-abstract roles, the ARIA state a role requires, valid (non-misspelled) aria-* attribute names, in-enum values for token-typed aria-* attributes, and no aria-hidden on (or wrapping) a focusable element. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: role values checked against the WAI-ARIA role set (abstract/invalid flagged), required ARIA state for a role, and aria-hidden on a focusable element. Deterministic, role/attribute level.

Coverage: Population: elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) that carry a role or an aria-* attribute; roles and token values are checked against the ARIA enums exhaustively within that set. An expression-valued (dynamic) role or aria-* value is skipped rather than guessed, and markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

AC6 · Visual & motion safety6.1 / 10Adequate✓ Tool-verified

Other · Accessibility — Whether focus outlines aren't removed without a replacement, motion respects prefers-reduced-motion, and literal CSS colour pairs meet contrast — PARTIAL: inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS literals are read (hex/rgb/hsl/named), never computed/runtime/external-CDN colour. Static markup readiness, not a WCAG conformance claim.

Method: Static markup/CSS scan: inline outline:none/0, literal inline colour/background contrast against the 4.5:1 AA floor, and <style>-block animation without a prefers-reduced-motion guard. Deterministic but PARTIAL — only inline styles and in-repo CSS literals are visible.

Coverage: Population: styled elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx), plus in-repo <style> blocks, in-repo .css files and CSS-in-JS literals. Colour contrast is computed from LITERAL colour pairs only (hex/rgb/hsl/named, including var() tokens and Tailwind neutral utilities) — computed, runtime-themed and external-CDN colour is never resolved, so this is a partial read of contrast by construction. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

  • <video> takes keyboard focus, and outline:none/0 in its inline style removes the focus ring with no chance of a :focus replacement (an inline style outranks every stylesheet rule). Keep a visible focus indicator. — invokeai/frontend/webv1/src/features/gallery/components/ImageViewer/CurrentVideoPreview.tsx:393
  • `.site-title` moves (`transition: transform 100ms ease-in-out`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — docs/src/styles/custom.css:50
  • `.sl-link-button` moves (`transition: transform 100ms ease-in-out`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — docs/src/styles/custom.css:309
  • `.splash-img::before` moves (`animation: splash-animate 6s ease-in-out infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — docs/src/styles/custom.css:401

What to do

  • Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
AC7 · A11y enforcement10.0 / 10Exemplary✓ Tool-verified

Other · Accessibility — Whether accessibility is ENFORCED in the toolchain — an accessibility checker configured over the markup (an a11y lint rule set, e.g. eslint-plugin-jsx-a11y or vuejs-accessibility where the project lints JavaScript) and an automated accessibility assertion wired into tests or CI (axe/pa11y/Lighthouse or an equivalent) — on the Documented→Verified→Prevented ladder.

Method: Repo config/CI scan: an accessibility checker configured over the markup (an a11y lint rule set such as eslint-plugin-jsx-a11y / vuejs-accessibility where JavaScript is linted) and an automated accessibility assertion in tests or CI (axe/pa11y/Lighthouse or equivalent), graded on the Documented→Verified→Prevented rungs. Deterministic, presence/rung detection.

Coverage: Population: the repository's own tooling configuration — lint config, test and CI files — NOT the markup. It is read for a configured accessibility checker and an automated accessibility assertion (axe/pa11y/Lighthouse, or a native-toolkit equivalent), and it credits an INVOCATION, never a mention: a licence filename, an import comment or a doc reference earns no rung. Enforcement configured entirely outside the repository leaves no evidence here and cannot be credited.

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

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

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

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

What to do

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

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

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

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

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

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

AX5 · Architecture & structure10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether the codebase has a recognisable, scale-appropriate structure (a named architectural style, or modular enough for its size) rather than being an ad-hoc ball of mud.

Method: Roslyn plus csproj analysis: architecture style detection (DDD, clean, vertical-slice, CQRS) and structure fitness for repo size. Deterministic.

AX6 · Interface segregation9.9 / 10Exemplary✓ Tool-verified

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

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

  • `GalleryCommandsPort` declares 19 required operations: `clearSelection`, `reconcileDeletedBoardOutcome`, `selectBoard`, `selectItem`, `selectImage`, `setCompareItem`, `setCompareImage`, `setItemMultiSelection`, `setPage`, `setPageInfo`, `setSearchTerm`, `setStarredOnly`, `setSemanticSearchMode`, `setSemanticSearchText`, `commitSemanticSearch`, `clearSearch`, `setView`, `toggleItemSelection`, `updateSettings`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/frontend/webv2/src/features/gallery/ui/GalleryUiContext.tsx:69
  • `GalleryActions` declares 27 required operations: `archiveBoard`, `clearSelection`, `createBoard`, `deleteBoard`, `downloadBoard`, `exportProject`, `loadMore`, `moveBoard`, `refresh`, `renameBoard`, `setBoardGeneralAccess`, `selectBoard`, `selectItem`, `selectItemRange`, `setCompareItem`, `setSearchTerm`, `setSearchScope`, `setStarredOnly`, `clearSearch`, `commitSemanticSearch`, `setSemanticImageQuery`, `setSemanticSearchMode`, `setSemanticSearchText`, `setView`, `toggleItemInSelection`, `updateSettings`, `uploadFiles`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/frontend/webv2/src/features/gallery/ui/GalleryWidgetContext.tsx:22
  • `QueueBackendPort` declares 20 required operations: `claimItemDelivery`, `cancelQueueItems`, `cancelQueueItemsByBatchIds`, `enqueueGenerate`, `enqueueWorkflow`, `getItem`, `getResultImages`, `getResultVideoNames`, `getResultVideos`, `listItems`, `readCurrent`, `readItemIds`, `readItemsById`, `readNext`, `readStatus`, `readItemDetail`, `retryItems`, `emit`, `on`, `onConnectionChange`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/frontend/webv2/src/features/queue/core/types.ts:331
  • `ProjectDraftStore` declares 24 required operations: `adopt`, `acknowledgeRetarget`, `claimWriter`, `close`, `delete`, `deleteCorrupt`, `discardUnloadJournal`, `get`, `journalBeforeUnload`, `list`, `listForProject`, `listRetargets`, `peekUnloadJournalProjectIds`, `reconcileUnloadJournal`, `reserveCopyIdentity`, `resumeDraft`, `rebaseDraft`, `retargetAcknowledgedCopy`, `settleAcknowledgement`, `settleConflict`, `settleSchemaRefusal`, `settleUnloadJournal`, `stage`, `startFreshWriter`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/frontend/webv2/src/workbench/projects/draftStore.ts:270
  • `DurableSyncedWorkbenchPersistence` declares 31 required operations: `acknowledgeProjectResolution`, `abortProjectResolution`, `adoptProjectRecord`, `clearWorkbench`, `close`, `deleteRecoverableDraft`, `deleteProjectOnServer`, `ensureProjectOnServer`, `flushProjectToServer`, `getProjectDraftDocument`, `getRecoverableDraftDocument`, `hasClosedSession`, `journalBeforeUnload`, `hasChangesUnloadWouldLose`, `isUnloadAtRisk`, `hasPendingChanges`, `hydrateProjectFromServer`, `loadWorkbench`, `listRecoverableDrafts`, `markProjectDeleted`, `persistEmptySession`, `releaseMutationLocks`, `reopenSession`, `subscribeSessionReopened`, `resolveConflictDiscard`, `resolveConflictSaveAsNew`, `resolveConflictUseServer`, `releaseProjectSync`, `retain`, `saveWorkbench`, `unmarkProjectDeleted`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:508
  • `PersistenceAggregatePort` declares 17 required operations: `assignProjectBoard`, `getPersistedRevision`, `getState`, `hydrate`, `notifyProjectNotFound`, `reportLoadAvailable`, `reportLoadError`, `reportLoadUnavailable`, `reportRefusedProjects`, `saveFailed`, `saveNeedsAttention`, `savePending`, `saveScheduled`, `saveStarted`, `saveSucceeded`, `setHasHydrated`, `subscribe`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/frontend/webv2/src/workbench/persistenceRuntime.ts:11
  • `LayerRowCommands` declares 22 required operations: `select`, `focus`, `toggleExpanded`, `setEnabled`, `setHidden`, `setLocked`, `startRename`, `rename`, `endRename`, `openMenu`, `openStackMenu`, `toggleCollapse`, `toggleChildren`, `selectChild`, `setChildEnabled`, `removeChild`, `renameChild`, `moveChild`, `moveChildToLayer`, `duplicateChild`, `openChildMenu`, `keyDown`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/frontend/webv2/src/workbench/widgets/layers/layerRowCommands.ts:19
  • `LayerContextActionEffects` declares 33 required operations: `reorder`, `duplicate`, `mergeSelected`, `mergeMasks`, `group`, `removeFromGroup`, `openRename`, `openRunWorkflow`, `startSelectObject`, `startFilter`, `transform`, `fitToBbox`, `openProperties`, `saveToBoard`, `copyToClipboard`, `cropToBbox`, `extractMaskedArea`, `booleanMerge`, `copyTo`, `rasterize`, `convertTo`, `patchConfig`, `addReferenceImage`, `addMaskModifier`, `addAdjustment`, `addLayerRegion`, `setColorLabel`, `mergeDown`, `toggleVisibility`, `toggleHidden`, `toggleLock`, `toggleQuickSwitchBookmark`, `delete`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.ts:159
  • `LayerCacheStore` declares 21 required operations: `peek`, `layerIds`, `get`, `getOrCreate`, `getOrCreateRect`, `growToRect`, `shrinkToRect`, `prepareReplacement`, `installReplacement`, `publishRasterized`, `captureState`, `restoreState`, `publishPixels`, `damageSince`, `invalidate`, `delete`, `version`, `revision`, `byteSize`, `evict`, `dispose`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/frontend/webv2/src/workbench/canvas-engine/render/layerCache.ts:82
  • `CanvasEngineLayerCapability` declares 29 required operations: `applyTransform`, `beginTransform`, `booleanMergeRasterLayers`, `cancelTextEdit`, `cancelTransform`, `clearMask`, `commitLayerConversion`, `commitLayerCopy`, `commitMaskImageResult`, `commitOpenTextSession`, `commitRasterFilterResult`, `commitTextEdit`, `convertLayerToControl`, `copyLayerToControl`, `copyLayerToRaster`, `cropAllLayersToBbox`, `cropLayerToBbox`, `duplicateLayers`, `mergeInpaintMasks`, `mergeLayerDown`, `mergeSelectedRasterLayers`, `mergeVisibleRasterLayers`, `nudgeSelectedLayer`, `openTextCreate`, `openTextEdit`, `rasterizeLayer`, `setTextEditContentReader`, `updateTextEditStyle`, `updateTransformSession`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/frontend/webv2/src/workbench/canvas-engine/capabilities.ts:744
  • `CanvasApplicationHost` declares 27 required operations: `captureGuard`, `clearFilterPreview`, `clearSamPreview`, `commitFilter`, `commitGenerated`, `commitMask`, `decodeSelectObjectPreview`, `encodeSurface`, `exportBakedLayerBlob`, `flushLayerUploads`, `exportLayerPixels`, `getCompositeExecutorDeps`, `getDocument`, `isGuardCurrent`, `isSamToolActive`, `prepareSelectObjectStart`, `publishFilterPreview`, `publishSamPreview`, `replaceSelection`, `replaceTemporaryRestoreTool`, `selectLayer`, `setSamInputHandler`, `setEscapeHandler`, `setSamInteraction`, `setSamTool`, `setViewTool`, `subscribeToolChanges`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/frontend/webv2/src/workbench/canvas-engine/applicationHost.ts:42
  • `PixelEditControllerOptions` declares 17 required operations: `canEdit`, `deleteDerived`, `getActiveProjectId`, `getAdjustedSurface`, `peekAdjustedSurface`, `getAdjustmentStatus`, `getDocument`, `getTransformSession`, `installPrepared`, `invalidate`, `isCacheReady`, `isOperationIdle`, `notifyPainted`, `preparePixels`, `publishStroke`, `reportRefusal`, `setTransformOverride`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/controlPixelController.ts:43
  • `PointerPipeline` declares 16 required operations: `onPointerDown`, `onPointerMove`, `onPointerUp`, `onPointerCancel`, `onPointerEnter`, `onPointerLeave`, `onKeyDown`, `onKeyUp`, `onFocusIn`, `isGestureActive`, `hoverPoint`, `cancelActiveGesture`, `endForToolSwitch`, `replaceTemporaryRestoreTool`, `heldRestoreToolId`, `reset`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/frontend/webv2/src/workbench/canvas-engine/input/pointerPipeline.ts:66
  • `CanvasOperationCapability` declares 26 required operations: `composeForGeneration`, `uploadIntermediate`, `getOperationState`, `subscribeOperation`, `getFilterSessionState`, `subscribeFilterSession`, `getSamSessionState`, `subscribeSamSession`, `startSelectObject`, `startFilterOperation`, `updateFilterOperation`, `setFilterOperationAutoProcess`, `processFilterOperation`, `resetFilterOperation`, `commitFilterOperation`, `cancelFilterOperation`, `updateSelectObjectSession`, `processSelectObjectSession`, `applySelectObjectSession`, `saveSelectObjectSession`, `resetSelectObjectSession`, `cancelSelectObjectSession`, `applyControlLayerIntent`, `retryControlDetection`, `getControlDetectionStatus`, `subscribeControlDetectionStatus`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/frontend/webv2/src/workbench/canvas-operations/contracts.ts:63
  • `CanvasSelectObjectCoordinatorDeps` declares 19 required operations: `prepareStart`, `selectLayer`, `clearOtherOperation`, `setSamTool`, `setViewTool`, `replaceTemporaryRestoreTool`, `isSamToolActive`, `captureGuard`, `isGuardCurrent`, `exportSource`, `uploadIntermediate`, `runGraph`, `decodePreview`, `publishPreview`, `clearPreview`, `invalidateOverlay`, `commitGenerated`, `commitMask`, `replaceSelection`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/frontend/webv2/src/workbench/canvas-operations/contracts.ts:202
  • `ImageActions` declares 22 required operations: `copyImage`, `createCanvasFromImages`, `deleteImages`, `deriveImageRecallCapabilities`, `downloadImage`, `downloadImages`, `generatePbrMaps`, `loadImageWorkflow`, `loadVideoWorkflow`, `moveImagesToBoard`, `openImageInPreview`, `recallImageData`, `recallVideoData`, `sendToInitialVideo`, `savePromptAsTemplate`, `selectForCompare`, `sendToCanvas`, `sendImageAsControl`, `setImagesStarred`, `useAsReferenceImage`, `useAsReferenceVideo`, `useAsConditioningClip`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts:110

What to do

  • Split fat interfaces into focused role-interfaces so clients depend only on what they use.
AX7 · Slice cohesion1.0 / 10Critical✓ Tool-verified

Other · Architecture — Whether feature slices stay independent (no direct cross-slice references) — the discipline that makes vertical-slice architecture pay off.

Method: Roslyn scan (vertical-slice gated): feature slices resolved from namespaces (.Features.*, .Slices.*) or project names; cross-slice type references detected. Deterministic, traceable.

  • `UserMenu` (slice 'auth') depends on `toast` from slice 'toast'. — invokeai/frontend/webv1/src/features/auth/components/UserMenu.tsx:32
  • `ChangeBoardModal` (slice 'changeBoardModal') depends on `selectSelectedBoardId` from slice 'gallery'. — invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:44
  • `ChangeBoardModal` (slice 'changeBoardModal') depends on `selectCurrentUser` from slice 'auth'. — invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:45
  • `ChangeBoardModal` (slice 'changeBoardModal') depends on `captureAuthContext` from slice 'auth'. — invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:92
  • `ChangeBoardModal` (slice 'changeBoardModal') depends on `isSameAuthContext` from slice 'auth'. — invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:135
  • `ChangeBoardModal` (slice 'changeBoardModal') depends on `toast` from slice 'toast'. — invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:148
  • `CanvasAlertsInvocationProgress` (slice 'controlLayers') depends on `selectSystemShouldShowInvocationProgressDetail` from slice 'system'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasAlerts/CanvasAlertsInvocationProgress.tsx:45
  • `addRasterLayerFromImageDndTargetData` (slice 'controlLayers') depends on `newCanvasEntityFromImageDndTarget` from slice 'dnd'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasDropArea.tsx:9
  • `CanvasDropArea` (slice 'controlLayers') depends on `DndDropTarget` from slice 'dnd'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasDropArea.tsx:43
  • `CanvasEntityContainer` (slice 'controlLayers') depends on `DndListDropIndicator` from slice 'dnd'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/CanvasEntityContainer.tsx:54
  • `CanvasEntityGroupList` (slice 'controlLayers') depends on `singleCanvasEntityDndSource` from slice 'dnd'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/CanvasEntityGroupList.tsx:40
  • `CanvasEntityGroupList` (slice 'controlLayers') depends on `triggerPostMoveFlash` from slice 'dnd'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/CanvasEntityGroupList.tsx:114
  • `useCanvasEntityListDnd` (slice 'controlLayers') depends on `DndListTargetState` from slice 'dnd'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/useCanvasEntityListDnd.ts:15
  • `useCanvasEntityListDnd` (slice 'controlLayers') depends on `idle` from slice 'dnd'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/useCanvasEntityListDnd.ts:15
  • `useCanvasEntityListDnd` (slice 'controlLayers') depends on `dndInputFix` from slice 'dnd'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/useCanvasEntityListDnd.ts:24
  • `useCanvasEntityListDnd` (slice 'controlLayers') depends on `singleCanvasEntityDndSource` from slice 'dnd'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/useCanvasEntityListDnd.ts:28
  • `CanvasPasteModal` (slice 'controlLayers') depends on `selectAutoAddBoardId` from slice 'gallery'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasPasteModal.tsx:35
  • `CanvasPasteModal` (slice 'controlLayers') depends on `createNewCanvasEntityFromImage` from slice 'imageActions'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasPasteModal.tsx:68
  • `CanvasPasteModal` (slice 'controlLayers') depends on `toast` from slice 'toast'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasPasteModal.tsx:77
  • `WorkflowFieldRendererProps` (slice 'controlLayers') depends on `NodeFieldElement` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:47
  • `WorkflowFieldRenderer` (slice 'controlLayers') depends on `$templates` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:56
  • `WorkflowFieldRenderer` (slice 'controlLayers') depends on `isParameterScheduler` from slice 'parameters'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:162
  • `WorkflowFieldRenderer` (slice 'controlLayers') depends on `SCHEDULER_OPTIONS` from slice 'parameters'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:170
  • `WorkflowFieldRenderer` (slice 'controlLayers') depends on `ModelFieldCombobox` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:411
  • `ImageFieldComponent` (slice 'controlLayers') depends on `DndImage` from slice 'dnd'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:518
  • `WorkflowFormPreview` (slice 'controlLayers') depends on `$templates` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:87
  • `WorkflowFormPreview` (slice 'controlLayers') depends on `FormElement` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:93
  • `WorkflowFormPreview` (slice 'controlLayers') depends on `isNodeFieldElement` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:124
  • `WorkflowFormPreview` (slice 'controlLayers') depends on `isContainerElement` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:193
  • `WorkflowFormPreview` (slice 'controlLayers') depends on `DepthContextProvider` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:201
  • `WorkflowFormPreview` (slice 'controlLayers') depends on `ContainerContextProvider` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:202
  • `WorkflowFormPreview` (slice 'controlLayers') depends on `ROOT_CONTAINER_CLASS_NAME` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:203
  • `FormElementComponentPreview` (slice 'controlLayers') depends on `isDividerElement` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:228
  • `FormElementComponentPreview` (slice 'controlLayers') depends on `DividerElement` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:229
  • `FormElementComponentPreview` (slice 'controlLayers') depends on `isHeadingElement` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:232
  • `FormElementComponentPreview` (slice 'controlLayers') depends on `HeadingElement` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:233
  • `FormElementComponentPreview` (slice 'controlLayers') depends on `isTextElement` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:236
  • `FormElementComponentPreview` (slice 'controlLayers') depends on `TextElement` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:237
  • `ContainerElementPreview` (slice 'controlLayers') depends on `useDepthContext` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:253
  • `ContainerElementPreview` (slice 'controlLayers') depends on `useContainerContext` from slice 'nodes'. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:254

What to do

  • Keep slices independent: share cross-slice needs via an explicit contract/shared-kernel, not direct references between slices.
C2 · Access Controls10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether access is authorized by default — a framework authorization attribute/decorator or policy, or imperative guard methods (throw-on-violation) called from handlers.

Method: Roslyn scan: [Authorize] usage and authorization policies, plus imperative throw-on-violation guard methods detected via syntax. Deterministic.

C4 · Data Retention5.0 / 10Adequate✓ Tool-verified

Other · Security — Whether data has a defined lifetime — retention periods, TTLs, cleanup jobs (storage limitation).

Method: Roslyn scan: retention/TTL configuration presence in schema; CascadeDelete detected but not scored as retention control. Deterministic, gated by PII presence.

  • A retention mechanism is present, but the data-lifecycle is not yet complete — missing: an expiry limit — a declared maximum age / TTL after which the data is no longer kept, a scheduled purge / cleanup job (a Celery beat task, APScheduler job or management command that deletes rows past their retention — Session.objects.filter(created__lt=cutoff).delete(), purge_expired… / delete_old…).

What to do

  • Complete the data-lifecycle story: an expiry limit (a declared maximum age for the stored data — a retention-age setting, or a store-level TTL where your storage offers one), a scheduled purge/cleanup job that enforces it, and a documented retention period covering the personal data.
GD1 · Unfinished & placeholder code10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Unreviewed-generation residue in this repository's JavaScript/TypeScript: functions whose whole body still throws a "not implemented" error, and placeholder text (lorem ipsum, changeme/replace_me…) left in strings and JSX of non-test, non-generated code. Scored as a quality signature, never as a claim about authorship.

Method: Roslyn syntax scan: NotImplementedException throws and placeholder string literals in non-test, non-generated shipped code. Deterministic, code-shape signature.

IC1 · Incompleteness & stubs8.2 / 10Strong✓ Tool-verified

Other · Code Health — Unfinished work detected by code SHAPE, not keywords, in this repository's JavaScript/TypeScript: functions that only throw a "not implemented" error, functions that take inputs and return a constant or do nothing, async functions that never await, dead `if (false)` branches, and skeleton classes most of whose methods are holes.

Method: Roslyn syntax scan: incompleteness by code shape (constant-returning methods, async-never-await, #if false branches, guards that return what the code already falls through to, tests an earlier guard already decided, comparisons against NaN, skeleton types), not keyword-gated. Deterministic, code-shape heuristic.

  • Both arms of this conditional expression are the same, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition. (×2) — invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasShapeToolModule.ts:839, invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasShapeToolModule.ts:840
  • The `if` and its `else` contain the same statements, so no input can make the condition matter. Implement the distinction that was intended, or drop the branch and keep the body. — invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasToolModule.ts:346
  • `focusAdjacentRegion` has an empty body — confirm it's an intentional no-op and not an unfinished method. — invokeai/frontend/webv2/src/workbench/focusRegions.tsx:387
  • `focusFloating` has an empty body — confirm it's an intentional no-op and not an unfinished method. — invokeai/frontend/webv2/src/workbench/focusRegions.tsx:388
  • `focusRegion` has an empty body — confirm it's an intentional no-op and not an unfinished method. — invokeai/frontend/webv2/src/workbench/focusRegions.tsx:389

What to do

  • Clear the softer debt: re-enable or delete skipped tests, decide whether each empty function is a deliberate no-op (and say so in a comment), and replace blanket `eslint-disable` / `@ts-nocheck` with targeted, justified suppressions.
M1 · Documentation (README)7.9 / 10Strong✓ Tool-verified

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

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

What to do

  • Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
  • Add an 'Architecture' / 'How it works' section to the root README — the high-level shape.
  • Add a README to the 2 of 5 project(s) that lack one — worth up to 0.8 pts.
M2 · Architecture documentation2.0 / 10Critical✓ Tool-verified

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

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

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

What to do

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

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

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

  • Production code isn't grouped under a src/ folder — it's spread across several top-level directories, so there's no one place that says 'this is the product'.

What to do

  • Group production code under src/ (or split deliberately, e.g. backend/ + frontend/) so production and tooling code aren't mixed at the root.
M4 · Documentation accuracy10.0 / 10Exemplary○ Nothing flagged

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

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

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

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

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

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

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

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

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

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

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

  • `invokeai/frontend/webv1/src/services/events/useSocketIO.ts` reports through `console.*` at line 154 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — invokeai/frontend/webv1/src/services/events/useSocketIO.ts:154
  • `invokeai/frontend/webv1/src/services/events/useSocketIO.ts` reports through `console.*` at line 169 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — invokeai/frontend/webv1/src/services/events/useSocketIO.ts:169
  • `invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts` reports through `console.*` at line 311 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts:311
  • `invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts` reports through `console.*` at line 313 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts:313
  • `invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts` reports through `console.*` at line 397 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts:397
  • `invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts` reports through `console.*` at line 399 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts:399
  • `invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts` reports through `console.*` at line 444 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts:444
  • `invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts` reports through `console.*` at line 446 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts:446
  • `invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasManager.ts` reports through `console.*` at line 328 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasManager.ts:328
  • `invokeai/frontend/webv1/src/app/store/middleware/debugLoggerMiddleware.ts` reports through `console.*` at line 19 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — invokeai/frontend/webv1/src/app/store/middleware/debugLoggerMiddleware.ts:19
  • `invokeai/frontend/webv1/src/app/store/middleware/debugLoggerMiddleware.ts` reports through `console.*` at line 23 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — invokeai/frontend/webv1/src/app/store/middleware/debugLoggerMiddleware.ts:23
  • `invokeai/frontend/webv1/src/app/store/middleware/debugLoggerMiddleware.ts` reports through `console.*` at line 26 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — invokeai/frontend/webv1/src/app/store/middleware/debugLoggerMiddleware.ts:26
  • `invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts` reports through `console.*` at line 2713 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts:2713

What to do

  • Route service-code `console.*` output through the module's structured logger (with named fields), so delivery outcomes and failures reach the log pipeline with a level.
  • Consider OpenTelemetry tracing/metrics (opentelemetry-sdk) and a health-check endpoint (a /health route) for operability.
P3 · Security & performance tooling0.0 / 10Critical✓ Tool-verified

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

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

  • No static application security testing detected. For this repository's stack, add bandit, `semgrep --config=p/python`, or CodeQL's python pack as a CI step. What was searched, so you can tell an absence from a miss: the 78289 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner. — REDACTED:29
  • `docs/package.json` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`. — docs/package.json:17

What to do

  • Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.
  • Enable Dependabot/Renovate or a dependency-review gate.
  • Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
P4 · Deployment & Rollback7.0 / 10Strong✓ Tool-verified

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

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

  • Deployment is orchestrated by compose, and the service already exposes health probe endpoints (healthz/livez/readyz or a container healthcheck), but no compose service declares a `healthcheck:` that uses them and nothing pins a previous image to fall back to — so a release that starts but does not serve looks healthy, and reversing it is a manual step.

What to do

  • Add a `healthcheck:` to the served compose service — probing the endpoint it already answers on where it has one — with `depends_on: condition: service_healthy` on whatever waits for it, and keep the deployed image tag immutable and recorded so rolling back is re-pointing at the previous tag rather than rebuilding.
P6 · Release Hygiene5.0 / 10Adequate✓ Tool-verified

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

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

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

What to do

  • Keep a changelog (e.g. Keep-a-Changelog) recording what shipped in each release.
P7 · Outbound HTTP resilience3.0 / 10Weak✓ Tool-verified

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

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

  • `urllib.request.urlopen(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. — scripts/check_classifiers.py:21
  • `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. (×2) — scripts/get_external_contributions.py:50, scripts/get_external_contributions.py:61

What to do

  • Pass `timeout=` on every `requests`/`httpx` call (requests has no default and will wait forever), mount an `HTTPAdapter(max_retries=Retry(...))` on shared sessions, and wrap calls to flaky dependencies in `tenacity` retries or a `pybreaker` circuit breaker.
P8 · Schema migrations3.0 / 10Weak✓ Tool-verified

Readiness · Readiness — Whether database schema changes go through versioned migrations rather than being auto-created from the model at startup.

Method: Roslyn scan: EF Core DbContext for a versioned migrations directory versus bare EnsureCreated usage; off .NET, a file scan of dependency manifests, migration histories (Flyway, Liquibase, Alembic, Django, Rails, Prisma, TypeORM, Knex/Sequelize, golang-migrate, goose, Laravel, Doctrine, Diesel/sqlx) and schema auto-create in production source or config. Exhaustive, deterministic.

  • SQLAlchemy create_all() builds the schema from the model at startup and keeps no migration history, so there is no reviewed, repeatable upgrade path for an existing production database — a renamed column is dropped and re-added rather than migrated. Adopt Alembic (`alembic revision --autogenerate` + `alembic upgrade head`), so every schema change is a versioned file applied the same way in every environment. (×2) — invokeai/app/services/shared/sqlite_migrator/sqlite_migrator_impl.py:565, invokeai/app/services/shared/database/copy.py:213

What to do

  • Replace SQLAlchemy create_all() with Alembic (`alembic revision --autogenerate` + `alembic upgrade head`) so the production schema can evolve safely and reproducibly.
PF3 · Async & latency hygiene8.5 / 10Strong✓ Tool-verified

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

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

  • `unzipSync` in `readArchiveEntries` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — REDACTED:185

What to do

  • TypeScript/JavaScript: use the promise APIs (fs/promises, a promisified child_process.execFile, the async zlib/crypto functions) and await them instead of the *Sync variants.
R1 · Type Safety9.9 / 10Exemplary✓ Tool-verified

React / JS · Code Health — How much of the frontend is typed TypeScript vs untyped JavaScript.

Method: Frontend file inventory: the share of typed TypeScript vs untyped JavaScript across the source tree. Deterministic, exhaustive over frontend files.

What to do

  • Migrate the remaining .js/.jsx files to TypeScript.
R10 · Code Duplication8.5 / 10Strong✓ Tool-verified

React / JS · Code Health — Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm over JS/TS tokens, D-386): a block is reported only where its copies still agree on most of their own identifiers and literals, or were renamed as they were pasted but kept most of their constants, and where the copies carry enough code to stand on their own or the copied extent reaches 30 lines — so a re-implementation sharing neither names nor values, and a small pasted declaration, are both found and deliberately not reported, and a clean R10 is not a claim that nothing was copied.

Method: Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm run over JS/TS tokens). Masking finds the candidates; a block is reported when its copies still agree on most of their own identifiers and literals, or when a renamed copy still agrees on most of its constants, AND the copies carry enough code to stand on their own — or when the copied extent reaches 30 lines. So a re-implementation sharing neither names nor values, and a small pasted declaration, are deliberately not counted. Deterministic.

  • 219 duplicated blocks under invokeai/frontend/webv1/src/features/ have copies in at least two of the sibling directories auth, changeBoardModal, controlLayers, cropper, customNodes, deleteImageModal (+18 more sibling(s) not listed) — 107 of them are reported below, and 112 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 219 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 219 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 219 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — invokeai/frontend/webv1/src/features/dnd/DndListDropIndicator.tsx:12
  • 161 duplicated blocks under invokeai/frontend/webv2/src/ have copies in at least two of the sibling directories app, features, platform, workbench — 56 of them are reported below, and 105 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 161 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 161 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 161 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — invokeai/frontend/webv2/src/features/fonts/runtime.ts:102
  • 89 duplicated blocks under invokeai/frontend/webv2/src/features/ have copies in at least two of the sibling directories fonts, gallery, generation, identity, intermediates, models (+5 more sibling(s) not listed) — 46 of them are reported below, and 43 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 89 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 89 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 89 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — invokeai/frontend/webv2/src/features/upscale/ui/UpscaleFormFields.tsx:24
  • 78 duplicated blocks under invokeai/frontend/webv2/src/workbench/ have copies in at least two of the sibling directories canvas-engine, canvas-operations, diagnostics, hotkeys, image-actions, launchpad (+7 more sibling(s) not listed) — 33 of them are reported below, and 45 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 78 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 78 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 78 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — invokeai/frontend/webv2/src/workbench/launchpad/HelpMenu.tsx:77
  • 59 duplicated blocks under invokeai/frontend/webv1/src/features/controlLayers/components/ have copies in at least two of the sibling directories CanvasContextMenu, CanvasEntityList, ControlLayer, Filters, InpaintMask, RasterLayer (+8 more sibling(s) not listed) — 40 of them are reported below, and 19 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 59 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 59 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 59 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/useCanvasEntityListDnd.ts:11
  • 56 duplicated blocks under invokeai/frontend/ have copies in at least two of the sibling directories webv1, webv2 — 28 of them are reported below, and 28 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 56 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 56 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 56 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — invokeai/frontend/webv1/src/features/nodes/util/workflowImageExport.ts:170
  • 22 duplicated blocks under invokeai/frontend/webv1/src/features/parameters/components/ have copies in at least two of the sibling directories Advanced, Bbox, Canvas, Core, Dimensions, Krea2Enhancers (+7 more sibling(s) not listed) — 18 of them are reported below, and 4 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 22 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 22 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 22 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — invokeai/frontend/webv1/src/features/parameters/components/Bbox/BboxPreview.tsx:1
  • 19 duplicated blocks under invokeai/frontend/webv2/src/workbench/widgets/ have copies in at least two of the sibling directories autosave-status, canvas, diagnostics, image-map, layers, preview (+4 more sibling(s) not listed) — 8 of them are reported below, and 11 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 19 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 19 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 19 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/geometryForm.tsx:72
  • 14 duplicated blocks under invokeai/frontend/webv1/src/ have copies in at least two of the sibling directories app, common, features, services — 9 of them are reported below, and 5 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 14 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 14 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 14 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — invokeai/frontend/webv1/src/common/hooks/useCopyImageToClipboard.ts:14
  • 11 duplicated blocks under invokeai/frontend/webv1/src/features/controlLayers/konva/ have copies in at least two of the sibling directories CanvasEntity, CanvasObject, CanvasTool — 6 of them are reported below, and 5 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 11 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 11 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 11 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityTransformer.ts:1186
  • 10 duplicated blocks under invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/ have copies in at least two of the sibling directories ControlAdapterModelDefaultSettings, CpuOnlyModelSettings, EncoderModelSettings, LoRAModelDefaultSettings, MainModelDefaultSettings, VAEModelSettings — 8 of them are reported below, and 2 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 10 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 10 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 10 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/ControlAdapterModelDefaultSettings/ControlAdapterModelDefaultSettings.tsx:31
  • 10 duplicated blocks under invokeai/frontend/webv2/src/features/models/ui/ have copies in at least two of the sibling directories add-models, credentials, detail, install-queue, launchpad, library (+1 more sibling(s) not listed) — 5 of them are reported below, and 5 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 10 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 10 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 10 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — invokeai/frontend/webv2/src/features/models/ui/detail/UpdatePathDialog.tsx:60
  • 10 duplicated blocks under invokeai/frontend/webv2/src/workbench/canvas-engine/ have copies in at least two of the sibling directories controllers, document, document-model, editing, export, math (+3 more sibling(s) not listed) — 7 of them are reported below, and 3 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 10 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 10 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 10 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — invokeai/frontend/webv2/src/workbench/canvas-engine/export/psdExport.ts:388
  • 7 duplicated blocks under invokeai/frontend/webv1/src/features/nodes/components/ have copies in at least two of the sibling directories flow, sidePanel — 3 of them are reported below, and 4 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 7 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 7 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 7 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/StringFieldCollectionInputComponent.tsx:117
  • 6 duplicated blocks under invokeai/frontend/webv1/src/features/nodes/ have copies in at least two of the sibling directories components, hooks, store, util — 4 of them are reported below, and 2 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 6 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 6 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 6 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — invokeai/frontend/webv1/src/features/nodes/store/nodesSlice.ts:667
  • 6 duplicated blocks under invokeai/frontend/webv2/ have copies in at least two of the sibling directories scripts, src — 4 of them are reported below, and 2 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 6 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 6 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 6 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — invokeai/frontend/webv2/scripts/mock-working-memory.mjs:148
  • 5 duplicated blocks under invokeai/frontend/webv1/src/features/gallery/components/ have copies in at least two of the sibling directories Boards, ContextMenu, GallerySettingsPopover, ImageGrid, ImageViewer — 4 of them are reported below, and 1 is counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 5 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 5 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 5 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — invokeai/frontend/webv1/src/features/gallery/components/Boards/BoardsSettingsPopover.tsx:23
  • 5 of the duplicated blocks reported below have copies in at least two of the sibling directories FloatField, IntegerField under invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/. That concentration is one structural fact, not 5 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 5 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/FloatField/useFloatField.ts:45
  • 5 duplicated blocks under invokeai/frontend/webv2/src/features/workflow/ui/ have copies in at least two of the sibling directories editor, fields, graph-preview, library, linear — 4 of them are reported below, and 1 is counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 5 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 5 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 5 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/GraphPreviewOpenAsMenu.tsx:326
  • invokeai/frontend/webv1/src/features/nodes/util/workflowImageExport.ts:170 · invokeai/frontend/webv2/src/features/workflow/ui/editor/workflowImageExport.ts:174 — the two spans are one implementation copied and then locally edited — 1760 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — invokeai/frontend/webv1/src/features/nodes/util/workflowImageExport.ts:170
  • invokeai/frontend/webv1/src/features/nodes/util/graph/generation/addInpaint.ts:22 · invokeai/frontend/webv1/src/features/nodes/util/graph/generation/addOutpaint.ts:24 — the two spans are one implementation copied and then locally edited — 1330 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — invokeai/frontend/webv1/src/features/nodes/util/graph/generation/addInpaint.ts:22
  • invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildSD1Graph.ts:117 · invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildSDXLGraph.ts:128 — the two spans are one implementation copied and then locally edited — 1036 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildSD1Graph.ts:117
  • invokeai/frontend/webv1/src/features/ui/layouts/upscaling-tab-auto-layout.tsx:1 · invokeai/frontend/webv1/src/features/ui/layouts/workflows-tab-auto-layout.tsx:1 — these 2 files are line-for-line copies of one another — 172 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — invokeai/frontend/webv1/src/features/ui/layouts/upscaling-tab-auto-layout.tsx:1
  • invokeai/frontend/webv1/src/features/ui/layouts/canvas-tab-auto-layout.tsx:1 · invokeai/frontend/webv1/src/features/ui/layouts/workflows-tab-auto-layout.tsx:1 — these 2 files are line-for-line copies of one another — 169 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — invokeai/frontend/webv1/src/features/ui/layouts/canvas-tab-auto-layout.tsx:1
  • invokeai/frontend/webv1/src/features/ui/layouts/generate-tab-auto-layout.tsx:1 · invokeai/frontend/webv1/src/features/ui/layouts/upscaling-tab-auto-layout.tsx:1 — these 2 files are line-for-line copies of one another — 168 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — invokeai/frontend/webv1/src/features/ui/layouts/generate-tab-auto-layout.tsx:1
  • invokeai/frontend/webv1/src/features/ui/layouts/generate-tab-auto-layout.tsx:1 · invokeai/frontend/webv1/src/features/ui/layouts/workflows-tab-auto-layout.tsx:1 — these 2 files are line-for-line copies of one another — 168 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — invokeai/frontend/webv1/src/features/ui/layouts/generate-tab-auto-layout.tsx:1
  • invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildQwenImageGraph.ts:250 · invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildZImageGraph.ts:251 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildQwenImageGraph.ts:250
  • invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/FloatFieldCollectionInputComponent.tsx:1 · invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/IntegerFieldCollectionInputComponent.tsx:1 — these 2 files are line-for-line copies of one another — 143 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/FloatFieldCollectionInputComponent.tsx:1
  • invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/filterResultController.ts:47 · invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/generatedResultController.ts:42 — the two spans are one implementation copied and then locally edited — 973 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/filterResultController.ts:47
  • invokeai/frontend/webv1/src/features/auth/components/UserManagement.tsx:112 · invokeai/frontend/webv1/src/features/auth/components/UserProfile.tsx:93 — the two spans are one implementation copied and then locally edited — 739 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — invokeai/frontend/webv1/src/features/auth/components/UserManagement.tsx:112
  • invokeai/frontend/webv2/src/workbench/widgets/layers/LayerChildRow.tsx:145 · invokeai/frontend/webv2/src/workbench/widgets/layers/LayerRow.tsx:143 — the two spans are one implementation copied and then locally edited — 626 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — invokeai/frontend/webv2/src/workbench/widgets/layers/LayerChildRow.tsx:145
  • invokeai/frontend/webv1/src/features/queue/hooks/useEnqueueCanvas.ts:1 · invokeai/frontend/webv1/src/features/queue/hooks/useEnqueueGenerate.ts:1 — these 2 files are line-for-line copies of one another — 108 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — invokeai/frontend/webv1/src/features/queue/hooks/useEnqueueCanvas.ts:1
  • invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx:686 · invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx:931 — the two spans are one implementation copied and then locally edited — 569 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx:686
  • invokeai/frontend/webv1/src/features/auth/components/AdministratorSetup.tsx:26 · invokeai/frontend/webv1/src/features/auth/components/LoginPage.tsx:25 — the two spans are one implementation copied and then locally edited — 689 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — invokeai/frontend/webv1/src/features/auth/components/AdministratorSetup.tsx:26
  • invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasLassoToolModule.ts:339 · invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasShapeToolModule.ts:640 — the two spans are one implementation copied and then locally edited — 669 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasLassoToolModule.ts:339
  • invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/InputFieldHandle.tsx:1 · invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/OutputFieldHandle.tsx:1 — these 2 files are line-for-line copies of one another — 100 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/InputFieldHandle.tsx:1
  • invokeai/frontend/webv2/src/features/identity/ui/ProfileDialog.tsx:92 · invokeai/frontend/webv2/src/features/identity/ui/UserFormDialog.tsx:112 — the two spans are one implementation copied and then locally edited — 628 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — invokeai/frontend/webv2/src/features/identity/ui/ProfileDialog.tsx:92
  • invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:306 · invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:492 — the two spans are one implementation copied and then locally edited — 717 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:306
  • invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/booleanMergeController.ts:75 · invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:394 — the two spans are one implementation copied and then locally edited — 558 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/booleanMergeController.ts:75
  • invokeai/frontend/webv1/src/features/queue/store/readiness.ts:515 · invokeai/frontend/webv1/src/features/queue/store/readiness.ts:1293 — the two spans are one implementation copied and then locally edited — 689 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — invokeai/frontend/webv1/src/features/queue/store/readiness.ts:515

What to do

  • Act on each finding's own remediation rather than one rule: the move depends on what recurs. Where the copies are executable blocks, give the shared part one home and call it from each site; where they are declarations, a listing, a specialisation already delegating to its base, or one shape repeated per entity, there is no call site and the move is a shared type, a generated set or a factory — sometimes there is nothing to extract.
R2 · Cyclomatic Complexity8.0 / 10Strong✓ Tool-verified

React / JS · Code Health — Per-function cyclomatic/cognitive complexity from the token-level function scanner (D-386) — real branching, not a regex heuristic.

Method: Per-function cyclomatic/cognitive complexity from a token-level function scanner (real branching, not a regex heuristic), computed over every frontend function. Deterministic.

  • (anonymous) has cyclomatic complexity 696 and cognitive complexity 1160; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — invokeai/frontend/webv2/scripts/mock-backend.mjs:1169
  • (anonymous) has cyclomatic complexity 263 and cognitive complexity 203; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — invokeai/frontend/webv2/src/workbench/workbenchState.ts:4428
  • effect has cyclomatic complexity 209 and cognitive complexity 574; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/modelSelected.ts:100
  • getReasonsWhyCannotEnqueueCanvasTab has cyclomatic complexity 145 and cognitive complexity 294; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — invokeai/frontend/webv1/src/features/queue/store/readiness.ts:773
  • (anonymous) has cyclomatic complexity 98 and cognitive complexity 119; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:2293
  • (anonymous) has cyclomatic complexity 96 and cognitive complexity 163; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — invokeai/frontend/webv2/src/workbench/image-actions/recallParameters.ts:198
  • (anonymous) has cyclomatic complexity 96 and cognitive complexity 84; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — invokeai/frontend/webv2/src/features/gallery/ui/useGalleryData.ts:321
  • (anonymous) has cyclomatic complexity 94 and cognitive complexity 123; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts:569
  • (anonymous) has cyclomatic complexity 94 and cognitive complexity 61; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — invokeai/frontend/webv2/src/workbench/queue-integration/queueRunRestoration.ts:17
  • GalleryImageGrid has cyclomatic complexity 93 and cognitive complexity 85; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx:409
  • getReasonsWhyCannotEnqueueGenerateTab has cyclomatic complexity 89 and cognitive complexity 148; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — invokeai/frontend/webv1/src/features/queue/store/readiness.ts:357
  • (anonymous) has cyclomatic complexity 88 and cognitive complexity 89; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts:769
  • VideoWidgetView has cyclomatic complexity 83 and cognitive complexity 75; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx:131
  • (anonymous) has cyclomatic complexity 73 and cognitive complexity 57; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — invokeai/frontend/webv2/src/features/workflow/core/document.ts:910
  • (anonymous) has cyclomatic complexity 72 and cognitive complexity 122; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildFLUXGraph.ts:55
  • (anonymous) has cyclomatic complexity 72 and cognitive complexity 85; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHotkeyCommands.ts:166
  • (anonymous) has cyclomatic complexity 70 and cognitive complexity 89; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:1974
  • (anonymous) has cyclomatic complexity 69 and cognitive complexity 129; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — invokeai/frontend/webv1/src/features/nodes/util/workflow/validateWorkflow.ts:140
  • (anonymous) has cyclomatic complexity 69 and cognitive complexity 73; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — invokeai/frontend/webv2/src/features/video/core/graph.ts:654
  • (anonymous) has cyclomatic complexity 69 and cognitive complexity 63; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — invokeai/frontend/webv2/src/workbench/workbenchState.ts:3968

What to do

  • Break down the listed branch-heavy functions; aim P95 cyclomatic ≤ 5.
R3 · Large Files7.0 / 10Strong✓ Tool-verified

React / JS · Code Health — How many source files exceed the large-file threshold.

Method: Components/modules exceeding the large-file threshold, counted exhaustively across the frontend source tree. Deterministic.

  • invokeai/frontend/webv2/src/workbench/workbenchState.ts has 5902 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/workbench/workbenchState.ts:1
  • invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts has 3773 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:1
  • invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts has 3020 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts:1
  • invokeai/frontend/webv1/src/features/metadata/parsing.tsx has 2950 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv1/src/features/metadata/parsing.tsx:1
  • invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts has 2507 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:1
  • invokeai/frontend/webv2/src/features/queue/runtime.ts has 2449 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/features/queue/runtime.ts:1
  • invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts has 2271 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:1
  • invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx has 2047 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:1
  • invokeai/frontend/webv1/src/features/controlLayers/store/canvasSlice.ts has 2001 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv1/src/features/controlLayers/store/canvasSlice.ts:1
  • invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx has 1921 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx:1
  • invokeai/frontend/webv2/src/features/generation/core/graph.ts has 1893 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/features/generation/core/graph.ts:1
  • invokeai/frontend/webv1/src/features/nodes/store/util/testUtils.ts has 1841 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv1/src/features/nodes/store/util/testUtils.ts:1
  • invokeai/frontend/webv1/src/features/nodes/types/field.ts has 1629 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv1/src/features/nodes/types/field.ts:1
  • invokeai/frontend/webv2/src/workbench/projects/draftStore.ts has 1583 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/workbench/projects/draftStore.ts:1
  • invokeai/frontend/webv1/src/features/controlLayers/store/paramsSlice.ts has 1542 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv1/src/features/controlLayers/store/paramsSlice.ts:1
  • invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts has 1527 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts:1
  • invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts has 1471 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:1
  • invokeai/frontend/webv1/src/features/queue/store/readiness.ts has 1446 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv1/src/features/queue/store/readiness.ts:1
  • invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx has 1404 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx:1
  • REDACTED has 1392 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
  • invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts has 1383 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts:1
  • invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts has 1373 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts:1
  • invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowEditorView.tsx has 1338 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowEditorView.tsx:1
  • invokeai/frontend/webv1/src/features/cropper/lib/editor.ts has 1336 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv1/src/features/cropper/lib/editor.ts:1
  • invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts has 1305 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts:1
  • invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx has 1288 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx:1
  • invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts has 1273 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:1
  • invokeai/frontend/webv1/src/features/controlLayers/store/types.ts has 1203 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv1/src/features/controlLayers/store/types.ts:1
  • invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts has 1164 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts:1
  • invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx has 1163 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx:1
  • invokeai/frontend/webv2/src/features/queue/runtime/coordinator.ts has 1148 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/features/queue/runtime/coordinator.ts:1
  • invokeai/frontend/webv2/src/features/upscale/core/settings.ts has 1112 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/features/upscale/core/settings.ts:1
  • invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.ts has 1111 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.ts:1
  • invokeai/frontend/webv1/src/services/api/endpoints/images.ts has 1108 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv1/src/services/api/endpoints/images.ts:1
  • invokeai/frontend/webv2/src/features/workflow/core/document.ts has 1104 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/features/workflow/core/document.ts:1
  • invokeai/frontend/webv2/src/features/gallery/data/queries.ts has 1096 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/features/gallery/data/queries.ts:1
  • invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx has 1080 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx:1
  • invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityTransformer.ts has 1067 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityTransformer.ts:1
  • invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.ts has 1067 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.ts:1
  • invokeai/frontend/webv2/src/features/video/core/graph.ts has 1059 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — invokeai/frontend/webv2/src/features/video/core/graph.ts:1

What to do

  • Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
R4 · Test Coverage6.9 / 10Adequate✓ Tool-verified

React / JS · Readiness — Static test reachability (D-386): the share of production files reachable from any test via the import graph — measured without running anything.

Method: Static test reachability: the share of production files reachable from any test via the import graph — measured without running anything. Deterministic.

  • No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one. (×40) — invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts:1, invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasToolModule.ts:1, invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasShapeToolModule.ts:1, …

What to do

  • Add tests that import the unreached modules (directly or through their public entry).
R6 · Tooling10.0 / 10Exemplary✓ Tool-verified

React / JS · Readiness — Whether the project wires up test, lint and typecheck — detected from each package.json script's COMMAND (eslint / tsc / vitest / jest / playwright), not just its name, and corroborated against CI-workflow invocations so a tool run only in CI still counts.

Method: package.json scanned for test/lint/typecheck script wiring. Deterministic presence check.

R7 · Dead Code8.0 / 10Strong✓ Tool-verified

React / JS · Code Health — Files unreachable from every application/tooling/test entry point, and exports nothing imports (module-graph reachability, D-386).

Method: Dead code: files unreachable from every application/tooling/test entry point plus exports nothing imports, via module-graph reachability. Deterministic, exhaustive over the import graph.

  • Unreachable from the 456 application, 17 tooling and 1335 test entry point(s) detected in this repo. Gate removals on `npm run build` — an undetected custom entry would make these reachable.
  • no import path from any entry point (456 application, 17 tooling, 1335 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make (×7) — invokeai/frontend/webv1/src/features/nodes/types/common.test-d.ts, invokeai/frontend/webv2/src/workbench/workbenchAggregateInterface.type-test.ts, invokeai/frontend/webv1/src/features/nodes/types/workflow.test-d.ts, …
  • Nothing imports this binding — it is safe to review for removal. (×31) — invokeai/frontend/webv1/src/app/store/nanostores/util.ts:16, invokeai/frontend/webv1/src/features/auth/store/authSlice.ts:181, invokeai/frontend/webv1/src/features/auth/store/authSlice.ts:207, …
  • Nothing ultimately consumes this binding: its only referrer is the re-export in invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/index.ts in the same commit, or the barrel will import a name that no longer exists. — invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/GraphPreviewFlow.tsx:34

What to do

  • Delete the dead files and unused exports — every line is maintenance cost and rebuild-estimate inflation with zero runtime value.
R8 · Dependency Hygiene9.0 / 10Exemplary✓ Tool-verified

React / JS · Readiness — npm dependency truthfulness (D-386): unused dependencies, imports not declared anywhere, and type-/test-only packages shipped as production deps.

Method: npm dependency truthfulness: unused dependencies, imports declared nowhere, and type-/test-only packages shipped as production deps — from the manifest + import graph. Deterministic.

  • Every import is type-only — move it to devDependencies. — invokeai/frontend/webv1/src/common/hooks/useGroupedModelCombobox.ts:4

What to do

  • Remove unused dependencies, declare unlisted imports explicitly, and demote type-/test-only packages to devDependencies.
R9 · Circular Imports0.0 / 10Critical✓ Tool-verified

React / JS · Architecture — Import cycles in the module graph (D-386) — files that can only be understood and changed together.

Method: Import cycles in the module graph, detected exhaustively over JS/TS imports (the same cycle detection as the .NET coupling dimension). Deterministic.

  • invokeai/frontend/webv2/src/workbench/WorkbenchContext.tsx → invokeai/frontend/webv2/src/workbench/workbenchStore.ts → invokeai/frontend/webv2/src/workbench/layoutPresetActivation.ts → invokeai/frontend/webv2/src/workbench/widgetRegistry.ts → invokeai/frontend/webv2/src/workbench/widgets/manifests.ts → invokeai/frontend/webv2/src/workbench/widgets/autosave-status/manifest.ts → invokeai/frontend/webv2/src/workbench/widgets/autosave-status/implementation.ts → invokeai/frontend/webv2/src/workbench/widgets/autosave-status/AutosaveStatusWidgetView.tsx → invokeai/frontend/webv2/src/workbench/WorkbenchContext.tsx (one verified cycle inside a mutually-dependent group of 172 files) — invokeai/frontend/webv2/src/workbench/WorkbenchContext.tsx:39

What to do

  • Break each cycle by extracting the shared piece into a module both sides can import.
X1 · Async correctness10.0 / 10Exemplary○ Nothing flagged

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

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

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

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

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

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

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

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

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

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

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

X15 · Unvalidated length from an untrusted reader2.2 / 10Critical✓ Tool-verified

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

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

  • `length` is read from the bytes being parsed at line 266 (`struct.unpack("<Q")`), then passed as the size of `read` at line 267 — and nowhere in its function is `length` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `length` against the bytes actually remaining and a maximum the format allows before reading. — scripts/calibrate_flux3_denoise_working_memory.py:267
  • `header_len` is read from the bytes being parsed at line 240 (`struct.unpack("<Q")`), then passed as the size of `read` at line 241 — and nowhere in its function is `header_len` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `header_len` against the bytes actually remaining and a maximum the format allows before reading. — invokeai/backend/quantization/int8_convrot.py:241
  • `definition_len` is read from the bytes being parsed at line 24 (`int.from_bytes(… 8 bytes …)`), then passed as the size of `read` at line 25 — and nowhere in its function is `definition_len` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `definition_len` against the bytes actually remaining and a maximum the format allows before reading. — invokeai/backend/model_manager/util/model_util.py:25

What to do

  • Each finding names the read that takes the length from the input and the site that spends it, and states that the value is never compared in between. Confirm from the two, then bound the length against the remaining stream before using it.
X16 · Unfloored truncation loop10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a loop that shortens a string until it fits a length budget has a floor — one with none grinds the value down to the empty string, or past it into a negative-length `Substring`.

Method: Roslyn syntax + semantics: while/do loops whose body's only effect on a string is to drop its last character, checked for whether anything — a direct comparison on the length, a body guard, a break — bounds that length below. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `while`/`do` loop whose body’s one assignment to a value is `x = x.slice(0, -1)` or `x = x.slice|substring|substr(0, x.length - 1)`, driven by a condition that reads `x.length` only as a term of a larger expression — never compared directly, never tested for truthiness, and with no other read of `x` — and whose body has no `break`, `return`, `throw` or `if` naming `x`. Deterministic, provable per finding. Advisory.

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

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

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

  • `stripInstallationState` is exported, takes a document from its caller (line 292) and hands it to `mapDocument`, which calls itself at line 251 (`mapDocument`) with a piece of `node` (and at line 272) — and nowhere in `mapDocument` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `mapDocument` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/frontend/webv2/src/workbench/projects/projectAssets.ts:251
  • `collectFontDependencies` is exported, takes a document from its caller (line 49) and hands it to `walkTextSources`, which calls itself at line 36 (`walkTextSources`) with a piece of `value` (and at line 44) — and nowhere in `walkTextSources` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `walkTextSources` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/frontend/webv2/src/workbench/projects/invk/fonts.ts:36
  • `sameValue` is exported and takes `left: unknown` from its caller, and it calls itself at line 44 (`sameValue`) with a piece of `left` (and at line 51) — and nowhere in `sameValue` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `sameValue` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/postconditions.ts:44
  • `collectSubtree` is exported and takes `node: CanvasNodeContract` from its caller, and it calls itself at line 46 (`collectSubtree`) with a piece of `node` — and nowhere in `collectSubtree` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `collectSubtree` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentTree.ts:46
  • `collectSubtreeLeaves` is exported and takes `node: CanvasNodeContract` from its caller, and it calls itself at line 59 (`collectSubtreeLeaves`) with a piece of `node` — and nowhere in `collectSubtreeLeaves` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `collectSubtreeLeaves` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentTree.ts:59
  • `subtreeDepth` is exported and takes `node: CanvasNodeContract` from its caller, and it calls itself at line 69 (`subtreeDepth`) with a piece of `node` — and nowhere in `subtreeDepth` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `subtreeDepth` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentTree.ts:69
  • `cloneSubtree` is exported and takes `node: CanvasNodeContract` from its caller, and it calls itself at line 80 (`cloneSubtree`) with a piece of `node` — and nowhere in `cloneSubtree` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `cloneSubtree` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentTree.ts:80
  • `renameFonts` is exported and takes `value: unknown` from its caller, and it calls itself at line 115 (`renameFonts`) with a piece of `value` (and at line 121) — and nowhere in `renameFonts` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `renameFonts` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/frontend/webv2/src/platform/ui/theme/rebase.ts:115
  • `areJsonValuesStructurallyEqual` is exported and takes `left: unknown` from its caller, and it calls itself at line 21 (`areJsonValuesStructurallyEqual`) with a piece of `left` (and at line 34) — and nowhere in `areJsonValuesStructurallyEqual` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `areJsonValuesStructurallyEqual` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/frontend/webv2/src/platform/core/json.ts:21
  • `isWorkflowContentEquivalent` is exported, takes a document from its caller (line 120) and hands it to `canonicalize`, which calls itself at line 105 (`canonicalize`) with a piece of `value` (and at line 112) — and nowhere in `canonicalize` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `canonicalize` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/frontend/webv2/src/features/workflow/data/publication.ts:105
  • `parseFieldType` is exported and takes `schema: unknown` from its caller, and it calls itself at line 100 (`parseFieldType`) with a piece of `schema` — and nowhere in `parseFieldType` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `parseFieldType` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/frontend/webv2/src/features/workflow/data/templates.ts:100
  • `collectSubmissionInputMediaNames` is exported, takes a document from its caller (line 19) and hands it to `visit`, which calls itself at line 26 (`visit`) with a piece of `value` (and at line 44) — and nowhere in `visit` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `visit` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/frontend/webv2/src/features/queue/core/graphInputMedia.ts:26
  • `wildcardsFromNestedRecord` is exported, takes a document from its caller (line 39) and hands it to `walk`, which calls itself at line 54 (`walk`) with a piece of `node` — and nowhere in `walk` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `walk` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/frontend/webv2/src/features/generation/core/wildcardTransfer.ts:54
  • `dump_dataclass` is public and takes `obj: Any` from its caller, and it calls itself at line 35 (`dump_dataclass`) with a piece of `obj` (and at line 37) — and nowhere in `dump_dataclass` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `dump_dataclass` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/backend/pid/_ext/imaginaire/lazy_config/instantiate.py:35
  • `normalize_path_defaults` is public and takes `node: Any` from its caller, and it calls itself at line 55 (`normalize_path_defaults`) with a piece of `node` (and at line 58) — and nowhere in `normalize_path_defaults` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `normalize_path_defaults` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/app/util/custom_openapi.py:55
  • `remove_unreferenced_internal_execution_schemas` is public, takes a document from its caller (line 61) and hands it to `collect_refs`, which calls itself at line 80 (`collect_refs`) with a piece of `value` (and at line 83) — and nowhere in `collect_refs` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `collect_refs` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/app/util/custom_openapi.py:80
  • `load_execution_state` is public, takes a document from its caller (line 172) and hands it to `_normalize_persisted_effects_in_snapshot`, which calls itself at line 168 (`_normalize_persisted_effects_in_snapshot`) with a piece of `payload` — and nowhere in `_normalize_persisted_effects_in_snapshot` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_normalize_persisted_effects_in_snapshot` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — invokeai/app/services/shared/execution_state_migration.py:168

What to do

  • Each finding names the externally-callable member that accepts the document and the self-call that descends, and states that no depth parameter or counter exists anywhere in the walk. Confirm from the two, then thread a depth argument through the walk and reject documents past a fixed maximum, or rewrite it with an explicit stack.
X18 · Disposal-pattern correctness6.8 / 10Adequate✓ Tool-verified

Other · Code Health — Whether a type's disposal matches what it OWNS — releasing what it created, leaving alone what it was handed, and not declaring a finalizer for state that has nothing unmanaged to finalize.

Method: Roslyn syntax + semantics: every assignment to a disposable field is read to decide whether the type CREATED the value or was handed it, and the type's disposal is checked against that answer — an injected interface it disposes, a value it constructed and never releases, a finalizer on a type holding nothing unmanaged, and a disposable local whose every reference is a plain member read. A value handed to a container that disposes its contents (a parent control's `Controls` collection, a component `IContainer`) is released by that container and is not reported; generated code is out of population. On a repository with no .NET source the same ownership questions are read in JavaScript/TypeScript off the engine’s own token stream (test, vendored, generated and minified paths not): a class declaring `dispose()`, `[Symbol.dispose]()` or `[Symbol.asyncDispose]()` that disposes a field it was handed through a constructor parameter typed as a repository interface or resolved by a dependency-injection container; that assigns a field only ever from `new X(…)` of a disposable class and neither releases it anywhere in the class nor names it in its disposal member or a method that member calls, nor hands it to anything else; and a `const`/`let` local built from literals only whose every reference opens a statement operating on a non-release member of it. A class is disposable when every repository declaration of its name declares or inherits a disposal member, or when it is a documented library disposable (`vscode` EventEmitter, CancellationTokenSource and Disposable; three.js geometries, materials, textures, render targets, renderers, controls and composers). The finalizer arm has no JavaScript counterpart: a class cannot declare one. Dart is read for the owned-and-never-released arm: a Flutter `State` (or a class declaring `dispose()`/`close()`) whose library-private field is written only with direct creations of a framework controller, `FocusNode`, `StreamController` or periodic `Timer` (or a `.listen(…)` into a field declared `StreamSubscription`), which nothing in the class or its library releases (`dispose`/`close`/`cancel`) and which is never handed on except as a named argument. Ruby is read for the owned-and-never-released arm and the abandoned-local arm: a class declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose instance variable is written only with a blockless core descriptor creation (`File.open`/`new`, `Tempfile`, `Dir.open`, `IO.popen`, the `socket` and `openssl` socket classes) that no method of the class closes and that is never handed on (passed, returned, stored, exposed by `attr_reader`, delegated) — a class whose superclass or mixin lies outside the repository is not judged — and a blockless creation read through and dropped (`File.open(path).read`) or held in a local that is never closed, returned, passed or stored (a `&:read` block-pass, an `autoclose: false` borrow and a `fileno` hand-over are not abandonment). PHP is read for the same two arms: a class (not a trait, and not one using a trait) declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose `private` property (or a `final` class's `protected` one) is written only with a direct core `fopen`, `tmpfile`, `popen`, `proc_open`, `fsockopen`, `stream_socket_client`/`server` or `opendir` that nothing in the class closes (`fclose`, `pclose`, `closedir`, `unset`, a reset to `null`) and that is never handed on, and a handle held in a function's local, or read through as the argument of a reader, that is never closed, returned, passed, captured or stored; a `php://` stream, `curl_init`, `SplFileObject`, `PDO` and a function the repository declares under the core name are not read. Deterministic, provable per finding. Advisory.

  • `store` is never created by `PersistenceController` — it is the constructor parameter `store` (line 17), and its declared type `BitmapStore` is an interface — yet this class disposes it here (line 49). The instance came from whoever resolved it, and that owner decides when it ends. Disposing it from here reaches outside this object's lifetime: a dependency shared with the rest of the program is torn down when THIS instance goes away, and the real owner's later `dispose()` runs a second time on an object already disposed. Drop the call — a class disposes what it constructed, and only that. If this dependency genuinely is exclusive to this instance, construct it here (or take an owned factory) so the ownership is stated in the code rather than assumed. — invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/persistenceController.ts:49

What to do

  • Each finding names the value and the span that decides who owns it — the `new` that created it, or the constructor parameter that handed it over. Confirm ownership from that span, then make the disposal match it: release what this type created, leave what it was injected with to whoever created THAT, and drop a finalizer whose type holds nothing unmanaged to release.
X19 · Unrestored process-global state10.0 / 10Exemplary○ Nothing flagged

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

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

X2 · Cancellation propagation7.2 / 10Strong✓ Tool-verified

Other · Code Health — Whether async functions that make a cancellable request accept or pass on an AbortSignal (adoption curve).

Method: Roslyn scan: every async method (excluding framework-fixed overrides/Blazor handlers) checked for CancellationToken parameter presence. Deterministic, adoption percentage. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same question: every named async function that itself makes a request an AbortSignal can cancel (global `fetch`, axios and its file-local instances, ky, ofetch) counts, and it is compliant when its parameters or body name a signal or it hands one of its own parameters to the request as options; signatures a framework fixes (JSX event handlers, route and lifecycle exports, request-first handlers, `override`, `'use server'` modules, TanStack `mutationFn`) are exempt unless they take a signal. Deterministic, adoption percentage.

  • Only 18/34 async functions that make a cancellable request (fetch, axios, ky, ofetch, got, undici, node:http) accept an AbortSignal or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, an unmounted component, a timed-out job. Take a `signal` (or an options object that carries one) and hand it to the request; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
  • `fetchImageAsDataUrl` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. (×2) — invokeai/frontend/webv2/src/features/models/ui/detail/ModelSettingsMenuItems.tsx:167, invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/modelSettingsIO.ts:79
  • `fetchFollowingCancellation` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — invokeai/frontend/webv2/src/features/gallery/data/queries.ts:275
  • `waitForPreview` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. (×3) — invokeai/frontend/webv2/scripts/measure-architecture-performance.mjs:108, REDACTED:20, REDACTED:56
  • `runSample` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — invokeai/frontend/webv2/scripts/measure-architecture-performance.mjs:316
  • `openRepresentativePage` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:70
  • `ready` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:247
  • `assertAssetRoute` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:121
  • `runRoundTrip` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — REDACTED:301
  • `getResultImageDTOs` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:321
  • `imageDTOToFile` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — invokeai/frontend/webv1/src/services/api/endpoints/images.ts:1130
  • `getItem` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — invokeai/frontend/webv1/src/app/store/enhancers/reduxRemember/driver.ts:101
  • `setItem` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — invokeai/frontend/webv1/src/app/store/enhancers/reduxRemember/driver.ts:154
  • `clearStorage` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — invokeai/frontend/webv1/src/app/store/enhancers/reduxRemember/driver.ts:197

What to do

  • Thread an AbortSignal through async functions that make requests, so the work stops when its caller gives up.
X21 · Side-effecting pattern guard10.0 / 10Exemplary○ Nothing flagged

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

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

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

Other · Code Health — Whether a method that TAKES a lock or semaphore and gives it back from a flag-guarded `finally` returns the value that flag implies — reporting success while the guard hands the primitive back admits a second caller the exclusion was there to keep out, and reporting failure while the guard keeps it leaves nothing to ever give it back. Also whether a `finally` that gives the primitive back unconditionally can run in a state where the method does not hold it: after a timed wait whose result was discarded, after an acquire inside the `try` that can fail, after the body already released it, or never, because a `return` left between the acquire and the `try`.

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

X23 · Unguarded diagnostic materialisation7.9 / 10Strong✓ Tool-verified

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

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

  • `debug` at line 120 is called with an argument built by `children?.map((l) => ({ name : l.name, bounds : { left : l.left, top : l.top, right : l.right, bottom : l.bottom }, }))` (line 125), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — invokeai/frontend/webv1/src/features/controlLayers/hooks/useExportCanvasToPSD.ts:120
  • `debug` at line 98 is called with an argument built by `Object.keys(els)` (line 98), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:98

What to do

  • Each finding names the diagnostic call and the expression inside its argument whose cost scales with a collection. Confirm from the two that the argument is built before the call — that is JavaScript's evaluation order, not a guess — then put the construction behind the level check the logger offers (`if (logger.isLevelEnabled('debug'))` for pino and winston, `isDebugEnabled()` for log4js, the repository's own debug flag where it has one), or hand the logger the object and a format string (`logger.debug({ payload }, 'raw request')`) so the serialising happens only when the line is written. Moving the call is not the fix: it is the join/projection/stringify in the argument that is paid, wherever the call sits.
X24 · Document value interpolated into markup unescaped5.1 / 10Adequate✓ Tool-verified

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

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

  • `label` is text this program did not author, and it is written into the text of an element through `document.write` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — invokeai/frontend/webv1/src/features/controlLayers/konva/util.ts:465
  • `url` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through `document.write` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path. — invokeai/frontend/webv1/src/features/controlLayers/konva/util.ts:468

What to do

  • Each finding names the expression, the attribute it lands in and the line. Confirm the value's origin from the read this analyzer traced, then escape it at the sink or validate it against the shape the attribute accepts before interpolating.
X25 · Inert configuration knob10.0 / 10Exemplary○ Nothing flagged

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

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

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

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

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

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

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

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

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

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

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

X29 · Per-element action decided by a fixed element7.9 / 10Strong✓ Tool-verified

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

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

  • This loop runs once per element of `groups`, and the statement it guards acts on the element it is on — `group`. The test deciding whether that statement runs does not: `showHeadings` reads `groups[0]`, a subscript that does not move, so whatever it answers for that one element it answers for ALL of them. One `if` names the same collection at two different subscripts — the fixed one at line 145, which is the contradiction: either the test was meant to be per-element, in which case every element that differs from the fixed one is handled wrongly and all in the same direction, or it really is one answer for the whole collection, in which case it is being re-asked on every pass and belongs above the loop. The `if` is in the wrong place under both readings. Give the test the loop variable, or hoist it out. — invokeai/frontend/webv2/src/workbench/launchpad/projects/projectLibraryView.ts:148

What to do

  • Each finding names the test and the statement it guards, which index the same collection at two different subscripts — one fixed, one the loop variable. Confirm from the two, then decide which subscript the test meant. If it was meant to be per-element, give it the loop variable so each element is judged on itself. If it really is one answer for the whole collection, hoist the test OUT of the loop, where a reader can see it is asked once and where it is not re-evaluated on every pass — leaving it inside, reading a fixed element, is the one arrangement that cannot be right under either reading.
X3 · Exception handling5.5 / 10Adequate✓ Tool-verified

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

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

  • `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — scripts/calibrate_qwen_vae_working_memory.py:81
  • An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it. (×25) — invokeai/frontend/webv2/src/workbench/bootWidgetPreload.ts:41, invokeai/frontend/webv2/src/workbench/performanceMarks.ts:33, invokeai/frontend/webv2/src/workbench/widgets/preview/loupeGestures.ts:32, …
  • `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it. (×7) — invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.tsx:637, invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.tsx:692, invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewSwipeNeighbor.tsx:116, …
  • `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×7) — invokeai/frontend/webv2/src/workbench/settings/clearWorkspaceData.ts:8, invokeai/frontend/webv2/src/workbench/projects/covers.ts:90, invokeai/frontend/webv2/src/workbench/projects/covers.ts:125, …

What to do

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

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

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

X4 · Structured logging4.3 / 10Weak✓ Tool-verified

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

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

  • `trace` at line 127 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.trace({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.trace('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:127
  • `trace` at line 534 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.trace({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.trace('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:534
  • `error` at line 562 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.error({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.error('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:562
  • `warn` at line 633 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:633
  • `debug` at line 659 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:659
  • `trace` at line 663 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.trace({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.trace('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:663
  • `trace` at line 761 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.trace({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.trace('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:761
  • `debug` at line 48 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/onQueueItemStatusChanged.tsx:48
  • `debug` at line 98 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:98
  • `trace` at line 226 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.trace({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.trace('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:226
  • `debug` at line 230 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:230
  • `trace` at line 236 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.trace({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.trace('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:236
  • `trace` at line 240 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.trace({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.trace('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:240
  • `trace` at line 262 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.trace({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.trace('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:262
  • `error` at line 266 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.error({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.error('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:266
  • `debug` at line 638 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:638
  • `warn` at line 640 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:640
  • `error` at line 644 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.error({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.error('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:644
  • `info` at line 650 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:650
  • `debug` at line 655 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:655
  • `debug` at line 680 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:680
  • `warn` at line 682 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:682
  • `error` at line 686 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.error({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.error('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:686
  • `info` at line 690 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:690
  • `debug` at line 695 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:695
  • `debug` at line 744 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:744
  • `debug` at line 748 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:748
  • `warn` at line 753 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:753
  • `debug` at line 781 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:781
  • `info` at line 785 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:785
  • `error` at line 789 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.error({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.error('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:789
  • `info` at line 794 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:794
  • `debug` at line 831 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:831
  • `warn` at line 847 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:847
  • `debug` at line 903 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:903
  • `debug` at line 905 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:905
  • `debug` at line 910 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:910
  • `error` at line 917 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.error({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.error('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:917
  • `debug` at line 931 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:931
  • `warn` at line 942 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way. — invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:942

What to do

  • Interpolated log message defeats structured logging
X5 · Nullable reference types6.5 / 10Adequate✓ Tool-verified

Other · Code Health — Whether strict null checking is enabled and not undermined by heavy `!` assertion — TypeScript's `strictNullChecks` (which `strict` turns on) is what makes `string` exclude `null` and `undefined`, and the postfix `!` is the operator that silences it.

Method: Roslyn compiler-options scan: NullableContextOptions per project; null-forgiving (!) suppression density per 1k syntax nodes. Deterministic, adoption plus suppression penalty.

  • 3/5 of this repository's type-checking configuration(s) turn on strict null checking (`"strict": true`, or `"strictNullChecks": true`). A configuration that states neither is counted as OFF, because off is tsc's own default; a solution-style one whose `"files"` is empty and whose `"references"` point at other projects is in neither number, because it checks no source itself. Where it is off, `string` admits `null` and `undefined`: passing a value that is null compiles silently and throws on the first property access.
  • ~1.3 `!` null assertions per 1k TypeScript source lines — 657 assertion(s) across the 516159 source line(s) of the 3271 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: invokeai/frontend/webv1/src/common/util/promptAST.ts (28), invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts (27), invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts (24). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce.

What to do

  • The findings name the configuration each number was taken from and, for the assertions, the files that hold them. Turn null checking on where it is off — `"strict": true` in the base tsconfig that the others extend switches `strictNullChecks` on with the rest of the family — and then resolve the assertions rather than adding to them. A `!` on a value the checker could show to be null is a promise the author cannot check from where they are standing, and each one is a `TypeError: Cannot read properties of null` waiting for the path that makes it true; where the value genuinely cannot be null, say something the checker can see instead (narrow it with a test, make the property required, drop the `?`).

WCAG coverage — what static analysis assessed

Statically assessed 15 of 55 WCAG 2.2 Level A/AA success criteria (27%; ≈30% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 40 require runtime or manual evaluation. Partial signal only (a clean result is necessary, not sufficient; static analysis fully verifies none). This is accessibility readiness, not a conformance claim — a WCAG conformance claim requires manual evaluation (WCAG-EM 1.0).

DimensionWCAG 2.2 A/AA criteriaCoverage
AC1 · Text alternatives1.1.1, 1.2.2, 1.2.5Partial signal
AC2 · Forms & labels1.3.1, 3.3.2, 4.1.2Partial signal
AC3 · Page structure1.4.4, 2.2.1, 2.4.1, 2.4.2, 3.1.1, 4.1.2Partial signal
AC4 · Keyboard semantics2.1.1, 2.4.3Partial signal
AC5 · ARIA correctness4.1.2Partial signal
AC6 · Visual & motion safety1.4.3, 2.4.7Partial — literal CSS only
AC7 · A11y enforcementenforcement — no page criterionEnforcement posture (process)

Not statically assessed — these 40 Level A/AA criteria need runtime or manual evaluation (WCAG-EM): 1.2.1, 1.2.3, 1.2.4, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.4.1, 1.4.2, 1.4.5, 1.4.10, 1.4.11, 1.4.12, 1.4.13, 2.1.2, 2.1.4, 2.2.2, 2.3.1, 2.4.4, 2.4.5, 2.4.6, 2.4.11, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.5.7, 2.5.8, 3.1.2, 3.2.1, 3.2.2, 3.2.3, 3.2.4, 3.2.6, 3.3.1, 3.3.3, 3.3.4, 3.3.7, 3.3.8, 4.1.3.

Reference — by lens

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

LensScoreRatingImpact
Code Health60%Adequate — gated by D1, D2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture47%Weak — gated by D26, R9, AX7Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Maturity62%Adequate — gated by M2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Readiness33%Weak — gated by D12, P3, P7, P8Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Security70%Adequate — gated by D29Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Accessibility44%Weak — gated by AC2, AC4Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Performance85%StrongStrongest area.
Unscored — 4 check(s) recorded observations but carry no score

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

  • P12 CI test-gate honesty — 1 observation(s) recorded · Reported, not scored — and nothing was matched here. The coverage check applies to any stack, and the automatic-re-run check to any GitHub-Actions workflow, but the checks for excluded tests, skipped tests and sleep-based synchronisation currently recognise only some ecosystems' test-runner idioms, so on a repository built with another stack the zeros below mean 'not checked', not 'clean'.
  • X10 Duplicated predicate — 25 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X6 Hand-rolled structured-format parsing — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 39 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 3 control(s) we could not find positive evidence for

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

  • C3 Audit Trail — Repo shows no audit-logging mechanism (an audit-log table or model — a class or table named for it — django-simple-history, django-auditlog, django-reversion, django-pghistory or SQLAlchemy-Continuum recording each change, or an event-sourced store beside one) for sensitive changes — absence of evidence is not evidence of a working control. Record an audit trail in code (or document where it lives) so this dimension can be scored.
  • C5 Data-Subject Rights — Repo shows no corroborated data-subject-rights mechanism (erasure / export-portability / consent) tied to a subject id or GDPR vocabulary — absence of evidence is not evidence of a working control. Implement erasure, data export/portability and consent tracking over the subject's records.
  • P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 34 check(s) not relevant to this codebase

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

  • AX1 Captive dependencies — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX4 Dependency direction — not applicable to a vertical-slice architecture (the inward-dependency rule is for layered/clean styles)
  • AX8 Test isolation — no test/production split to check
  • AX9 CQS / query purity — no CQRS query handlers detected — query purity is not applicable to this codebase
  • AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • AXR1 Runtime accessibility — compose up failed (exit 14 — a file the compose project references is missing) — time="2026-11-04T12:34:49Z" level=warning msg="The \"RENDER_GROUP_ID\" variable is not set. Defaulting to a blank string." env file docker/.env not found: stat docker/.env: no such file or directory; runtime evidence skipped This is a statement about this run, not a statement about your application: nothing here says the surface is inaccessible, only that it was never rendered.
  • C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • D11 Test Reliability — Test reliability not included
  • D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
  • D22 Internal API Consistency — The exposed public-API surface could not be collected — no C#/VB projects loaded.
  • D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
  • D25 ADR Conformance — no ADRs to check
  • D27 Navigability — D27 reads resolved call sites in the languages it reads only — this repository's production source is .ts, .tsx, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
  • D32 Data Compliance (PII/GDPR) — 134 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
  • D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
  • D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
  • D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
  • D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
  • D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
  • D8 Code Coverage — Coverage not measured — polyglot repository, one half has no runner
  • DM1 Domain Modelling — not scored — this repository shows only 1 of the 3 signals this lens looks for (305 value object(s))
  • ED1 Event-Driven — not scored — this repository shows none of the 3 signals this lens looks for
  • ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
  • ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
  • P9 Domain vs controller coverage — coverage data present for 5 file(s), but no domain-layer files were identified: no covered file's path contains any of the markers this check keys on (/domain/, /aggregates/, /valueobjects/, /domainmodel/, .domain/, /entities/), which are matched case-insensitively anywhere in the path. With no domain partition there is nothing to compare the web/controller layer against — if this repository keeps its business rules under a folder named none of those, that naming is what the check cannot see, not the domain logic.
  • PF1 Benchmark discipline — Not applicable: no benchmark suite was found. This check searched for a pytest-benchmark or pytest-codspeed dependency with tests taking the `benchmark` fixture, an asv.conf.json with its `time_`/`mem_`/`peakmem_` benchmarks, or a pyperf Runner, and for a `*benchmark*` script that this repository's CI runs. Benchmarks are credited as a bonus, so their absence is neither scored nor deducted.
  • PF2 Allocation hygiene — Not applicable: TypeScript/JavaScript and Python runs on a garbage-collected runtime that gives a program no allocation-control idiom to choose on a hot path — no pools, stack allocation or value types — so allocation awareness is not something this code can be rated on.
  • R11 Import Boundaries — No recognizable feature-sliced/layered src layout — boundary rules not applicable.
  • R5 Dependency Freshness — uses a pnpm lockfile — dependency freshness not measured here; JS/npm CVEs are scored in D30 (Dependency Vulnerabilities), which answers every ecosystem
  • S1 Web-Security Posture — Not assessed: these web-security controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.

Appendix A — Findings (grouped)

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

Critical — 64 finding(s)
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 4 more in this group — see findings.md.
D34 · Knowledge Freshness · Orphaned knowledge · ×20
  • Orphaned knowledge invokeai/backend/image_util/normal_bae/nets/submodules/efficientnet_repo/geffnet/gen_efficientnet.py:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge invokeai/frontend/webv1/src/services/api/endpoints/images.ts:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge invokeai/frontend/webv1/src/features/cropper/lib/editor.ts:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityTransformer.ts:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge invokeai/backend/rectified_flow/er_sde_scheduler.py:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge invokeai/app/invocations/facetools.py:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge invokeai/backend/image_util/normal_bae/nets/submodules/efficientnet_repo/geffnet/efficientnet_builder.py:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge invokeai/backend/image_util/mlsd/utils.py:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge invokeai/frontend/webv1/src/features/controlLayers/konva/util.ts:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasStageModule.ts:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge invokeai/backend/image_util/pidi/model.py:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge invokeai/frontend/webv1/src/features/nodes/components/sidePanel/builder/dnd-hooks.ts:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge invokeai/app/invocations/text_encoder/compel.py:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasBboxToolModule.ts:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge invokeai/backend/tiles/tiles.py:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge invokeai/frontend/webv1/src/services/api/run-graph.ts:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge invokeai/frontend/webv1/src/features/nodes/types/v1/workflowV1.ts:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
D30 · Dependency Vulnerabilities · High CVE · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D10 · Test Quality · No assertions (empty test) · ×2
  • No assertions (empty test): drops a destination answered for the project that was open before a switch invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasHeaderActions.browser.test.tsx:590 — Test method has an empty body — it asserts nothing and exercises no code.
  • No assertions (empty test): says every saved project goes while the count is unknown, and says so plainly when there are none invokeai/frontend/webv2/src/workbench/settings/ClearSavedDataSettings.browser.test.tsx:148 — Test method has an empty body — it asserts nothing and exercises no code.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
AC1 · Text alternatives · <img> without a text alternative · ×1
  • <img> without a text alternative invokeai/frontend/webv1/src/features/controlLayers/konva/util.ts:468 — An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
AC4 · Keyboard semantics · Double-click handler on a non-interactive <canvas> · ×1
  • Double-click handler on a non-interactive <canvas> invokeai/frontend/webv1/src/features/controlLayers/components/RasterLayer/RasterLayerCurvesAdjustmentsGraph.tsx:421 — This <canvas> binds pointerdown, pointerup, pointermove and double-click — pointer gestures with no keyboard form, a double-click among them. No click, no key handler, and no tabIndex={0}, so it cannot even take focus. Nothing synthesises a double-click from the keyboard: Enter and Space fire a single click, and only on a native <button> or <a href>. So this behaviour has no keyboard path at all. Expose the same action on a real control, or add role + tabIndex={0} + a key handler alongside the double-click.
D28 · Secrets (history) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
R9 · Circular Imports · Import cycle (8 files) · ×1
  • Import cycle (8 files) invokeai/frontend/webv2/src/workbench/WorkbenchContext.tsx:39 — invokeai/frontend/webv2/src/workbench/WorkbenchContext.tsx → invokeai/frontend/webv2/src/workbench/workbenchStore.ts → invokeai/frontend/webv2/src/workbench/layoutPresetActivation.ts → invokeai/frontend/webv2/src/workbench/widgetRegistry.ts → invokeai/frontend/webv2/src/workbench/widgets/manifests.ts → invokeai/frontend/webv2/src/workbench/widgets/autosave-status/manifest.ts → invokeai/frontend/webv2/src/workbench/widgets/autosave-status/implementation.ts → invokeai/frontend/webv2/src/workbench/widgets/autosave-status/AutosaveStatusWidgetView.tsx → invokeai/frontend/webv2/src/workbench/WorkbenchContext.tsx (one verified cycle inside a mutually-dependent group of 172 files)
Serious — 4327 finding(s)
D15 · Churn × Complexity Hotspots · Hotspot · ×380
  • Hotspot: invokeai/frontend/webv2/src/workbench/workbenchState.ts invokeai/frontend/webv2/src/workbench/workbenchState.ts:4424 — invokeai/frontend/webv2/src/workbench/workbenchState.ts changed 113 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 412 in workbenchState.reduceWorkbenchAction at line 4424. 49 of those changes were fix/bug commits, and the other 64 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/frontend/webv2/src/workbench/workbenchState.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: invokeai/frontend/webv2/scripts/mock-backend.mjs invokeai/frontend/webv2/scripts/mock-backend.mjs:1169 — invokeai/frontend/webv2/scripts/mock-backend.mjs changed 37 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 638 in mock-backend.startMockBackend.server at line 1169. 5 of those changes were fix/bug commits, and the other 32 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/frontend/webv2/scripts/mock-backend.mjs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts:353 — invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts changed 58 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 312 in engine.createCanvasEngine at line 353. 25 of those changes were fix/bug commits, and the other 33 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: invokeai/app/services/shared/graph.py invokeai/app/services/shared/graph.py:2565 — invokeai/app/services/shared/graph.py changed 108 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 155 in GraphExecutionState._validate_effects at line 2565. 27 of those changes were fix/bug commits, and the other 81 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/app/services/shared/graph.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx:409 — invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx changed 41 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 318 in GalleryImageGrid.GalleryImageGrid at line 409. 20 of those changes were fix/bug commits, and the other 21 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:573 — invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 582 in durableSyncedPersistence.createDurableSyncedWorkbenchPersistence at line 573. 7 of those changes were fix/bug commits, and the other 7 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx:223 — invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx changed 47 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 138 in LayerContextMenu.LayerMenu at line 223. 11 of those changes were fix/bug commits, and the other 36 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx:169 — invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx changed 28 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 229 in LayersTree.LayersTree at line 169. 4 of those changes were fix/bug commits, and the other 24 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:2293 — invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts changed 48 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 96 in videoPolicies.getVideoValidationReasons at line 2293. 19 of those changes were fix/bug commits, and the other 29 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx:131 — invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx changed 49 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 94 in VideoWidgetView.VideoWidgetView at line 131. 24 of those changes were fix/bug commits, and the other 25 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts:200 — invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts changed 24 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 148 in useImageActions.useImageActions at line 200. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: invokeai/frontend/webv2/src/features/video/core/settings.ts invokeai/frontend/webv2/src/features/video/core/settings.ts:470 — invokeai/frontend/webv2/src/features/video/core/settings.ts changed 51 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 67 in settings.isVideoSettings at line 470. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/video/core/settings.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowEditorView.tsx invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowEditorView.tsx:320 — invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowEditorView.tsx changed 22 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 151 in WorkflowEditorView.WorkflowFlow at line 320. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowEditorView.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:1879 — invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts changed 52 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 61 in baseGenerationPolicies.getSettingsWithCompatibleModelSelections at line 1879. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts:769 — invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts changed 27 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 98 in canvasProjectMutations.applyCanvasProjectMutation at line 769. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx:196 — invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx changed 38 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 69 in PreviewWidgetView.PreviewWidgetView at line 196. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts:546 — invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts changed 26 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 96 in videoRecall.buildVideoRecallSettings at line 546. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: invokeai/frontend/webv2/src/features/workflow/core/document.ts invokeai/frontend/webv2/src/features/workflow/core/document.ts:910 — invokeai/frontend/webv2/src/features/workflow/core/document.ts changed 24 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 96 in document.applyProjectGraphAction at line 910. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/workflow/core/document.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryDetailPanel.tsx invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryDetailPanel.tsx:101 — invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryDetailPanel.tsx changed 21 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 108 in WorkflowLibraryDetailPanel.WorkflowLibraryDetailPanel at line 101. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryDetailPanel.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsx invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsx:424 — invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsx changed 35 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 62 in UpscaleWidgetView.UpscaleWidgetView at line 424. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.tsx invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.tsx:387 — invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.tsx changed 24 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 79 in PreviewFrame.PreviewVideo at line 387. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasWidgetView.tsx invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasWidgetView.tsx:109 — invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasWidgetView.tsx changed 28 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 66 in CanvasWidgetView.CanvasWidgetView at line 109. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasWidgetView.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: invokeai/frontend/webv2/src/features/video/ui/VideoReferenceListField.tsx invokeai/frontend/webv2/src/features/video/ui/VideoReferenceListField.tsx:363 — invokeai/frontend/webv2/src/features/video/ui/VideoReferenceListField.tsx changed 34 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 50 in VideoReferenceListField.VideoReferenceListField at line 363. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/video/ui/VideoReferenceListField.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHotkeyCommands.ts invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHotkeyCommands.ts:166 — invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHotkeyCommands.ts changed 22 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 74 in canvasHotkeyCommands.executeCanvasHotkeyCommand at line 166. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHotkeyCommands.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapPlot.tsx invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapPlot.tsx:114 — invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapPlot.tsx changed 22 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 74 in ImageMapPlot.ImageMapPlot at line 114. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapPlot.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • + 355 more in this group — see findings.md.
D3 · God Classes · FunctionTooLong · ×362
  • FunctionTooLong: engine.createCanvasEngine invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts:353 — FunctionTooLong — createCanvasEngine runs 2008 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1908 over it, 20.08× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: workbenchState.enqueueCompiledSnapshot invokeai/frontend/webv2/src/workbench/workbenchState.ts:3948 — FunctionTooLong — enqueueCompiledSnapshot runs 1749 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1649 over it, 17.49× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: GalleryImageGrid.GalleryImageGrid invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx:409 — FunctionTooLong — GalleryImageGrid runs 1257 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1157 over it, 12.57× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: indexedDbDraftStore.createIndexedDbProjectDraftStore invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:90 — FunctionTooLong — createIndexedDbProjectDraftStore runs 1074 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 974 over it, 10.74× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: LayersTree.LayersTree invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx:169 — FunctionTooLong — LayersTree runs 918 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 818 over it, 9.18× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: useImageActions.useImageActions invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts:200 — FunctionTooLong — useImageActions runs 836 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 736 over it, 8.36× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: documentModel.createDocumentModel invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts:463 — FunctionTooLong — createDocumentModel runs 812 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 712 over it, 8.12× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: coordinator.createQueueCoordinator invokeai/frontend/webv2/src/features/queue/runtime/coordinator.ts:254 — FunctionTooLong — createQueueCoordinator runs 663 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 563 over it, 6.63× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: VideoWidgetView.VideoWidgetView invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx:131 — FunctionTooLong — VideoWidgetView runs 602 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 502 over it, 6.02× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: buildFLUXGraph.buildFLUXGraph invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildFLUXGraph.ts:55 — FunctionTooLong — buildFLUXGraph runs 598 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 498 over it, 5.98× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: draftStore.contract.testProjectDraftStoreContract invokeai/frontend/webv2/src/workbench/projects/draftStore.contract.ts:67 — FunctionTooLong — testProjectDraftStoreContract runs 596 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 496 over it, 5.96× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: draftStore.createMemoryProjectDraftStore invokeai/frontend/webv2/src/workbench/projects/draftStore.ts:907 — FunctionTooLong — createMemoryProjectDraftStore runs 563 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 463 over it, 5.63× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: modelSelected.addModelSelectedListener invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/modelSelected.ts:97 — FunctionTooLong — addModelSelectedListener runs 539 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 439 over it, 5.39× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: CanvasTextOverlay.TextEditor invokeai/frontend/webv1/src/features/controlLayers/components/Text/CanvasTextOverlay.tsx:95 — FunctionTooLong — TextEditor runs 522 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 422 over it, 5.22× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: unloadJournal.scenarios.testUnloadJournalScenarios invokeai/frontend/webv2/src/workbench/projects/unloadJournal.scenarios.ts:188 — FunctionTooLong — testUnloadJournalScenarios runs 511 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 411 over it, 5.11× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: useGalleryData.useGalleryData invokeai/frontend/webv2/src/features/gallery/ui/useGalleryData.ts:280 — FunctionTooLong — useGalleryData runs 493 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 393 over it, 4.93× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: persistenceRuntime.createWorkbenchPersistenceRuntime invokeai/frontend/webv2/src/workbench/persistenceRuntime.ts:142 — FunctionTooLong — createWorkbenchPersistenceRuntime runs 485 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 385 over it, 4.85× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: GalleryPickerView.GalleryPickerView invokeai/frontend/webv2/src/features/gallery/ui/picker/GalleryPickerView.tsx:67 — FunctionTooLong — GalleryPickerView runs 466 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 366 over it, 4.66× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: readiness.getReasonsWhyCannotEnqueueCanvasTab invokeai/frontend/webv1/src/features/queue/store/readiness.ts:773 — FunctionTooLong — getReasonsWhyCannotEnqueueCanvasTab runs 465 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 365 over it, 4.65× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: bitmapStore.createBitmapStore invokeai/frontend/webv2/src/workbench/canvas-engine/document/bitmapStore.ts:172 — FunctionTooLong — createBitmapStore runs 441 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 341 over it, 4.41× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: PreviewWidgetView.PreviewWidgetView invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx:196 — FunctionTooLong — PreviewWidgetView 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× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: FloatingWidgetWindow.FloatingWidgetWindow invokeai/frontend/webv2/src/workbench/widget-frame/FloatingWidgetWindow.tsx:357 — FunctionTooLong — FloatingWidgetWindow runs 387 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 287 over it, 3.87× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: FontsPage.FontLibrary invokeai/frontend/webv2/src/features/fonts/ui/FontsPage.tsx:291 — FunctionTooLong — FontLibrary runs 385 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 285 over it, 3.85× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: ReferenceImageCropDialog.ReferenceImageCropDialog invokeai/frontend/webv2/src/features/generation/ui/reference-images/ReferenceImageCropDialog.tsx:212 — FunctionTooLong — ReferenceImageCropDialog runs 385 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 285 over it, 3.85× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: ScrubberField.ScrubberField invokeai/frontend/webv2/src/platform/ui/ScrubberField.tsx:231 — FunctionTooLong — ScrubberField runs 381 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 281 over it, 3.81× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • + 337 more in this group — see findings.md.
D17 · Explicit Debt · TodoComment · ×267
  • TodoComment tests/test_graph_execution_state.py:3852 — # TODO: test completion with iterators/subgraphs — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment tests/test_invocation_cache_memory.py:24 — # TODO: when cache size is zero, should we consider it a miss? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment tests/test_node_graph.py:2132 — # TODO: test that derived types mixed with base types are compatible — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment tests/test_node_graph.py:2378 — # TODO: TEST INVALID ITERATOR SCENARIOS — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment tests/test_node_graph.py:2595 — # TODO: Graph serializes and deserializes — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment tests/backend/stable_diffusion/schedulers/test_schedulers.py:8 — # TODO(ryand): This feels like it should be a type check, but I couldn't find a clean way to do this and didn't want — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment tests/backend/model_manager/test_libc_util.py:11 — # TODO: Set the expected result preemptively based on the system properties. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment tests/backend/flux/controlnet/test_state_dict_utils.py:56 — # TODO(ryand): Figure out why some tests in this file are failing on the MacOS CI runners. It seems to be related to — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment tests/app/test_extract_metadata.py:49 — # TODO(psyche): The extract_metadata_from_image does not validate the graph correctly. See note in `extract_metadata.py`. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment scripts/new_architecture.py:76 — # TODO: every value below is a placeholder. The registry refuses to boot without these facets, but — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment scripts/new_architecture.py:79 — # TODO: the latent -> RGB projection for this VAE, one row per latent channel. If the architecture — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment scripts/new_architecture.py:88 — # TODO: latent channels; must equal len(...LATENT_RGB_FACTORS) — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment scripts/new_architecture.py:89 — # TODO: how much smaller a latent is than the image, per side — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment scripts/new_architecture.py:96 — # TODO: the class its text encoder produces. Reuse an existing one where the shape matches. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment scripts/new_architecture.py:98 — # TODO: what the generation sliders should say. Cite the model card in a comment. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment scripts/new_architecture.py:100 — # TODO: which of txt2img / img2img / inpaint / outpaint / t2v / i2v it can do, and the prefix — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment scripts/new_architecture.py:103 — # TODO: dimension_grid must equal the `multiple_of` on this architecture's denoise node. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment scripts/new_architecture.py:131 — # TODO: declare the starter models, then add them to STARTER_MODELS in this package's __init__.py. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment invokeai/frontend/webv1/knip.ts:12 — // TODO(psyche): maybe we can clean up these utils after canvas v2 release — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment invokeai/frontend/webv1/src/i18n.ts:6 — // TODO: Disabled for IDE performance issues with our translation JSON — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment invokeai/frontend/webv1/.storybook/preview.tsx:8 — // TODO: Disabled for IDE performance issues with our translation JSON — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment invokeai/frontend/webv1/src/features/system/components/SettingsModal/useClearIntermediates.ts:38 — // TODO(psyche): Do we need to reset things w/ canvas v2? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment invokeai/frontend/webv1/src/features/nodes/util/workflow/validateWorkflow.test.ts:76 — //TODO(psyche): Test workflow validation for form builder fields — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment invokeai/frontend/webv1/src/features/nodes/util/graph/generation/Graph.ts:270 — // TODO(psyche): figure out how to satisfy TS here without casting - this is _not_ an unsafe cast — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment invokeai/frontend/webv1/src/features/nodes/util/graph/generation/Graph.ts:328 — // TODO(psyche): Add more validation checks - cycles, valid invocation types, etc. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • + 242 more in this group — see findings.md.
D3 · God Classes · FileTooLong · ×183
  • FileTooLong: workbench/workbenchState.ts invokeai/frontend/webv2/src/workbench/workbenchState.ts — FileTooLong — 4455 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3955 over it, 8.91× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: shared/graph.py invokeai/app/services/shared/graph.py — FileTooLong — 3724 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3224 over it, 7.45× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: projects/durableSyncedPersistence.ts invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts — FileTooLong — 2947 significant lines (blank, comment-only and punctuation-only lines excluded), about 86% of them inside a single declaration: createDurableSyncedWorkbenchPersistence (573-3877). The bar is 500 significant lines; this is 2447 over it, 5.89× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: configs/main.py invokeai/backend/model_manager/configs/main.py — FileTooLong — 2489 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1989 over it, 4.98× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: scripts/mock-backend.mjs invokeai/frontend/webv2/scripts/mock-backend.mjs — FileTooLong — 2326 significant lines (blank, comment-only and punctuation-only lines excluded), about 68% of them inside a single declaration: startMockBackend (1164-3485). The bar is 500 significant lines; this is 1826 over it, 4.65× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: canvas-engine/engine.ts invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts — FileTooLong — 2297 significant lines (blank, comment-only and punctuation-only lines excluded), about 87% of them inside a single declaration: createCanvasEngine (353-3169). The bar is 500 significant lines; this is 1797 over it, 4.59× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: shared/graph_materializer.py invokeai/app/services/shared/graph_materializer.py — FileTooLong — 2090 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1590 over it, 4.18× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: model_install/model_install_default.py invokeai/app/services/model_install/model_install_default.py — FileTooLong — 2059 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1559 over it, 4.12× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: metadata/parsing.tsx invokeai/frontend/webv1/src/features/metadata/parsing.tsx — FileTooLong — 2034 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1534 over it, 4.07× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: core/baseGenerationPolicies.ts invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts — FileTooLong — 1903 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1403 over it, 3.81× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: queue/runtime.ts invokeai/frontend/webv2/src/features/queue/runtime.ts — FileTooLong — 1821 significant lines (blank, comment-only and punctuation-only lines excluded), about 83% of them inside a single declaration: createQueueRuntime (439-2620). The bar is 500 significant lines; this is 1321 over it, 3.64× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: fields/WorkflowFieldInput.tsx invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx — FileTooLong — 1712 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1212 over it, 3.42× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: ui/GalleryImageGrid.tsx invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx — FileTooLong — 1601 significant lines (blank, comment-only and punctuation-only lines excluded), about 79% of them inside a single declaration: GalleryImageGrid (409-2112). The bar is 500 significant lines; this is 1101 over it, 3.20× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: core/graph.ts invokeai/frontend/webv2/src/features/generation/core/graph.ts — FileTooLong — 1583 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1083 over it, 3.17× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: store/canvasSlice.ts invokeai/frontend/webv1/src/features/controlLayers/store/canvasSlice.ts — FileTooLong — 1548 significant lines (blank, comment-only and punctuation-only lines excluded), about 82% of them inside a single declaration: slice (113-1899). The bar is 500 significant lines; this is 1048 over it, 3.10× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: core/videoPolicies.ts invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts — FileTooLong — 1532 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1032 over it, 3.06× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: model_loaders/flux.py invokeai/backend/model_manager/load/model_loaders/flux.py — FileTooLong — 1494 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 994 over it, 2.99× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: shared/graph_validation.py invokeai/app/services/shared/graph_validation.py — FileTooLong — 1454 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 954 over it, 2.91× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: model_cache/model_cache.py invokeai/backend/model_manager/load/model_cache/model_cache.py — FileTooLong — 1427 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 927 over it, 2.85× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: working_memory_calibration/working_memory_calibration_default.py invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py — FileTooLong — 1413 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 913 over it, 2.83× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: projects/draftStore.ts invokeai/frontend/webv2/src/workbench/projects/draftStore.ts — FileTooLong — 1252 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 752 over it, 2.50× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: networks/pixeldit_official.py invokeai/backend/pid/_src/networks/pixeldit_official.py — FileTooLong — 1195 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 695 over it, 2.39× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: projects/indexedDbDraftStore.ts invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts — FileTooLong — 1189 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 689 over it, 2.38× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: types/field.ts invokeai/frontend/webv1/src/features/nodes/types/field.ts — FileTooLong — 1180 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 680 over it, 2.36× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: layers/LayerContextMenu.tsx invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx — FileTooLong — 1168 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 668 over it, 2.34× 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.
  • + 158 more in this group — see findings.md.
D10 · Test Quality · No assertions · ×131
  • No assertions: keeps a meaningful settings route when all global bindings are unassigned invokeai/frontend/webv2/src/workbench/widgets/shortcuts/ShortcutGuide.browser.test.tsx:247 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: labels properties guidance, keeps it through editable focus, hides beneath modals and forgets a switched project invokeai/frontend/webv2/src/workbench/widgets/shortcuts/ShortcutGuide.browser.test.tsx:352 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: describes the center canvas before the user presses or focuses anything invokeai/frontend/webv2/src/workbench/widgets/shortcuts/ShortcutGuide.browser.test.tsx:377 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: reports the selection position in the whole board while only the pages around it are loaded invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewNavigation.browser.test.tsx:2389 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: reports no position for a selection its stamped page does not hold until a step locates it invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewNavigation.browser.test.tsx:2410 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: keeps the position of a selection that moved onto an adjacent loaded page invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewNavigation.browser.test.tsx:2432 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: says why None has no settings invokeai/frontend/webv2/src/workbench/widgets/layers/ControlLayerSettings.browser.test.tsx:482 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: describes the Model choice with its caption invokeai/frontend/webv2/src/workbench/widgets/layers/ControlLayerSettings.browser.test.tsx:523 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: says on hover that FLUX ControlNets have no priority setting invokeai/frontend/webv2/src/workbench/widgets/layers/ControlLayerSettings.browser.test.tsx:799 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: disables both controls without an editable selection invokeai/frontend/webv2/src/workbench/widgets/layers/LayerBlendRow.browser.test.tsx:371 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: enables Filter as soon as the layer %s, without reselecting it invokeai/frontend/webv2/src/workbench/widgets/layers/LayerFilterOperationButton.browser.test.tsx:56 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: starts each Run workflow open from a fresh form invokeai/frontend/webv2/src/workbench/widgets/layers/LayerSurfaceHost.browser.test.tsx:249 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: shows the pair on the wheel and switches the editing target invokeai/frontend/webv2/src/workbench/widgets/layers/panes/LayerEditorPanes.browser.test.tsx:974 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: holds a canvas restore while results wait for review, but re-stages a Discard all point invokeai/frontend/webv2/src/workbench/widgets/layers/panes/LayerEditorPanes.browser.test.tsx:1189 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: explains a %s refusal with no offer invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasEditRefusalNotices.browser.test.tsx:90 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: replaces a repeated refusal without an offer, one toast per layer and reason invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasEditRefusalNotices.browser.test.tsx:105 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: brings the cleared canvas back from its Undo, even after a selection or bbox change invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasHeaderActions.browser.test.tsx:338 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: pads the masks by the project's mask blur plus 8 before snapping outward to the grid invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasHeaderActions.browser.test.tsx:477 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: drops what it cannot name: an empty canvas has no size, an unknown board no destination invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasHeaderActions.browser.test.tsx:548 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: takes no save while a create from the frame runs invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasHeaderActions.browser.test.tsx:558 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: is disabled while editing is locked invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasHeaderActions.browser.test.tsx:614 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: fits the frame to the layers, and offers no mask fit without a painted mask invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasHeaderActions.browser.test.tsx:690 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: keeps the fits unavailable while an operation holds the document invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasHeaderActions.browser.test.tsx:706 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: waits while another composite runs invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasHeaderActions.browser.test.tsx:742 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: name the step they would undo or redo, and plain Undo and Redo without one invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasHeaderActions.browser.test.tsx:752 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • + 106 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Repeated repair · ×63
  • Repeated repair: invokeai/backend/util/vae_working_memory.py invokeai/backend/util/vae_working_memory.py:561 — invokeai/backend/util/vae_working_memory.py changed 33 times in last 90 days and 17 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is vae_working_memory.estimate_vae_working_memory_sd15_sdxl at line 561), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(working-memory): reserve measured working memory for tiled VAE decodes and encodes (#9946)”; “fix(working-memory): reserve VAE working memory per dtype and allocator (#9898)”; “fix(wan): calibrate the VAE under the app's ROCm runtime”; “fix(wan): budget the video VAE decode against reserved memory”. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/backend/util/vae_working_memory.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: invokeai/app/services/shared/invocation_context.py invokeai/app/services/shared/invocation_context.py:273 — invokeai/app/services/shared/invocation_context.py changed 24 times in last 90 days and 13 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is ImagesInterface.save at line 273), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(images): keep cached images independent of node-held objects (#10138)”; “fix(images): display resolved inputs and preserve source graphs (#10035)”; “fix(model-manager): retry superseded loads in the load service”; “fix(model-manager): fence stale in-flight loads out of the cache”. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/app/services/shared/invocation_context.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: invokeai/backend/quantization/fp8_scaled.py invokeai/backend/quantization/fp8_scaled.py:581 — invokeai/backend/quantization/fp8_scaled.py changed 19 times in last 90 days and 12 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is fp8_scaled.extract_fp8_scaled_layers at line 581), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(fp8): keep the matmul probe off the forward path, probe CUDA for storage”; “fix(fp8): decide keep_fp8 once, derive the compute dtype from a float param”; “fix(loaders): refuse quantization payloads a plain scale fold cannot decode”; “fix(loaders): refuse a quantized checkpoint where no loader handles its scales”. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/backend/quantization/fp8_scaled.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: invokeai/app/api/routers/images.py invokeai/app/api/routers/images.py:109 — invokeai/app/api/routers/images.py changed 15 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is images.upload_image at line 109), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(images): display resolved inputs and preserve source graphs (#10035)”; “fix(intermediates): protect every saved reference and isolate force clears”; “fix(gallery): refresh the gallery when media is uploaded elsewhere”; “fix(images): make single-image and intermediate deletion transactional (#9361)”. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/app/api/routers/images.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: invokeai/app/services/shared/execution_state_migration.py invokeai/app/services/shared/execution_state_migration.py:42 — invokeai/app/services/shared/execution_state_migration.py changed 13 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is execution_state_migration._compact_effects at line 42), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(execution): harden queue and workflow state recovery”; “fix(execution): preserve loop state across rehydration”; “fix(execution): hide runtime ledgers from API schemas”; “fix(execution): preserve nullable Iterate checkpoints”. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/app/services/shared/execution_state_migration.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: invokeai/backend/architectures/capabilities.py invokeai/backend/architectures/capabilities.py:168 — invokeai/backend/architectures/capabilities.py changed 10 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is capabilities.architecture_capabilities at line 168), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: floor guidance and CFG at 1 everywhere”; “fix(architectures): backend owns VAE and scheduler policy; clear capability outage states”; “fix(architectures): serve only what webv2 reads, and per-variant Wan VAEs”; “fix(architectures): pin the latent space per base, and bound guidance from the node”. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/backend/architectures/capabilities.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: invokeai/app/services/images/images_default.py invokeai/app/services/images/images_default.py:65 — invokeai/app/services/images/images_default.py changed 12 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is ImageService.create at line 65), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(images): display resolved inputs and preserve source graphs (#10035)”; “fix(intermediates): protect every saved reference and isolate force clears”; “fix(images): make single-image and intermediate deletion transactional (#9361)”; “Fix image move recovery for unsupported thumbnail modes (#9497)”. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/app/services/images/images_default.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: invokeai/app/services/model_load/model_load_default.py invokeai/app/services/model_load/model_load_default.py:164 — invokeai/app/services/model_load/model_load_default.py changed 9 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is ModelLoadService.load_model at line 164), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(model-manager): refuse model loaders that bypass the stale-config check”; “fix(model-manager): retire per-model edit tracking once no edit or load needs it”; “fix(model-manager): keep the stale-load check off the database under MODEL_LOAD_LOCK”; “fix(model-manager): read the model record outside MODEL_LOAD_LOCK”. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/app/services/model_load/model_load_default.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: invokeai/app/services/image_files/image_files_disk.py invokeai/app/services/image_files/image_files_disk.py:239 — invokeai/app/services/image_files/image_files_disk.py changed 11 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is DiskImageFileStorage.save at line 239), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(images): keep cached images independent of node-held objects (#10138)”; “fix(images): display resolved inputs and preserve source graphs (#10035)”; “fix(models): install and start on drives without hard links (#10007)”; “fix(images): make single-image and intermediate deletion transactional (#9361)”. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/app/services/image_files/image_files_disk.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: invokeai/app/util/video_audio.py invokeai/app/util/video_audio.py:50 — invokeai/app/util/video_audio.py changed 8 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is video_audio.run_ffmpeg_process at line 50), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(audio): classify silent inputs without stderr matching (#9828)”; “fix(video): bound splice reads and walks, cancel audio decodes”; “fix(video): stop re-encoding the soundtrack kept by a trim”; “fix(video): stop re-encoding earlier segments when extending videos”. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/app/util/video_audio.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: invokeai/backend/util/wddm.py invokeai/backend/util/wddm.py:221 — invokeai/backend/util/wddm.py changed 8 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is wddm._resolve_adapter at line 221), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(vae): bound the pre-tiling ceiling by residency, not by usage Windows has paged out”; “fix(vae): tile on the budget and our own residency, not on an adapter counter”; “fix(vae): decide tiling on what other processes hold, not on the budget”; “fix(vae): price up-front tiling from the measured peak and a stable ceiling”. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/backend/util/wddm.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: invokeai/app/services/intermediates/intermediates_default.py invokeai/app/services/intermediates/intermediates_default.py:330 — invokeai/app/services/intermediates/intermediates_default.py changed 8 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is IntermediatesService._resolve_scope at line 330), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(intermediates): close review findings across queue privacy, deletion safety and UI”; “fix(intermediates): protect every saved reference and isolate force clears”; “fix(intermediates): protect child media and serialize video deletion”; “fix(intermediates): protect active and undo media during cleanup”. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/app/services/intermediates/intermediates_default.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: invokeai/frontend/webv2/src/features/models/data/relationshipsStore.ts invokeai/frontend/webv2/src/features/models/data/relationshipsStore.ts:96 — invokeai/frontend/webv2/src/features/models/data/relationshipsStore.ts changed 8 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is relationshipsStore.fetchRelatedKeys at line 96), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(ui): single-path relationship pruning on model deletes”; “fix(ui): drop relationship entries for models gone after a refresh”; “fix(ui): restore the relationships store to text”; “fix(ui): load the relationships store on first picker open”. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/models/data/relationshipsStore.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: invokeai/app/services/model_install/model_install_common.py invokeai/app/services/model_install/model_install_common.py:135 — invokeai/app/services/model_install/model_install_common.py changed 7 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is HFModelSource.__str__ at line 135), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(model-install): preserve install tmpdir when a single multi-file part fails (#9591)”; “fix(model-manager): preserve recovery state (#9915)”; “fix(model-manager): harden install lifecycle retries”; “fix(model-manager): harden recovery and cache invalidation”. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/app/services/model_install/model_install_common.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: invokeai/backend/minimax_h3/rocm_causal_conv3d.py invokeai/backend/minimax_h3/rocm_causal_conv3d.py:72 — invokeai/backend/minimax_h3/rocm_causal_conv3d.py changed 7 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 5 (its worst body is rocm_causal_conv3d._decomposed_forward at line 72), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(minimax-h3): hand MIOpen contiguous tensors in the conv3d decomposition”; “fix(wan): keep the ROCm conv3d decomposition on HIP 7.2 and hand MIOpen contiguous tensors”; “fix(rocm): keep the MiniMax H3 encoder conv3d decomposition on HIP >= 7.2”; “fix: retire the ROCm conv3d decompositions on HIP >= 7.2”. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/backend/minimax_h3/rocm_causal_conv3d.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: invokeai/frontend/webv2/src/features/generation/core/architectureCapabilities.ts invokeai/frontend/webv2/src/features/generation/core/architectureCapabilities.ts:78 — invokeai/frontend/webv2/src/features/generation/core/architectureCapabilities.ts changed 9 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is architectureCapabilities.toBaseGenerationConfig at line 78), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: floor guidance and CFG at 1 everywhere”; “fix(architectures): backend owns VAE and scheduler policy; clear capability outage states”; “fix(architectures): serve only what webv2 reads, and per-variant Wan VAEs”; “fix(webv2): fail closed everywhere, and give the VAE facet a reader”. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/generation/core/architectureCapabilities.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: invokeai/frontend/webv2/src/features/models/ui/detail/useModelActions.ts invokeai/frontend/webv2/src/features/models/ui/detail/useModelActions.ts:16 — invokeai/frontend/webv2/src/features/models/ui/detail/useModelActions.ts changed 8 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 1 (its worst body is useModelActions.useModelActions at line 16), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(ui): single-path relationship pruning on model deletes”; “fix(ui): refresh starter install flags after model deletes”; “fix(ui): make scoped actions report success and block re-entry”; “fix(ui): translate remaining model manager strings”. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/models/ui/detail/useModelActions.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: invokeai/backend/wan/rocm_causal_conv3d.py invokeai/backend/wan/rocm_causal_conv3d.py:96 — invokeai/backend/wan/rocm_causal_conv3d.py changed 6 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is rocm_causal_conv3d._verified_forward at line 96), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(rocm): make the offload, the budget lookup and the ROCm checks hold up”; “fix(wan): keep the ROCm conv3d decomposition on HIP 7.2 and hand MIOpen contiguous tensors”; “fix: retire the ROCm conv3d decompositions on HIP >= 7.2”; “fix: make ALL strided surfaces of the conv3d decompositions contiguous”. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/backend/wan/rocm_causal_conv3d.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: invokeai/frontend/webv2/src/features/workflow/data/savedWorkflowQueries.ts invokeai/frontend/webv2/src/features/workflow/data/savedWorkflowQueries.ts:54 — invokeai/frontend/webv2/src/features/workflow/data/savedWorkflowQueries.ts changed 5 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is savedWorkflowQueries.getSavedWorkflowDetailQueryStatus at line 54), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(webv2): refresh saved workflow picker after library changes”; “fix(webv2): repair saved workflow regressions”; “fix(webv2): harden saved workflow synchronization”; “fix(webv2): repair saved workflow integration”. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/frontend/webv2/src/features/workflow/data/savedWorkflowQueries.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: invokeai/app/invocations/ideal_size.py invokeai/app/invocations/ideal_size.py:51 — invokeai/app/invocations/ideal_size.py changed 5 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is IdealSizeInvocation.invoke at line 51), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(architectures): pin the latent space per base, and bound guidance from the node”; “fix(invocations): size Ideal Size from the declared canvas, not a squared width”; “fix(architectures): close the review findings on the facet registry”; “fix(architectures): resolve review findings in the architecture registry”. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/app/invocations/ideal_size.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: invokeai/frontend/webv2/src/workbench/canvas-operations/engineRegistry.ts invokeai/frontend/webv2/src/workbench/canvas-operations/engineRegistry.ts:170 — invokeai/frontend/webv2/src/workbench/canvas-operations/engineRegistry.ts changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is engineRegistry.createEngineRegistry.getOrCreateEngine at line 170), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(canvas): scope the paint barrier to document writes and never wait on open edits”; “fix(canvas): close raster-ownership review gaps”; “fix(intermediates): close review findings across queue privacy, deletion safety and UI”; “fix(intermediates): protect active and undo media during cleanup”. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/frontend/webv2/src/workbench/canvas-operations/engineRegistry.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: invokeai/app/services/image_records/image_records_base.py invokeai/app/services/image_records/image_records_base.py:24 — invokeai/app/services/image_records/image_records_base.py changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 1 (its worst body is ImageRecordStorageBase.get at line 24), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(intermediates): protect every saved reference and isolate force clears”; “fix(images): make single-image and intermediate deletion transactional (#9361)”; “fix: remove duplicate image record methods”; “fix(api): report partial failures and bound batch bodies on image routes (#9394)”. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/app/services/image_records/image_records_base.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: invokeai/app/services/videos/videos_base.py invokeai/app/services/videos/videos_base.py:37 — invokeai/app/services/videos/videos_base.py changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 2 (its worst body is VideoServiceABC._on_changed at line 37), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(intermediates): close review findings across queue privacy, deletion safety and UI”; “fix(videos): pick gallery thumbnails from a scored seek ladder”; “fix(media): centralize copy and deletion”; “fix(images,videos): make the media copy routes safe and non-blocking”. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/app/services/videos/videos_base.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: invokeai/frontend/webv2/src/workbench/projects/openProjectBroker.ts invokeai/frontend/webv2/src/workbench/projects/openProjectBroker.ts:51 — invokeai/frontend/webv2/src/workbench/projects/openProjectBroker.ts changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is openProjectBroker.createOpenProjectBroker.sync at line 51), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(canvas): scope the paint barrier to document writes and never wait on open edits”; “fix(webv2): report the real outcome of a push and a create”; “fix(webv2): remove the project-board dead ends left by the server owning boards”; “fix(webv2): hold every project-file surface to the rules it already documents”. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/frontend/webv2/src/workbench/projects/openProjectBroker.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: invokeai/app/util/video_encoding.py invokeai/app/util/video_encoding.py:45 — invokeai/app/util/video_encoding.py changed 5 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 5 (its worst body is video_encoding.make_mp4_writer at line 45), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(video): stop re-encoding the soundtrack kept by a trim”; “fix(video): bound splice parsing, compare whole sample entries, cancel splices”; “fix(video): stop re-encoding earlier segments when extending videos”; “fix(video): adversarial-review findings for audio muxing”. 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-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 00:15:28 -07:00' --until='2026-11-04 00:15:28 -07:00' --full-history --no-merges -- invokeai/app/util/video_encoding.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • + 38 more in this group — see findings.md.
D35 · Change Coupling · Change coupling · ×52
  • Change coupling: upscaling-tab-auto-layout.tsx ↔ workflows-tab-auto-layout.tsx invokeai/frontend/webv1/src/features/ui/layouts/upscaling-tab-auto-layout.tsx:1 — `invokeai/frontend/webv1/src/features/ui/layouts/upscaling-tab-auto-layout.tsx` and `invokeai/frontend/webv1/src/features/ui/layouts/workflows-tab-auto-layout.tsx` change together 96% of the time (23 of the 24 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 23 shared commits counted here, the most recent 3 are `8fec6add` fix(ui): keep main panel reachable on small screens (#9144) (at that commit the files were still `invokeai/frontend/web/src/features/ui/layouts/upscaling-tab-auto-layout.tsx` and `invokeai/frontend/web/src/features/ui/layouts/workflows-tab-auto-layout.tsx`); `4f3a5dcc` tidy(ui): remove unused progress related logic and components (at that commit the files were still `invokeai/frontend/web/src/features/ui/layouts/upscaling-tab-auto-layout.tsx` and `invokeai/frontend/web/src/features/ui/layouts/workflows-tab-auto-layout.tsx`); `96ee394f` refactor(ui): use dockview's own ser/de for persistence (at that commit the files were still `invokeai/frontend/web/src/features/ui/layouts/upscaling-tab-auto-layout.tsx` and `invokeai/frontend/web/src/features/ui/layouts/workflows-tab-auto-layout.tsx`) — run `git show` on any of them.
  • Change coupling: generate-tab-auto-layout.tsx ↔ upscaling-tab-auto-layout.tsx invokeai/frontend/webv1/src/features/ui/layouts/generate-tab-auto-layout.tsx:1 — `invokeai/frontend/webv1/src/features/ui/layouts/generate-tab-auto-layout.tsx` and `invokeai/frontend/webv1/src/features/ui/layouts/upscaling-tab-auto-layout.tsx` change together 96% of the time (23 of the 24 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 23 shared commits counted here, the most recent 3 are `8fec6add` fix(ui): keep main panel reachable on small screens (#9144) (at that commit the files were still `invokeai/frontend/web/src/features/ui/layouts/generate-tab-auto-layout.tsx` and `invokeai/frontend/web/src/features/ui/layouts/upscaling-tab-auto-layout.tsx`); `4f3a5dcc` tidy(ui): remove unused progress related logic and components (at that commit the files were still `invokeai/frontend/web/src/features/ui/layouts/generate-tab-auto-layout.tsx` and `invokeai/frontend/web/src/features/ui/layouts/upscaling-tab-auto-layout.tsx`); `96ee394f` refactor(ui): use dockview's own ser/de for persistence (at that commit the files were still `invokeai/frontend/web/src/features/ui/layouts/generate-tab-auto-layout.tsx` and `invokeai/frontend/web/src/features/ui/layouts/upscaling-tab-auto-layout.tsx`) — run `git show` on any of them.
  • Change coupling: CanvasAddEntityButtons.tsx ↔ EntityListGlobalActionBarAddLayerMenu.tsx invokeai/frontend/webv1/src/features/controlLayers/components/CanvasAddEntityButtons.tsx:1 — `invokeai/frontend/webv1/src/features/controlLayers/components/CanvasAddEntityButtons.tsx` and `invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/EntityListGlobalActionBarAddLayerMenu.tsx` change together 93% of the time (14 of the 15 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 14 shared commits counted here, the most recent 3 are `2b2f64b2` refactor(ui): simplify useIsEntityTypeEnabled (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/CanvasAddEntityButtons.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/CanvasEntityList/EntityListGlobalActionBarAddLayerMenu.tsx`); `8837932b` create hook for managing entity type enabledness for given base model… (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/CanvasAddEntityButtons.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/CanvasEntityList/EntityListGlobalActionBarAddLayerMenu.tsx`); `c259899b` feat(ui): support for FLUX Redux in canvas (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/CanvasAddEntityButtons.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/CanvasEntityList/EntityListGlobalActionBarAddLayerMenu.tsx`) — run `git show` on any of them.
  • Change coupling: generate-tab-auto-layout.tsx ↔ workflows-tab-auto-layout.tsx invokeai/frontend/webv1/src/features/ui/layouts/generate-tab-auto-layout.tsx:1 — `invokeai/frontend/webv1/src/features/ui/layouts/generate-tab-auto-layout.tsx` and `invokeai/frontend/webv1/src/features/ui/layouts/workflows-tab-auto-layout.tsx` change together 92% of the time (23 of the 25 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 23 shared commits counted here, the most recent 3 are `8fec6add` fix(ui): keep main panel reachable on small screens (#9144) (at that commit the files were still `invokeai/frontend/web/src/features/ui/layouts/generate-tab-auto-layout.tsx` and `invokeai/frontend/web/src/features/ui/layouts/workflows-tab-auto-layout.tsx`); `4f3a5dcc` tidy(ui): remove unused progress related logic and components (at that commit the files were still `invokeai/frontend/web/src/features/ui/layouts/generate-tab-auto-layout.tsx` and `invokeai/frontend/web/src/features/ui/layouts/workflows-tab-auto-layout.tsx`); `96ee394f` refactor(ui): use dockview's own ser/de for persistence (at that commit the files were still `invokeai/frontend/web/src/features/ui/layouts/generate-tab-auto-layout.tsx` and `invokeai/frontend/web/src/features/ui/layouts/workflows-tab-auto-layout.tsx`) — run `git show` on any of them.
  • Change coupling: NegativePromptField.tsx ↔ PositivePromptField.tsx invokeai/frontend/webv2/src/features/generation/ui/promptFields/NegativePromptField.tsx:1 — `invokeai/frontend/webv2/src/features/generation/ui/promptFields/NegativePromptField.tsx` and `invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptField.tsx` change together 87% of the time (13 of the 15 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 13 shared commits counted here, the most recent 3 are `0730324f` feat(webv2): show feature hints on generate and upscale fields; `d684fc28` fix: normalize prompt template view state; `c265016b` fix: preserve prompt behavior during template flattening — run `git show` on any of them.
  • Change coupling: CanvasSettingsPopover.tsx ↔ canvasSettingsSlice.ts invokeai/frontend/webv1/src/features/controlLayers/components/Settings/CanvasSettingsPopover.tsx:1 — `invokeai/frontend/webv1/src/features/controlLayers/components/Settings/CanvasSettingsPopover.tsx` and `invokeai/frontend/webv1/src/features/controlLayers/store/canvasSettingsSlice.ts` change together 86% of the time (12 of the 14 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 12 shared commits counted here, the most recent 3 are `340566c2` Feat(canvas): add pressure dependent opacity for brush (#9232) (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/Settings/CanvasSettingsPopover.tsx` and `invokeai/frontend/web/src/features/controlLayers/store/canvasSettingsSlice.ts`); `daa4fd75` ToolWidthPicker refactored (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/Settings/CanvasSettingsPopover.tsx` and `invokeai/frontend/web/src/features/controlLayers/store/canvasSettingsSlice.ts`); `3fd265c3` slider for brush and eraser tool (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/Settings/CanvasSettingsPopover.tsx` and `invokeai/frontend/web/src/features/controlLayers/store/canvasSettingsSlice.ts`) — run `git show` on any of them.
  • Change coupling: RefImageSettings.tsx ↔ RegionalGuidanceIPAdapterSettings.tsx invokeai/frontend/webv1/src/features/controlLayers/components/RefImage/RefImageSettings.tsx:1 — `invokeai/frontend/webv1/src/features/controlLayers/components/RefImage/RefImageSettings.tsx` and `invokeai/frontend/webv1/src/features/controlLayers/components/RegionalGuidance/RegionalGuidanceIPAdapterSettings.tsx` change together 75% of the time (12 of the 16 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 12 shared commits counted here, the most recent 3 are `e0d7a401` feat(ui): make ref images croppable (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/RefImage/RefImageSettings.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/RegionalGuidance/RegionalGuidanceIPAdapterSettings.tsx`); `56cd839d` feat(ui): support for ref images for chatgpt on canvas (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/IPAdapter/IPAdapterSettings.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/RegionalGuidance/RegionalGuidanceIPAdapterSettings.tsx`); `5956f96e` feat(ui): add flux redux image influence to canvas (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/IPAdapter/IPAdapterSettings.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/RegionalGuidance/RegionalGuidanceIPAdapterSettings.tsx`) — run `git show` on any of them.
  • Change coupling: boardIdSelected.ts ↔ onInvocationComplete.tsx invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/boardIdSelected.ts:1 — `invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/boardIdSelected.ts` and `invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx` change together 75% of the time (9 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `97844ed6` refactor(ui): item-owned reveal state machine with explicit selection… (at that commit the files were still `invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/boardIdSelected.ts` and `invokeai/frontend/web/src/services/events/onInvocationComplete.tsx`); `e431d249` fix(ui): don't strand the viewer under the progress overlay, for imag… (at that commit the files were still `invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/boardIdSelected.ts` and `invokeai/frontend/web/src/services/events/onInvocationComplete.tsx`); `c09dc8e1` tidy: removing unused code paths 3 (at that commit the files were still `invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/boardIdSelected.ts` and `invokeai/frontend/web/src/services/events/onInvocationComplete.tsx`) — run `git show` on any of them.
  • Change coupling: UpscalingLaunchpadPanel.tsx ↔ WorkflowsLaunchpadPanel.tsx invokeai/frontend/webv1/src/features/ui/layouts/UpscalingLaunchpadPanel.tsx:1 — `invokeai/frontend/webv1/src/features/ui/layouts/UpscalingLaunchpadPanel.tsx` and `invokeai/frontend/webv1/src/features/ui/layouts/WorkflowsLaunchpadPanel.tsx` change together 70% of the time (7 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `193de6a8` feat(ui): add launchpad container component (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/SimpleSession/UpscalingLaunchpadPanel.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/SimpleSession/WorkflowsLaunchpadPanel.tsx`); `8b8e29d2` Fixes & Styling updates (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/SimpleSession/UpscalingLaunchpadPanel.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/SimpleSession/WorkflowsLaunchpadPanel.tsx`); `46a56191` Update all text to translations (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/SimpleSession/UpscalingLaunchpadPanel.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/SimpleSession/WorkflowsLaunchpadPanel.tsx`) — run `git show` on any of them.
  • Change coupling: InpaintMaskMenuItems.tsx ↔ RasterLayerMenuItems.tsx invokeai/frontend/webv1/src/features/controlLayers/components/InpaintMask/InpaintMaskMenuItems.tsx:1 — `invokeai/frontend/webv1/src/features/controlLayers/components/InpaintMask/InpaintMaskMenuItems.tsx` and `invokeai/frontend/webv1/src/features/controlLayers/components/RasterLayer/RasterLayerMenuItems.tsx` change together 70% of the time (7 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `bd6ff3de` feat(ui): add merge down for all entity types (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/InpaintMask/InpaintMaskMenuItems.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/RasterLayer/RasterLayerMenuItems.tsx`); `56222a84` feat(ui): organize layer context menu items (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/InpaintMask/InpaintMaskMenuItems.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/RasterLayer/RasterLayerMenuItems.tsx`); `7211d1a6` feat(ui): add context menu options for layer type convert/copy (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/InpaintMask/InpaintMaskMenuItems.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/RasterLayer/RasterLayerMenuItems.tsx`) — run `git show` on any of them.
  • Change coupling: denoise_latents.py ↔ tiled_multi_diffusion_denoise_latents.py invokeai/app/invocations/denoise_latents.py:1 — `invokeai/app/invocations/denoise_latents.py` and `invokeai/app/invocations/tiled_multi_diffusion_denoise_latents.py` change together 69% of the time (9 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `58e859dc` fix(fp8): resolve compute dtype instead of reading model.dtype (#9412); `8d3743c6` tidy(nodes): rename `controlnet_image_processors.py` -> `controlnet.py`; `830880a6` chore(nodes): update titles of all model-specific nodes to reference … — run `git show` on any of them.
  • Change coupling: WorkflowLibrarySideNav.tsx ↔ WorkflowList.tsx invokeai/frontend/webv1/src/features/nodes/components/sidePanel/workflow/WorkflowLibrary/WorkflowLibrarySideNav.tsx:1 — `invokeai/frontend/webv1/src/features/nodes/components/sidePanel/workflow/WorkflowLibrary/WorkflowLibrarySideNav.tsx` and `invokeai/frontend/webv1/src/features/nodes/components/sidePanel/workflow/WorkflowLibrary/WorkflowList.tsx` change together 69% of the time (9 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `2be701cf` Feature: Add Tag System for user made Workflows (#8673) (at that commit the files were still `invokeai/frontend/web/src/features/nodes/components/sidePanel/workflow/WorkflowLibrary/WorkflowLibrarySideNav.tsx` and `invokeai/frontend/web/src/features/nodes/components/sidePanel/workflow/WorkflowLibrary/WorkflowList.tsx`); `97593f95` feat(ui): on first load, if the selected library view has no workflow… (at that commit the files were still `invokeai/frontend/web/src/features/nodes/components/sidePanel/workflow/WorkflowLibrary/WorkflowLibrarySideNav.tsx` and `invokeai/frontend/web/src/features/nodes/components/sidePanel/workflow/WorkflowLibrary/WorkflowList.tsx`); `afd894fd` update recent workflows UI (at that commit the files were still `invokeai/frontend/web/src/features/nodes/components/sidePanel/workflow/WorkflowLibrary/WorkflowLibrarySideNav.tsx` and `invokeai/frontend/web/src/features/nodes/components/sidePanel/workflow/WorkflowLibrary/WorkflowList.tsx`) — run `git show` on any of them.
  • Change coupling: z_image_denoise.py ↔ buildZImageGraph.ts invokeai/app/invocations/z_image_denoise.py:1 — `invokeai/app/invocations/z_image_denoise.py` and `invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildZImageGraph.ts` change together 69% of the time (9 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `a3507121` feat: add configurable shift parameter for Z-Image (#9004) (at that commit the file was still `invokeai/frontend/web/src/features/nodes/util/graph/generation/buildZImageGraph.ts`); `689953e3` Feature/zimage scheduler support (#8705) (at that commit the file was still `invokeai/frontend/web/src/features/nodes/util/graph/generation/buildZImageGraph.ts`); `132a4849` feat(z-image): add scheduler support with metadata recall (at that commit the file was still `invokeai/frontend/web/src/features/nodes/util/graph/generation/buildZImageGraph.ts`) — run `git show` on any of them.
  • Change coupling: videoPolicies.ts ↔ videoRecall.ts invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:1 — `invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts` and `invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts` change together 67% of the time (10 of the 15 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 10 shared commits counted here, the most recent 3 are `97c0adaa` feat(video): let LTX-2 soundtrack conditioning keep first and last fr…; `9c8b2338` fix: floor guidance and CFG at 1 everywhere; `b37b0091` fix(webv2): restore LTX-2 dev's negative prompt when the panel carrie… — run `git show` on any of them.
  • Change coupling: compel.py ↔ sd3_text_encoder.py invokeai/app/invocations/compel.py:1 — `invokeai/app/invocations/compel.py` and `invokeai/app/invocations/sd3_text_encoder.py` change together 65% of the time (11 of the 17 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 11 shared commits counted here, the most recent 3 are `68b90174` Fix: compute device partial load (#9375); `ee600973` Broaden text encoder partial-load recovery (#9034); `76b08380` Feature(backend): Add user toggle to run encoder models on CPU (#8777) — run `git show` on any of them.
  • Change coupling: CanvasLaunchpadPanel.tsx ↔ GenerateLaunchpadPanel.tsx invokeai/frontend/webv1/src/features/ui/layouts/CanvasLaunchpadPanel.tsx:1 — `invokeai/frontend/webv1/src/features/ui/layouts/CanvasLaunchpadPanel.tsx` and `invokeai/frontend/webv1/src/features/ui/layouts/GenerateLaunchpadPanel.tsx` change together 64% of the time (7 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `193de6a8` feat(ui): add launchpad container component (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/SimpleSession/CanvasLaunchpadPanel.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/SimpleSession/GenerateLaunchpadPanel.tsx`); `e73150c3` feat(ui): improved automatic tab/panel switching on user actions (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/SimpleSession/CanvasLaunchpadPanel.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/SimpleSession/GenerateLaunchpadPanel.tsx`); `3f1b2c39` Model Guide link update (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/SimpleSession/CanvasLaunchpadPanel.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/SimpleSession/GenerateLaunchpadPanel.tsx`) — run `git show` on any of them.
  • Change coupling: GeneratePromptFields.tsx ↔ PositivePromptActions.tsx invokeai/frontend/webv2/src/features/generation/ui/promptFields/GeneratePromptFields.tsx:1 — `invokeai/frontend/webv2/src/features/generation/ui/promptFields/GeneratePromptFields.tsx` and `invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx` change together 62% of the time (8 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `dd48b768` feat(webv2): default and remember the prompt tool models; `3d65cd11` feat(generate): rework prompt fields; `c265016b` fix: preserve prompt behavior during template flattening — run `git show` on any of them.
  • Change coupling: ModelBaseBadge.tsx ↔ REDACTED invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelManagerPanel/ModelBaseBadge.tsx:1 — `invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelManagerPanel/ModelBaseBadge.tsx` and `invokeai/frontend/webv1/src/features/parameters/types/constants.ts` change together 60% of the time (12 of the 20 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 12 shared commits counted here, the most recent 3 are `30619c04` add runway back as a model and allow runway and veo3 to live together… (at that commit the files were still `invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelManagerPanel/ModelBaseBadge.tsx` and `invokeai/frontend/web/src/features/parameters/types/constants.ts`); `6370412e` tsc (at that commit the files were still `invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelManagerPanel/ModelBaseBadge.tsx` and `invokeai/frontend/web/src/features/parameters/types/constants.ts`); `406e0be3` Revert "tsc" (at that commit the files were still `invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelManagerPanel/ModelBaseBadge.tsx` and `invokeai/frontend/web/src/features/parameters/types/constants.ts`) — run `git show` on any of them.
  • Change coupling: types.ts ↔ onInvocationComplete.tsx invokeai/frontend/webv1/src/features/gallery/store/types.ts:1 — `invokeai/frontend/webv1/src/features/gallery/store/types.ts` and `invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `e77c0d12` feat: Add virtual boards that dynamically group images by date (#8971) (at that commit the files were still `invokeai/frontend/web/src/features/gallery/store/types.ts` and `invokeai/frontend/web/src/services/events/onInvocationComplete.tsx`); `c09dc8e1` tidy: removing unused code paths 3 (at that commit the files were still `invokeai/frontend/web/src/features/gallery/store/types.ts` and `invokeai/frontend/web/src/services/events/onInvocationComplete.tsx`); `895eac6b` integrating video into gallery - thinking maybe a new category of ima… (at that commit the files were still `invokeai/frontend/web/src/features/gallery/store/types.ts` and `invokeai/frontend/web/src/services/events/onInvocationComplete.tsx`) — run `git show` on any of them.
  • Change coupling: index.ts ↔ executeVideoRecall.ts invokeai/frontend/webv2/src/features/video/index.ts:1 — `invokeai/frontend/webv2/src/features/video/index.ts` and `invokeai/frontend/webv2/src/workbench/image-actions/executeVideoRecall.ts` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `f9b5e99a` feat(video): place a gallery image in the Video panel from the recall…; `97c0adaa` feat(video): let LTX-2 soundtrack conditioning keep first and last fr…; `701b657d` feat(video-recall): place a video as the LTX-2 conditioning clip — run `git show` on any of them.
  • Change coupling: Filter.tsx ↔ Transform.tsx invokeai/frontend/webv1/src/features/controlLayers/components/Filters/Filter.tsx:1 — `invokeai/frontend/webv1/src/features/controlLayers/components/Filters/Filter.tsx` and `invokeai/frontend/webv1/src/features/controlLayers/components/Transform/Transform.tsx` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `b7510ce7` feat(ui): filter, select object and transform UI buttons (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/Filters/Filter.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/Transform/Transform.tsx`); `7f2c83b9` feat(ui): consolidate isolated preview settings (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/Filters/Filter.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/Transform/Transform.tsx`); `6efa1597` feat(ui): focus canvas on filter/transform (at that commit the files were still `invokeai/frontend/web/src/features/controlLayers/components/Filters/Filter.tsx` and `invokeai/frontend/web/src/features/controlLayers/components/Transform/Transform.tsx`) — run `git show` on any of them.
  • Change coupling: assetTransport.ts ↔ projectFile.ts invokeai/frontend/webv2/src/workbench/projects/invk/assetTransport.ts:1 — `invokeai/frontend/webv2/src/workbench/projects/invk/assetTransport.ts` and `invokeai/frontend/webv2/src/workbench/projects/projectFile.ts` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `6a0b0a62` fix(projects): clear references to deleted boards when a project loads; `ea2210ce` refactor(projects): share the duplicated transport, walker and quaran…; `b79742cd` fix(projects): harden media restoration — run `git show` on any of them.
  • Change coupling: load_default.py ↔ MainModelDefaultSettings.tsx invokeai/backend/model_manager/load/load_default.py:1 — `invokeai/backend/model_manager/load/load_default.py` and `invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/MainModelDefaultSettings.tsx` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `6706a708` feat(models): enable FP8 storage for FP8 checkpoints at install (at that commit the file was still `invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/MainModelDefaultSettings.tsx`); `57c85344` fix(fp8): never apply FP8 storage to already-quantized weights (#9416) (at that commit the file was still `invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/MainModelDefaultSettings.tsx`); `b06e57e6` feat(fp8): enable FP8 storage for Z-Image (#9414) (at that commit the file was still `invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/MainModelDefaultSettings.tsx`) — run `git show` on any of them.
  • Change coupling: images_base.py ↔ GalleryImageGrid.tsx invokeai/app/services/images/images_base.py:1 — `invokeai/app/services/images/images_base.py` and `invokeai/frontend/webv1/src/features/gallery/components/GalleryImageGrid.tsx` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `ab5cb2c2` refactor: optimistic gallery updates (at that commit the file was still `invokeai/frontend/web/src/features/gallery/components/NewGallery.tsx`); `b2b42be5` refactor: remove unused methods/routes, fix some gallery invalidation… (at that commit the file was still `invokeai/frontend/web/src/features/gallery/components/NewGallery.tsx`); `f68d8ed3` refactor: gallery scroll (improved impl) (at that commit the file was still `invokeai/frontend/web/src/features/gallery/components/NewGallery.tsx`) — run `git show` on any of them.
  • Change coupling: common.ts ↔ DimensionsAspectRatioSelect.tsx invokeai/frontend/webv1/src/features/nodes/types/common.ts:1 — `invokeai/frontend/webv1/src/features/nodes/types/common.ts` and `invokeai/frontend/webv1/src/features/parameters/components/Dimensions/DimensionsAspectRatioSelect.tsx` change together 59% of the time (10 of the 17 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 10 shared commits counted here, the most recent 3 are `299a4db3` chore(ui): lint (at that commit the files were still `invokeai/frontend/web/src/features/nodes/types/common.ts` and `invokeai/frontend/web/src/features/parameters/components/Dimensions/DimensionsAspectRatioSelect.tsx`); `30619c04` add runway back as a model and allow runway and veo3 to live together… (at that commit the files were still `invokeai/frontend/web/src/features/nodes/types/common.ts` and `invokeai/frontend/web/src/features/parameters/components/Dimensions/DimensionsAspectRatioSelect.tsx`); `e046417c` replace runway with veo, build out veo3 model support (at that commit the files were still `invokeai/frontend/web/src/features/nodes/types/common.ts` and `invokeai/frontend/web/src/features/parameters/components/Dimensions/DimensionsAspectRatioSelect.tsx`) — run `git show` on any of them.
  • + 27 more in this group — see findings.md.
AX7 · Slice cohesion · Cross-slice coupling · ×40
  • Cross-slice coupling: auth → toast invokeai/frontend/webv1/src/features/auth/components/UserMenu.tsx:32 — `UserMenu` (slice 'auth') depends on `toast` from slice 'toast'.
  • Cross-slice coupling: changeBoardModal → gallery invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:44 — `ChangeBoardModal` (slice 'changeBoardModal') depends on `selectSelectedBoardId` from slice 'gallery'.
  • Cross-slice coupling: changeBoardModal → auth invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:45 — `ChangeBoardModal` (slice 'changeBoardModal') depends on `selectCurrentUser` from slice 'auth'.
  • Cross-slice coupling: changeBoardModal → auth invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:92 — `ChangeBoardModal` (slice 'changeBoardModal') depends on `captureAuthContext` from slice 'auth'.
  • Cross-slice coupling: changeBoardModal → auth invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:135 — `ChangeBoardModal` (slice 'changeBoardModal') depends on `isSameAuthContext` from slice 'auth'.
  • Cross-slice coupling: changeBoardModal → toast invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:148 — `ChangeBoardModal` (slice 'changeBoardModal') depends on `toast` from slice 'toast'.
  • Cross-slice coupling: controlLayers → system invokeai/frontend/webv1/src/features/controlLayers/components/CanvasAlerts/CanvasAlertsInvocationProgress.tsx:45 — `CanvasAlertsInvocationProgress` (slice 'controlLayers') depends on `selectSystemShouldShowInvocationProgressDetail` from slice 'system'.
  • Cross-slice coupling: controlLayers → dnd invokeai/frontend/webv1/src/features/controlLayers/components/CanvasDropArea.tsx:9 — `addRasterLayerFromImageDndTargetData` (slice 'controlLayers') depends on `newCanvasEntityFromImageDndTarget` from slice 'dnd'.
  • Cross-slice coupling: controlLayers → dnd invokeai/frontend/webv1/src/features/controlLayers/components/CanvasDropArea.tsx:43 — `CanvasDropArea` (slice 'controlLayers') depends on `DndDropTarget` from slice 'dnd'.
  • Cross-slice coupling: controlLayers → dnd invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/CanvasEntityContainer.tsx:54 — `CanvasEntityContainer` (slice 'controlLayers') depends on `DndListDropIndicator` from slice 'dnd'.
  • Cross-slice coupling: controlLayers → dnd invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/CanvasEntityGroupList.tsx:40 — `CanvasEntityGroupList` (slice 'controlLayers') depends on `singleCanvasEntityDndSource` from slice 'dnd'.
  • Cross-slice coupling: controlLayers → dnd invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/CanvasEntityGroupList.tsx:114 — `CanvasEntityGroupList` (slice 'controlLayers') depends on `triggerPostMoveFlash` from slice 'dnd'.
  • Cross-slice coupling: controlLayers → dnd invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/useCanvasEntityListDnd.ts:15 — `useCanvasEntityListDnd` (slice 'controlLayers') depends on `DndListTargetState` from slice 'dnd'.
  • Cross-slice coupling: controlLayers → dnd invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/useCanvasEntityListDnd.ts:15 — `useCanvasEntityListDnd` (slice 'controlLayers') depends on `idle` from slice 'dnd'.
  • Cross-slice coupling: controlLayers → dnd invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/useCanvasEntityListDnd.ts:24 — `useCanvasEntityListDnd` (slice 'controlLayers') depends on `dndInputFix` from slice 'dnd'.
  • Cross-slice coupling: controlLayers → dnd invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/useCanvasEntityListDnd.ts:28 — `useCanvasEntityListDnd` (slice 'controlLayers') depends on `singleCanvasEntityDndSource` from slice 'dnd'.
  • Cross-slice coupling: controlLayers → gallery invokeai/frontend/webv1/src/features/controlLayers/components/CanvasPasteModal.tsx:35 — `CanvasPasteModal` (slice 'controlLayers') depends on `selectAutoAddBoardId` from slice 'gallery'.
  • Cross-slice coupling: controlLayers → imageActions invokeai/frontend/webv1/src/features/controlLayers/components/CanvasPasteModal.tsx:68 — `CanvasPasteModal` (slice 'controlLayers') depends on `createNewCanvasEntityFromImage` from slice 'imageActions'.
  • Cross-slice coupling: controlLayers → toast invokeai/frontend/webv1/src/features/controlLayers/components/CanvasPasteModal.tsx:77 — `CanvasPasteModal` (slice 'controlLayers') depends on `toast` from slice 'toast'.
  • Cross-slice coupling: controlLayers → nodes invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:47 — `WorkflowFieldRendererProps` (slice 'controlLayers') depends on `NodeFieldElement` from slice 'nodes'.
  • Cross-slice coupling: controlLayers → nodes invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:56 — `WorkflowFieldRenderer` (slice 'controlLayers') depends on `$templates` from slice 'nodes'.
  • Cross-slice coupling: controlLayers → parameters invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:162 — `WorkflowFieldRenderer` (slice 'controlLayers') depends on `isParameterScheduler` from slice 'parameters'.
  • Cross-slice coupling: controlLayers → parameters invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:170 — `WorkflowFieldRenderer` (slice 'controlLayers') depends on `SCHEDULER_OPTIONS` from slice 'parameters'.
  • Cross-slice coupling: controlLayers → nodes invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:411 — `WorkflowFieldRenderer` (slice 'controlLayers') depends on `ModelFieldCombobox` from slice 'nodes'.
  • Cross-slice coupling: controlLayers → dnd invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:518 — `ImageFieldComponent` (slice 'controlLayers') depends on `DndImage` from slice 'dnd'.
  • + 15 more in this group — see findings.md.
R4 · Test Coverage · No test reaches this file · ×40
  • No test reaches this file invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasToolModule.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasShapeToolModule.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file invokeai/frontend/webv2/scripts/measure-architecture-performance.mjs:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasCompositorModule.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file invokeai/frontend/webv1/src/features/controlLayers/components/Text/CanvasTextOverlay.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasStageModule.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityObjectRenderer.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file invokeai/frontend/webv1/src/features/controlLayers/store/filters.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file invokeai/frontend/webv1/src/features/nodes/components/flow/Flow.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityAdapterBase.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file invokeai/frontend/webv1/src/features/auth/components/UserManagement.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasStateApiModule.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file invokeai/frontend/webv1/src/features/controlLayers/components/Text/TextToolOptions.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file invokeai/frontend/webv1/src/features/nodes/components/sidePanel/builder/dnd-hooks.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file invokeai/frontend/webv1/src/features/nodes/components/flow/AddNodeCmdk/AddNodeCmdk.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file invokeai/frontend/webv1/src/features/system/components/HotkeysModal/HotkeyListItem.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/AddModelPanel/ModelInstallQueue/ModelInstallQueueItem.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasLassoToolModule.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityFilterer.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasBboxToolModule.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasTextToolModule.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file invokeai/frontend/webv1/src/features/gallery/components/GalleryImageGrid.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file invokeai/frontend/webv1/src/features/controlLayers/components/Tool/ToolWidthPicker.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • + 15 more in this group — see findings.md.
X3 · Exception handling · Swallowed exception (empty catch) · ×32
  • Swallowed exception (empty catch) invokeai/frontend/webv2/src/workbench/bootWidgetPreload.ts:41 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) invokeai/frontend/webv2/src/workbench/performanceMarks.ts:33 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) invokeai/frontend/webv2/src/workbench/widgets/preview/loupeGestures.ts:32 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.tsx:545 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.tsx:637 — `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
  • Swallowed exception (empty catch) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.tsx:692 — `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
  • Swallowed exception (empty catch) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.tsx:827 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewSwipeNeighbor.tsx:116 — `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
  • Swallowed exception (empty catch) invokeai/frontend/webv2/src/workbench/widgets/layers/runLayerWorkflow.ts:190 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) invokeai/frontend/webv2/src/workbench/widgets/layers/useLayerSelectionCommands.ts:64 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx:400 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerGroupContextMenu.tsx:192 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) invokeai/frontend/webv2/src/workbench/widgets/image-map/useSelectMapImage.ts:47 — `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
  • Swallowed exception (empty catch) invokeai/frontend/webv2/src/workbench/widgets/image-map/useSelectMapImage.ts:96 — `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
  • Swallowed exception (empty catch) invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapPlot.tsx:64 — `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
  • Swallowed exception (empty catch) invokeai/frontend/webv2/src/workbench/widgets/canvas/toolFamilyStore.ts:33 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) invokeai/frontend/webv2/src/workbench/widgets/canvas/ToolStripFlyout.tsx:106 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-presentation/propertyGroupStore.ts:34 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-presentation/propertyGroupStore.ts:47 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) invokeai/frontend/webv2/src/workbench/widget-frame/FloatingWidgetWindow.tsx:161 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) invokeai/frontend/webv2/src/workbench/shell/topbar/InvokeButton.tsx:170 — `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
  • Swallowed exception (empty catch) invokeai/frontend/webv2/src/workbench/settings/store.ts:840 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) invokeai/frontend/webv2/src/workbench/queue-integration/queueRunJournal.ts:119 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) invokeai/frontend/webv2/src/workbench/projects/api.ts:475 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:3039 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • + 7 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×31
  • Duplicated block (7 lines × 2) invokeai/app/api/routers/utilities.py:213 — invokeai/app/api/routers/utilities.py:213-219 | invokeai/app/services/fonts/fonts_parsing.py:119-125 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) invokeai/app/api/routers/videos.py:1127 — invokeai/app/api/routers/videos.py:1127-1133 | invokeai/app/api/routers/videos.py:1155-1161 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/api/routers/videos.py:1127` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) invokeai/app/api/routers/workflows.py:487 — invokeai/app/api/routers/workflows.py:487-493 | invokeai/app/api/routers/workflows.py:508-514 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) invokeai/app/invocations/flux/flux_denoise.py:597 — invokeai/app/invocations/flux/flux_denoise.py:597-603 | invokeai/app/invocations/flux/flux_denoise.py:635-641 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) invokeai/app/invocations/flux2/flux2_denoise.py:666 — invokeai/app/invocations/flux2/flux2_denoise.py:666-672 | invokeai/app/invocations/qwen_image/qwen_image_denoise.py:791-797 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/flux2/flux2_denoise.py:666` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) invokeai/app/invocations/image.py:1228 — invokeai/app/invocations/image.py:1228-1234 | invokeai/app/invocations/image.py:1304-1310 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `invokeai/app/invocations/image.py:1313` calls `_prepare_mask`, `get_pil` and `invokeai/app/invocations/image.py:1237` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 2) invokeai/app/invocations/model.py:448 — invokeai/app/invocations/model.py:448-454 | invokeai/app/invocations/model.py:608-614 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) invokeai/app/invocations/model.py:551 — invokeai/app/invocations/model.py:551-557 | invokeai/app/invocations/model.py:715-721 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) invokeai/app/invocations/vae/flux2_vae_decode.py:149 — invokeai/app/invocations/vae/flux2_vae_decode.py:149-155 | invokeai/app/invocations/vae/flux_vae_decode.py:154-160 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (7 lines × 2) invokeai/app/invocations/vae/wan_latents_to_video.py:211 — invokeai/app/invocations/vae/wan_latents_to_video.py:211-217 | invokeai/app/invocations/vae/wan_latents_to_video.py:242-248 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `invokeai/app/invocations/vae/wan_latents_to_video.py:218` calls `iter_wan_vae_decode_chunks`, `cpu` and `invokeai/app/invocations/vae/wan_latents_to_video.py:249` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 2) invokeai/app/services/shared/execution_engine/scheduler.py:379 — invokeai/app/services/shared/execution_engine/scheduler.py:379-385 | invokeai/app/services/shared/execution_engine/scheduler.py:423-429 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/app/services/shared/execution_engine/scheduler.py:378` calls `add` and `invokeai/app/services/shared/execution_engine/scheduler.py:422` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 2) invokeai/backend/anima/anima_transformer.py:273 — invokeai/backend/anima/anima_transformer.py:273-279 | invokeai/backend/anima/anima_transformer_patch.py:36-42 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (7 lines × 2) invokeai/backend/ernie_image/denoise.py:125 — invokeai/backend/ernie_image/denoise.py:125-131 | invokeai/backend/ernie_image/denoise.py:171-177 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) invokeai/backend/flux/controlnet/state_dict_utils.py:90 — invokeai/backend/flux/controlnet/state_dict_utils.py:90-96 | invokeai/backend/flux/controlnet/state_dict_utils.py:152-169 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/flux/controlnet/state_dict_utils.py:90` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/backend/flux/controlnet/state_dict_utils.py:151` calls `pop` and `invokeai/backend/flux/controlnet/state_dict_utils.py:89` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 2) invokeai/backend/flux/custom_block_processor.py:27 — invokeai/backend/flux/custom_block_processor.py:27-33 | invokeai/backend/flux/ip_adapter/ip_double_stream_block_processor.py:41-47 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/flux/ip_adapter/ip_double_stream_block_processor.py:41` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (7 lines × 2) invokeai/backend/image_util/hed.py:138 — invokeai/backend/image_util/hed.py:138-144 | invokeai/backend/image_util/hed.py:207-213 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/backend/image_util/hed.py:133` calls `normalize_image_channel_count`, `resize_image_to_resolution` and `invokeai/backend/image_util/hed.py:205` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 2) invokeai/backend/minimax_h3/rocm_causal_conv3d.py:62 — invokeai/backend/minimax_h3/rocm_causal_conv3d.py:62-68 | invokeai/backend/wan/rocm_causal_conv3d.py:56-62 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) invokeai/backend/model_manager/load/model_loaders/flux.py:2239 — invokeai/backend/model_manager/load/model_loaders/flux.py:2239-2245 | invokeai/backend/model_manager/load/model_loaders/flux.py:2295-2312 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/model_manager/load/model_loaders/flux.py:2239` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/backend/model_manager/load/model_loaders/flux.py:2294` calls `pop` and `invokeai/backend/model_manager/load/model_loaders/flux.py:2238` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 2) invokeai/backend/model_manager/load/model_loaders/flux.py:2272 — invokeai/backend/model_manager/load/model_loaders/flux.py:2272-2278 | invokeai/backend/model_manager/load/model_loaders/flux.py:2298-2317 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/model_manager/load/model_loaders/flux.py:2272` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) invokeai/backend/model_manager/load/model_loaders/krea2.py:1232 — invokeai/backend/model_manager/load/model_loaders/krea2.py:1232-1242 | invokeai/backend/model_manager/load/model_loaders/qwen_image.py:337-343 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/backend/model_manager/load/model_loaders/qwen_image.py:336` calls `info` and `invokeai/backend/model_manager/load/model_loaders/krea2.py:1231` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 2) invokeai/backend/pid/_src/networks/pixeldit_official.py:344 — invokeai/backend/pid/_src/networks/pixeldit_official.py:344-350 | invokeai/backend/pid/_src/networks/pixeldit_official.py:355-361 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) invokeai/backend/stable_diffusion/diffusers_pipeline.py:593 — invokeai/backend/stable_diffusion/diffusers_pipeline.py:593-599 | invokeai/backend/stable_diffusion/extensions/rescale_cfg.py:21-27 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (7 lines × 2) invokeai/app/services/gallery_maintenance/gallery_maintenance_default.py:966 — invokeai/app/services/gallery_maintenance/gallery_maintenance_default.py:966-972 | invokeai/app/services/video_files/video_files_disk.py:241-247 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) invokeai/app/services/model_records/model_records_base.py:92 — invokeai/app/services/model_records/model_records_base.py:92-98 | invokeai/backend/model_manager/configs/base.py:88-94 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) invokeai/backend/util/devices.py:435 — invokeai/backend/util/devices.py:435-441 | invokeai/backend/working_memory/counters.py:242-248 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • + 6 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×31
  • Duplicated block (6 lines × 2) invokeai/app/api/routers/model_manager.py:843 — invokeai/app/api/routers/model_manager.py:843-848 | invokeai/app/api/routers/model_manager.py:888-893 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) invokeai/app/invocations/baseinvocation.py:793 — invokeai/app/invocations/baseinvocation.py:793-798 | invokeai/app/invocations/baseinvocation.py:921-926 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `cls` to `Type[TBaseInvocation]` in one and `Type[TBaseInvocationOutput]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (6 lines × 2) invokeai/app/invocations/flux/flux_denoise.py:586 — invokeai/app/invocations/flux/flux_denoise.py:586-592 | invokeai/app/invocations/flux2/flux2_denoise.py:698-703 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/app/invocations/flux/flux_denoise.py:583` calls `isinstance` and `invokeai/app/invocations/flux2/flux2_denoise.py:695` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 2) invokeai/app/invocations/flux3/flux3_lora_loader.py:26 — invokeai/app/invocations/flux3/flux3_lora_loader.py:26-31 | invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_lora_loader.py:26-31 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) invokeai/app/invocations/krea2/krea2_model_loader.py:86 — invokeai/app/invocations/krea2/krea2_model_loader.py:86-95 | invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_model_loader.py:79-84 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) invokeai/app/invocations/sd/create_denoise_mask.py:61 — invokeai/app/invocations/sd/create_denoise_mask.py:61-66 | invokeai/app/invocations/sd/create_gradient_mask.py:193-198 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) invokeai/app/services/image_files/image_files_disk.py:420 — invokeai/app/services/image_files/image_files_disk.py:420-425 | invokeai/app/services/video_files/video_files_disk.py:163-168 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `invokeai/app/services/image_files/image_files_disk.py:428` calls `__persist_journal_directory` and `invokeai/app/services/video_files/video_files_disk.py:169` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 2) invokeai/app/services/session_queue/session_queue_default.py:931 — invokeai/app/services/session_queue/session_queue_default.py:931-936 | invokeai/app/services/session_queue/session_queue_default.py:976-981 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) invokeai/app/services/shared/database/queries/images.py:513 — invokeai/app/services/shared/database/queries/images.py:513-518 | invokeai/app/services/shared/database/queries/videos.py:460-465 — before extracting anything, compare `invokeai/app/services/shared/database/queries/images.py` and `invokeai/app/services/shared/database/queries/videos.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 2) invokeai/app/services/shared/execution_engine/scheduler.py:365 — invokeai/app/services/shared/execution_engine/scheduler.py:365-370 | invokeai/app/services/shared/execution_engine/scheduler.py:410-415 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) invokeai/app/services/shared/graph.py:418 — invokeai/app/services/shared/graph.py:418-423 | invokeai/app/services/shared/graph.py:430-435 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) invokeai/app/services/shared/graph.py:2292 — invokeai/app/services/shared/graph.py:2292-2297 | invokeai/app/services/shared/graph.py:3722-3728 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/shared/graph.py:2292` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) invokeai/app/services/shared/graph.py:2294 — invokeai/app/services/shared/graph.py:2294-2299 | invokeai/app/services/shared/graph.py:3999-4004 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/shared/graph.py:2294` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) invokeai/app/services/shared/graph_iterator_ancestry.py:82 — invokeai/app/services/shared/graph_iterator_ancestry.py:82-87 | invokeai/app/services/shared/graph_iterator_ancestry.py:141-146 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) invokeai/app/util/user_management.py:82 — invokeai/app/util/user_management.py:82-87 | invokeai/app/util/user_management.py:144-149 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) invokeai/app/util/user_management.py:450 — invokeai/app/util/user_management.py:450-455 | invokeai/app/util/user_management.py:551-556 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) invokeai/backend/flux/custom_block_processor.py:35 — invokeai/backend/flux/custom_block_processor.py:35-40 | invokeai/backend/flux/ip_adapter/ip_double_stream_block_processor.py:49-55 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/flux/ip_adapter/ip_double_stream_block_processor.py:49` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (6 lines × 2) invokeai/backend/flux/custom_block_processor.py:35 — invokeai/backend/flux/custom_block_processor.py:35-40 | invokeai/backend/flux/modules/layers.py:164-169 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) invokeai/backend/flux/extensions/kontext_extension.py:177 — invokeai/backend/flux/extensions/kontext_extension.py:177-183 | invokeai/backend/flux2/ref_image_extension.py:295-300 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) invokeai/backend/image_util/dw_openpose/utils.py:140 — invokeai/backend/image_util/dw_openpose/utils.py:140-145 | invokeai/backend/image_util/dw_openpose/utils.py:153-158 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (6 lines × 2) REDACTED:1288 — REDACTED:1288-1293 | invokeai/backend/model_manager/load/model_loaders/qwen_image.py:339-344 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) invokeai/backend/patches/lora_conversions/flux_kohya_lora_conversion_utils.py:146 — invokeai/backend/patches/lora_conversions/flux_kohya_lora_conversion_utils.py:146-151 | invokeai/backend/patches/lora_conversions/flux_kohya_lora_conversion_utils.py:174-179 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) invokeai/backend/quantization/gguf/utils.py:156 — invokeai/backend/quantization/gguf/utils.py:156-161 | invokeai/backend/quantization/gguf/utils.py:183-188 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) invokeai/backend/rectified_flow/er_sde_scheduler.py:425 — invokeai/backend/rectified_flow/er_sde_scheduler.py:425-430 | invokeai/backend/rectified_flow/er_sde_scheduler.py:477-482 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/backend/rectified_flow/er_sde_scheduler.py:476` calls `_sigma_to_alpha_sigma_t` and `invokeai/backend/rectified_flow/er_sde_scheduler.py:423` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 2) invokeai/backend/stable_diffusion/diffusion/custom_atttention.py:125 — invokeai/backend/stable_diffusion/diffusion/custom_atttention.py:125-130 | invokeai/backend/stable_diffusion/extensions/ip_adapter.py:276-283 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/stable_diffusion/diffusion/custom_atttention.py:125` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • + 6 more in this group — see findings.md.
D17 · Explicit Debt · HackComment · ×30
  • HackComment REDACTED:74 — # HACK: The CLIPTokenizer API does not include a way to remove tokens after calling add_tokens(...). As a — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment invokeai/backend/spandrel_image_to_image_model.py:136 — # HACK(ryand): Fix this issue with circular imports. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment invokeai/backend/ip_adapter/ip_adapter.py:137 — # HACK(ryand): Fix this issue with circular imports. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment invokeai/backend/textual_inversion.py:124 — # HACK: If TI token expansion causes us to exceed the max text encoder input length, we silently discard — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment invokeai/backend/stable_diffusion/denoise_context.py:58 — # HACK(ryand): seed is only used in a particular case when `noise` is None, but we need to re-generate the — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment invokeai/backend/stable_diffusion/diffusers_pipeline.py:505 — # Hack: force compatibility with irregular resolutions by padding the feature map with zeros — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment invokeai/backend/stable_diffusion/extensions/ip_adapter.py:121 — # HACK: unload image projection model, as it no longer needed — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment invokeai/backend/model_manager/load/model_util.py:72 — # HACK(ryand): len(model) just returns the vocabulary size, so this is blatantly wrong. It should be small — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment invokeai/backend/model_manager/load/model_loaders/flux.py:606 — # HACK(ryand): We shouldn't be hard-coding the compute_dtype here. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment invokeai/backend/model_manager/load/model_loaders/flux.py:1046 — # HACK(ryand): We shouldn't be hard-coding the compute_dtype here. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment invokeai/backend/model_manager/load/model_loaders/flux.py:1049 — # HACK(ryand): There are some broken GGUF models in circulation that have the wrong shape for img_in.weight. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment invokeai/backend/model_manager/load/model_loaders/flux.py:1979 — # HACK(ryand): Is it safe to assume dev here? — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment invokeai/backend/model_manager/load/model_loaders/lora.py:146 — # HACK(ryand): We set alpha=None for diffusers PEFT format models. These models are typically — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment invokeai/backend/model_manager/load/model_cache/torch_module_autocast/torch_module_autocast.py:81 — # HACK(ryand): We use custom initialization logic so that we can initialize a new custom layer instance from an — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment invokeai/backend/model_manager/load/model_cache/torch_module_autocast/torch_module_autocast.py:95 — # HACK(ryand): We use custom initialization logic so that we can initialize a new custom layer instance from an — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_invoke_linear_nf4.py:62 — # HACK(ryand): Casting self.weight to the device also casts the self.weight.quant_state in-place (i.e. it — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_module_mixin.py:48 — # HACK(ryand): If the original parameters are in a quantized format whose weights can't be accessed, we replace — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment invokeai/backend/model_manager/load/model_cache/cached_model/cached_model_with_partial_load.py:52 — # HACK(ryand): We use this dictionary any time we are doing byte tracking calculations. We do this for — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment invokeai/backend/model_manager/load/model_cache/cached_model/cached_model_with_partial_load.py:186 — # HACK(ryand): Typically, non-persistent buffers are moved when calling module.to(device). We don't move entire — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment invokeai/backend/image_util/segment_anything/segment_anything_2_pipeline.py:26 — # HACK: The SAM2 pipeline may not work on MPS devices. We only allow it to be moved to CPU or CUDA. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment invokeai/backend/image_util/segment_anything/segment_anything_2_pipeline.py:32 — # HACK: Fix the circular import issue. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment invokeai/backend/image_util/segment_anything/segment_anything_pipeline.py:20 — # HACK(ryand): The SAM pipeline does not work on MPS devices. We only allow it to be moved to CPU or CUDA. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment invokeai/backend/image_util/segment_anything/segment_anything_pipeline.py:26 — # HACK(ryand): Fix the circular import issue. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment invokeai/backend/image_util/grounding_dino/grounding_dino_pipeline.py:34 — # HACK(ryand): Fix the circular import issue. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment invokeai/backend/image_util/grounding_dino/grounding_dino_pipeline.py:26 — # HACK(ryand): The GroundingDinoPipeline does not work on MPS devices. We only allow it to be moved to CPU or — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • + 5 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×28
  • Duplicated block (5 lines × 2) invokeai/app/api/routers/utilities.py:532 — invokeai/app/api/routers/utilities.py:532-536 | invokeai/app/api/routers/utilities.py:649-653 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `body` to `ExpandPromptRequest` in one and `ImageToPromptRequest` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (5 lines × 2) invokeai/app/api/routers/utilities.py:542 — invokeai/app/api/routers/utilities.py:542-546 | invokeai/app/api/routers/utilities.py:658-662 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) invokeai/app/invocations/anima/anima_denoise.py:686 — invokeai/app/invocations/anima/anima_denoise.py:686-690 | invokeai/app/invocations/z_image/z_image_denoise.py:326-331 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) invokeai/app/invocations/metadata_linked.py:529 — invokeai/app/invocations/metadata_linked.py:529-533 | invokeai/app/invocations/metadata_linked.py:585-589 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) invokeai/app/invocations/vae/latents_to_image.py:101 — invokeai/app/invocations/vae/latents_to_image.py:101-110 | scripts/calibrate_vae_tiling_working_memory.py:451-455 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/vae/latents_to_image.py:101` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) invokeai/app/invocations/wan/wan_lora_loader.py:193 — invokeai/app/invocations/wan/wan_lora_loader.py:193-197 | invokeai/app/invocations/wan/wan_lora_loader.py:274-282 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) invokeai/app/services/image_records/image_records_common.py:176 — invokeai/app/services/image_records/image_records_common.py:176-184 | invokeai/app/services/video_records/video_records_common.py:107-111 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) invokeai/app/services/shared/execution_engine/child.py:60 — invokeai/app/services/shared/execution_engine/child.py:60-64 | invokeai/app/services/shared/execution_engine/primitives.py:61-65 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (5 lines × 2) invokeai/app/services/shared/execution_engine/child.py:67 — invokeai/app/services/shared/execution_engine/child.py:67-71 | invokeai/app/services/shared/execution_engine/primitives.py:68-72 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (5 lines × 2) invokeai/app/util/database_copy.py:174 — invokeai/app/util/database_copy.py:174-178 | invokeai/app/util/database_copy.py:257-261 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) invokeai/backend/flux/controlnet/state_dict_utils.py:123 — invokeai/backend/flux/controlnet/state_dict_utils.py:123-127 | invokeai/backend/flux/controlnet/state_dict_utils.py:154-172 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/flux/controlnet/state_dict_utils.py:123` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (5 lines × 2) invokeai/backend/flux/controlnet/state_dict_utils.py:145 — invokeai/backend/flux/controlnet/state_dict_utils.py:145-149 | invokeai/backend/model_manager/load/model_loaders/flux.py:2288-2292 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/flux/controlnet/state_dict_utils.py:145` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) invokeai/backend/image_util/color_conversion.py:625 — invokeai/backend/image_util/color_conversion.py:625-629 | invokeai/backend/image_util/color_conversion.py:695-699 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/image_util/color_conversion.py:625` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) invokeai/backend/image_util/color_conversion.py:684 — invokeai/backend/image_util/color_conversion.py:684-688 | invokeai/backend/image_util/color_conversion.py:940-944 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) invokeai/backend/image_util/color_conversion.py:691 — invokeai/backend/image_util/color_conversion.py:691-695 | invokeai/backend/image_util/color_conversion.py:947-951 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/image_util/color_conversion.py:691` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) invokeai/backend/image_util/hed.py:128 — invokeai/backend/image_util/hed.py:128-132 | invokeai/backend/image_util/hed.py:201-205 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `invokeai/backend/image_util/hed.py:133` calls `normalize_image_channel_count`, `resize_image_to_resolution` and `invokeai/backend/image_util/hed.py:207` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 2) invokeai/backend/image_util/lineart_anime.py:152 — invokeai/backend/image_util/lineart_anime.py:152-156 | invokeai/backend/image_util/lineart_anime.py:225-229 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) invokeai/backend/image_util/mlsd/utils.py:68 — invokeai/backend/image_util/mlsd/utils.py:68-72 | invokeai/backend/image_util/mlsd/utils.py:125-129 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) invokeai/backend/pid/_src/networks/pixeldit_official.py:138 — invokeai/backend/pid/_src/networks/pixeldit_official.py:138-142 | invokeai/backend/pid/_src/networks/pixeldit_official.py:177-181 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `invokeai/backend/pid/_src/networks/pixeldit_official.py:184` calls `arange` and `invokeai/backend/pid/_src/networks/pixeldit_official.py:144` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 2) invokeai/app/invocations/wan/wan_denoise.py:779 — invokeai/app/invocations/wan/wan_denoise.py:779-783 | invokeai/app/invocations/wan/wan_video_denoise.py:404-408 — before extracting anything, compare `invokeai/app/invocations/wan/wan_denoise.py` and `invokeai/app/invocations/wan/wan_video_denoise.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 150 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (5 lines × 2) invokeai/backend/patches/lora_conversions/flux3_lora_constants.py:320 — invokeai/backend/patches/lora_conversions/flux3_lora_constants.py:320-324 | invokeai/backend/patches/lora_conversions/qwen_image_2_1_lora_constants.py:177-181 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) invokeai/app/services/shared/execution_engine/child.py:26 — invokeai/app/services/shared/execution_engine/child.py:26-30 | invokeai/app/services/shared/execution_engine/primitives.py:33-37 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (5 lines × 2) invokeai/app/invocations/metadata_linked.py:777 — invokeai/app/invocations/metadata_linked.py:777-781 | invokeai/app/invocations/metadata_linked.py:849-853 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) invokeai/app/services/external_generation/providers/atlascloud.py:350 — invokeai/app/services/external_generation/providers/atlascloud.py:350-354 | invokeai/app/services/external_generation/providers/gemini.py:208-212 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (5 lines × 2) invokeai/app/services/shared/database/queries/images.py:318 — invokeai/app/services/shared/database/queries/images.py:318-322 | invokeai/app/services/shared/database/queries/videos.py:282-286 — before extracting anything, compare `invokeai/app/services/shared/database/queries/images.py` and `invokeai/app/services/shared/database/queries/videos.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • + 3 more in this group — see findings.md.
AC2 · Forms & labels · <Input> field component without a label · ×22
  • <Input> field component without a label invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx:826 — This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Input> field component without a label invokeai/frontend/webv1/src/features/auth/components/AdministratorSetup.tsx:134 — This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Input> field component without a label invokeai/frontend/webv1/src/features/auth/components/AdministratorSetup.tsx:155 — This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Input> field component without a label invokeai/frontend/webv1/src/features/auth/components/AdministratorSetup.tsx:174 — This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Input> field component without a label invokeai/frontend/webv1/src/features/auth/components/AdministratorSetup.tsx:206 — This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Input> field component without a label invokeai/frontend/webv1/src/features/auth/components/UserManagement.tsx:214 — This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Input> field component without a label invokeai/frontend/webv1/src/features/auth/components/UserManagement.tsx:234 — This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Input> field component without a label invokeai/frontend/webv1/src/features/auth/components/UserManagement.tsx:253 — This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Input> field component without a label invokeai/frontend/webv1/src/features/auth/components/UserProfile.tsx:201 — This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Input> field component without a label invokeai/frontend/webv1/src/features/auth/components/UserProfile.tsx:246 — This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Input> field component without a label invokeai/frontend/webv1/src/features/auth/components/UserProfile.tsx:309 — This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Input> field component without a label invokeai/frontend/webv1/src/features/controlLayers/components/Toolbar/CanvasToolbarSnapshotMenuButton.tsx:191 — This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Input> field component without a label invokeai/frontend/webv1/src/features/gallery/components/Boards/BoardsList/BoardsSearch.tsx:45 — This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Input> field component without a label invokeai/frontend/webv1/src/features/gallery/components/ImageGrid/GallerySearch.tsx:37 — This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Input> field component without a label invokeai/frontend/webv1/src/features/gallery/components/ImageMetadataViewer/DataViewer.tsx:139 — This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Input> field component without a label invokeai/frontend/webv1/src/features/gallery/components/ImageMetadataViewer/ImageMetadataViewer.tsx:117 — This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Input> field component without a label invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/AddModelPanel/HuggingFaceFolder/HFToken.tsx:79 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Input> field component without a label invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/AddModelPanel/HuggingFaceFolder/HFToken.tsx:121 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Input> field component without a label invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/AddModelPanel/HuggingFaceFolder/HuggingFaceResults.tsx:62 — This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Input> field component without a label invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/AddModelPanel/ScanFolder/ScanFolderResults.tsx:96 — This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Input> field component without a label invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/AddModelPanel/StarterModels/StarterModelsResults.tsx:81 — This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Input> field component without a label invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelManagerPanel/ModelListNavigation.tsx:32 — This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×22
  • Duplicated block (11 lines × 2) invokeai/app/api/routers/system_prompts.py:83 — invokeai/app/api/routers/system_prompts.py:83-93 | invokeai/app/api/routers/system_prompts.py:107-117 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `system_prompt_id` to `str = Path(description="The id of the system prompt to update")` in one and `str = Path(description="The id of the system prompt to delete")` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (11 lines × 2) invokeai/app/api/routers/workflows.py:102 — invokeai/app/api/routers/workflows.py:102-112 | invokeai/app/api/routers/workflows.py:154-164 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `workflow_id` to `str = Path(description="The workflow to get")` in one and `str = Path(description="The workflow to delete")` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (11 lines × 2) invokeai/app/invocations/flux3/flux3_model_loader.py:108 — invokeai/app/invocations/flux3/flux3_model_loader.py:108-118 | invokeai/app/invocations/krea2/krea2_model_loader.py:109-119 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/flux3/flux3_model_loader.py:108` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) invokeai/app/invocations/krea2/krea2_style_reference.py:224 — invokeai/app/invocations/krea2/krea2_style_reference.py:224-234 | invokeai/backend/krea2/style_reference_extension.py:106-116 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/krea2/krea2_style_reference.py:224` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) invokeai/app/invocations/vae/flux2_vae_encode.py:95 — invokeai/app/invocations/vae/flux2_vae_encode.py:95-105 | invokeai/backend/flux2/ref_image_extension.py:127-137 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (11 lines × 2) invokeai/app/services/external_generation/providers/alibabacloud.py:244 — invokeai/app/services/external_generation/providers/alibabacloud.py:244-254 | invokeai/app/services/external_generation/providers/alibabacloud.py:279-289 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) invokeai/app/services/model_install/model_install_default.py:2295 — invokeai/app/services/model_install/model_install_default.py:2295-2305 | invokeai/app/services/model_install/model_install_default.py:2314-2324 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) invokeai/app/services/shared/graph.py:1197 — invokeai/app/services/shared/graph.py:1197-1207 | invokeai/app/services/shared/graph.py:1294-1304 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/shared/graph.py:1197` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) invokeai/app/services/shared/graph.py:2131 — invokeai/app/services/shared/graph.py:2131-2141 | invokeai/app/services/shared/graph.py:2144-2154 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) invokeai/app/services/shared/graph_if_dependencies.py:55 — invokeai/app/services/shared/graph_if_dependencies.py:55-65 | invokeai/app/services/shared/graph_if_dependencies.py:130-140 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/app/services/shared/graph_if_dependencies.py:127` calls `_get_input_edges` and `invokeai/app/services/shared/graph_if_dependencies.py:53` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11 lines × 2) invokeai/app/services/shared/graph_materializer.py:622 — invokeai/app/services/shared/graph_materializer.py:622-632 | invokeai/app/services/shared/graph_materializer.py:950-960 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/shared/graph_materializer.py:622` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) invokeai/app/util/user_management.py:348 — invokeai/app/util/user_management.py:348-358 | invokeai/app/util/user_management.py:386-396 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) invokeai/backend/image_util/lineart.py:152 — invokeai/backend/image_util/lineart.py:152-162 | invokeai/backend/image_util/lineart_anime.py:196-206 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (11 lines × 2) invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:32 — invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:32-42 | invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py:31-41 — before extracting anything, compare `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py` and `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 161 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 2) invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:202 — invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:202-212 | invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py:201-211 — before extracting anything, compare `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py` and `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 161 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:214` calls `_load_pretrained_model` and `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py:216` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11 lines × 2) invokeai/backend/model_manager/load/model_cache/model_cache.py:2906 — invokeai/backend/model_manager/load/model_cache/model_cache.py:2906-2916 | invokeai/backend/model_manager/load/model_cache/model_cache.py:2993-3003 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `invokeai/backend/model_manager/load/model_cache/model_cache.py:3005` calls `release` and `invokeai/backend/model_manager/load/model_cache/model_cache.py:2918` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11 lines × 2) invokeai/backend/model_manager/load/model_loaders/ernie_image.py:104 — invokeai/backend/model_manager/load/model_loaders/ernie_image.py:104-114 | invokeai/backend/model_manager/load/model_loaders/ernie_image.py:151-161 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) invokeai/backend/model_manager/load/model_loaders/z_image.py:301 — invokeai/backend/model_manager/load/model_loaders/z_image.py:301-311 | invokeai/backend/model_manager/load/model_loaders/z_image.py:421-431 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) invokeai/backend/pid/_src/networks/pixeldit_official.py:1059 — invokeai/backend/pid/_src/networks/pixeldit_official.py:1059-1069 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1133-1143 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) invokeai/backend/model_manager/configs/main.py:121 — invokeai/backend/model_manager/configs/main.py:121-131 | invokeai/backend/quantization/sdnq/loaders.py:383-400 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `state_dict` to `dict[str | int, Any]` in one and `dict[str, Any]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (11 lines × 2) invokeai/app/api/routers/board_images.py:92 — invokeai/app/api/routers/board_images.py:92-102 | invokeai/app/api/routers/videos.py:156-166 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) invokeai/app/invocations/flux/flux_controlnet.py:90 — invokeai/app/invocations/flux/flux_controlnet.py:90-100 | invokeai/app/invocations/sd/controlnet.py:102-112 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. 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.
D3 · God Classes · TooManyMethods · ×21
  • TooManyMethods: ModelInstallService invokeai/app/services/model_install/model_install_default.py:235 — TooManyMethods — 103 methods. The bar is 30 methods; this is 73 over it, 3.43× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: SessionQueue invokeai/app/services/session_queue/session_queue_default.py:142 — TooManyMethods — 75 methods. The bar is 30 methods; this is 45 over it, 2.50× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: _ExecutionNodeBuilder invokeai/app/services/shared/graph_materializer.py:39 — TooManyMethods — 75 methods. The bar is 30 methods; this is 45 over it, 2.50× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ModelCache invokeai/backend/model_manager/load/model_cache/model_cache.py:506 — TooManyMethods — 67 methods. The bar is 30 methods; this is 37 over it, 2.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: WorkingMemoryCalibrationService invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py:514 — TooManyMethods — 59 methods. The bar is 30 methods; this is 29 over it, 1.97× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ImageIndexService invokeai/app/services/image_index/image_index_default.py:228 — TooManyMethods — 58 methods. The bar is 30 methods; this is 28 over it, 1.93× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: SessionQueueBase invokeai/app/services/session_queue/session_queue_base.py:43 — TooManyMethods — 51 methods. The bar is 30 methods; this is 21 over it, 1.70× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: SessionQueueQueries invokeai/app/services/shared/database/queries/session_queue.py:763 — TooManyMethods — 49 methods. The bar is 30 methods; this is 19 over it, 1.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ImageMoveService invokeai/app/services/image_moves/image_moves_default.py:87 — TooManyMethods — 48 methods. The bar is 30 methods; this is 18 over it, 1.60× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: CanvasShapeToolModule invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasShapeToolModule.ts:68 — TooManyMethods — 48 methods. The bar is 30 methods; this is 18 over it, 1.60× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Editor invokeai/frontend/webv1/src/features/cropper/lib/editor.ts:173 — TooManyMethods — 46 methods. The bar is 30 methods; this is 16 over it, 1.53× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: EventServiceBase invokeai/app/services/events/events_base.py:74 — TooManyMethods — 44 methods. The bar is 30 methods; this is 14 over it, 1.47× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: CanvasStageModule invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasStageModule.ts:53 — TooManyMethods — 42 methods. The bar is 30 methods; this is 12 over it, 1.40× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: DownloadQueueService invokeai/app/services/download/download_default.py:54 — TooManyMethods — 41 methods. The bar is 30 methods; this is 11 over it, 1.37× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: GalleryMaintenanceService invokeai/app/services/gallery_maintenance/gallery_maintenance_default.py:93 — TooManyMethods — 40 methods. The bar is 30 methods; this is 10 over it, 1.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: CanvasStateApiModule invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasStateApiModule.ts:68 — TooManyMethods — 40 methods. The bar is 30 methods; this is 10 over it, 1.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: DiskImageFileStorage invokeai/app/services/image_files/image_files_disk.py:94 — TooManyMethods — 38 methods. The bar is 30 methods; this is 8 over it, 1.27× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: CanvasEntityTransformer invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityTransformer.ts:100 — TooManyMethods — 38 methods. The bar is 30 methods; this is 8 over it, 1.27× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: CanvasToolModule invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasToolModule.ts:73 — TooManyMethods — 37 methods. The bar is 30 methods; this is 7 over it, 1.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: NavigationApi invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts:62 — TooManyMethods — 35 methods. The bar is 30 methods; this is 5 over it, 1.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Graph invokeai/frontend/webv1/src/features/nodes/util/graph/generation/Graph.ts:35 — TooManyMethods — 31 methods. The bar is 30 methods; this is 1 over it, 1.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×21
  • Duplicated block (9 lines × 2) invokeai/app/invocations/anima/anima_denoise.py:967 — invokeai/app/invocations/anima/anima_denoise.py:967-975 | invokeai/app/invocations/anima/anima_denoise.py:1026-1034 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) invokeai/app/invocations/anima/anima_lora_loader.py:153 — invokeai/app/invocations/anima/anima_lora_loader.py:153-161 | invokeai/app/invocations/flux/flux_lora_loader.py:170-178 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9 lines × 2) invokeai/app/invocations/ltx2/ltx2_lora_loader.py:150 — invokeai/app/invocations/ltx2/ltx2_lora_loader.py:150-158 | invokeai/app/invocations/minimax_h3/minimax_h3_lora_loader.py:143-151 — `invokeai/app/invocations/ltx2/ltx2_lora_loader.py` and `invokeai/app/invocations/minimax_h3/minimax_h3_lora_loader.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 30 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (9 lines × 2) invokeai/app/services/external_generation/providers/alibabacloud.py:224 — invokeai/app/services/external_generation/providers/alibabacloud.py:224-232 | invokeai/app/services/external_generation/providers/alibabacloud.py:263-271 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/app/services/external_generation/providers/alibabacloud.py:220` calls `get`, `isinstance`, `ExternalProviderRequestError` and `invokeai/app/services/external_generation/providers/alibabacloud.py:261` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 2) invokeai/app/services/images/images_default.py:623 — invokeai/app/services/images/images_default.py:623-631 | invokeai/app/services/videos/videos_default.py:416-424 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/images/images_default.py:623` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) invokeai/app/services/project_records/project_records_default.py:256 — invokeai/app/services/project_records/project_records_default.py:256-264 | invokeai/app/services/project_records/project_records_default.py:394-402 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/project_records/project_records_default.py:256` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) invokeai/app/services/shared/database/queries/board_images.py:94 — invokeai/app/services/shared/database/queries/board_images.py:94-102 | invokeai/app/services/shared/database/queries/board_videos.py:88-96 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (9 lines × 2) invokeai/app/services/shared/database/queries/images.py:415 — invokeai/app/services/shared/database/queries/images.py:415-423 | invokeai/app/services/shared/database/queries/videos.py:361-369 — before extracting anything, compare `invokeai/app/services/shared/database/queries/images.py` and `invokeai/app/services/shared/database/queries/videos.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/shared/database/queries/images.py:415` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (9 lines × 2) invokeai/app/services/shared/graph_scheduler.py:328 — invokeai/app/services/shared/graph_scheduler.py:328-336 | invokeai/app/services/shared/graph_scheduler.py:654-662 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) invokeai/app/util/user_management.py:184 — invokeai/app/util/user_management.py:184-192 | invokeai/app/util/user_management.py:603-611 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) invokeai/backend/flux/controlnet/xlabs_controlnet_flux.py:109 — invokeai/backend/flux/controlnet/xlabs_controlnet_flux.py:109-117 | invokeai/backend/flux/model.py:112-120 — before extracting anything, compare `invokeai/backend/flux/controlnet/xlabs_controlnet_flux.py` and `invokeai/backend/flux/model.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) invokeai/backend/hidiffusion/hidiffusion.py:1035 — invokeai/backend/hidiffusion/hidiffusion.py:1035-1043 | invokeai/backend/util/hotfixes.py:651-659 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9 lines × 2) invokeai/backend/hidiffusion/hidiffusion.py:2169 — invokeai/backend/hidiffusion/hidiffusion.py:2169-2177 | invokeai/backend/hidiffusion/hidiffusion.py:2202-2210 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) invokeai/backend/image_util/pidi/model.py:456 — invokeai/backend/image_util/pidi/model.py:456-464 | invokeai/backend/image_util/pidi/model.py:486-494 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (9 lines × 2) invokeai/backend/model_manager/configs/main.py:2166 — invokeai/backend/model_manager/configs/main.py:2166-2174 | invokeai/backend/model_manager/configs/main.py:2198-2206 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `invokeai/backend/model_manager/configs/main.py:2207` calls `_has_ggml_tensors`, `NotAMatchError` and `invokeai/backend/model_manager/configs/main.py:2176` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 2) invokeai/backend/model_manager/load/model_loaders/qwen_image.py:104 — invokeai/backend/model_manager/load/model_loaders/qwen_image.py:104-112 | invokeai/backend/model_manager/load/model_loaders/wan.py:334-342 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9 lines × 2) invokeai/backend/pid/_src/networks/pixeldit_official.py:250 — invokeai/backend/pid/_src/networks/pixeldit_official.py:250-258 | invokeai/backend/pid/_src/networks/pixeldit_official.py:674-682 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) invokeai/backend/pid/_src/networks/pixeldit_official.py:817 — invokeai/backend/pid/_src/networks/pixeldit_official.py:817-825 | invokeai/backend/pid/_src/networks/pixeldit_official.py:854-862 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/pid/_src/networks/pixeldit_official.py:817` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) scripts/calibrate_krea2_working_memory.py:498 — scripts/calibrate_krea2_working_memory.py:498-506 | scripts/calibrate_vae_tiling_working_memory.py:499-507 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9 lines × 2) invokeai/app/invocations/sd/denoise_latents.py:243 — invokeai/app/invocations/sd/denoise_latents.py:243-251 | invokeai/app/invocations/sd/tiled_multi_diffusion_denoise_latents.py:134-142 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note first that the copies are not typed on the same thing: the declarations holding them bind `v` to `Union[List[float], float]` in one and `list[float] | float` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (9 lines × 2) invokeai/app/invocations/flux3/flux3_lora_loader.py:101 — invokeai/app/invocations/flux3/flux3_lora_loader.py:101-109 | invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_lora_loader.py:102-110 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×21
  • Duplicated block (8 lines × 2) invokeai/app/invocations/anima/anima_denoise.py:1105 — invokeai/app/invocations/anima/anima_denoise.py:1105-1116 | invokeai/app/invocations/z_image/z_image_denoise.py:761-768 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) invokeai/app/invocations/composition-nodes.py:1444 — invokeai/app/invocations/composition-nodes.py:1444-1451 | invokeai/app/invocations/composition-nodes.py:1532-1539 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) invokeai/app/invocations/ltx2/ltx2_lora_loader.py:100 — invokeai/app/invocations/ltx2/ltx2_lora_loader.py:100-107 | invokeai/app/invocations/minimax_h3/minimax_h3_lora_loader.py:93-100 — `invokeai/app/invocations/ltx2/ltx2_lora_loader.py` and `invokeai/app/invocations/minimax_h3/minimax_h3_lora_loader.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 30 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/ltx2/ltx2_lora_loader.py:100` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) invokeai/app/invocations/ltx2/ltx2_lora_loader.py:162 — invokeai/app/invocations/ltx2/ltx2_lora_loader.py:162-169 | invokeai/app/invocations/minimax_h3/minimax_h3_lora_loader.py:155-162 — `invokeai/app/invocations/ltx2/ltx2_lora_loader.py` and `invokeai/app/invocations/minimax_h3/minimax_h3_lora_loader.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 30 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/ltx2/ltx2_lora_loader.py:162` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) invokeai/app/invocations/model.py:540 — invokeai/app/invocations/model.py:540-547 | invokeai/app/invocations/model.py:704-711 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) invokeai/app/invocations/pid/flux2_pid_decode.py:122 — invokeai/app/invocations/pid/flux2_pid_decode.py:122-129 | invokeai/app/invocations/pid/sdxl_pid_decode.py:105-112 — before extracting anything, compare `invokeai/app/invocations/pid/flux2_pid_decode.py` and `invokeai/app/invocations/pid/sdxl_pid_decode.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 92 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/pid/flux2_pid_decode.py:122` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) invokeai/app/invocations/pid/sd3_pid_decode.py:86 — invokeai/app/invocations/pid/sd3_pid_decode.py:86-93 | invokeai/app/invocations/pid/z_image_pid_decode.py:100-108 — before extracting anything, compare `invokeai/app/invocations/pid/sd3_pid_decode.py` and `invokeai/app/invocations/pid/z_image_pid_decode.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 71 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/pid/sd3_pid_decode.py:86` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) invokeai/app/invocations/sd/sdxl.py:39 — invokeai/app/invocations/sd/sdxl.py:39-46 | invokeai/app/invocations/sd/sdxl.py:79-86 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) invokeai/app/invocations/text_encoder/ernie_image_text_encoder.py:68 — invokeai/app/invocations/text_encoder/ernie_image_text_encoder.py:68-75 | invokeai/app/invocations/text_encoder/ideogram4_text_encoder.py:52-59 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (8 lines × 2) invokeai/app/invocations/video_frame_extract.py:58 — invokeai/app/invocations/video_frame_extract.py:58-65 | invokeai/app/invocations/video_frame_extract_range.py:194-201 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (8 lines × 2) invokeai/app/services/shared/database/queries/images.py:479 — invokeai/app/services/shared/database/queries/images.py:479-486 | invokeai/app/services/shared/database/queries/videos.py:426-433 — before extracting anything, compare `invokeai/app/services/shared/database/queries/images.py` and `invokeai/app/services/shared/database/queries/videos.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note first that the copies are not typed on the same thing: the declarations holding them bind `changes` to `ImageRecordChanges` in one and `VideoRecordChanges` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (8 lines × 2) invokeai/app/services/shared/graph.py:1218 — invokeai/app/services/shared/graph.py:1218-1225 | invokeai/app/services/shared/graph.py:1323-1330 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/shared/graph.py:1218` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `invokeai/app/services/shared/graph.py:1226` calls `_get_output_edges` and `invokeai/app/services/shared/graph.py:1331` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 2) invokeai/app/services/shared/graph_loop_topology.py:226 — invokeai/app/services/shared/graph_loop_topology.py:226-233 | invokeai/app/services/shared/graph_loop_topology.py:570-577 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) invokeai/backend/fun_controlnet/qwen_image.py:114 — invokeai/backend/fun_controlnet/qwen_image.py:114-121 | invokeai/backend/model_manager/load/model_loaders/qwen_image_controlnet.py:72-79 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/fun_controlnet/qwen_image.py:114` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (8 lines × 2) invokeai/backend/model_manager/configs/lora.py:542 — invokeai/backend/model_manager/configs/lora.py:542-549 | invokeai/backend/model_manager/configs/lora.py:550-557 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) invokeai/backend/model_manager/configs/qwen3_encoder.py:693 — invokeai/backend/model_manager/configs/qwen3_encoder.py:693-700 | invokeai/backend/model_manager/configs/qwen3_encoder.py:744-751 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) invokeai/backend/pid/_src/modules/conditioner.py:414 — invokeai/backend/pid/_src/modules/conditioner.py:414-421 | invokeai/backend/pid/_src/modules/conditioner.py:533-540 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (8 lines × 2) invokeai/app/services/session_processor/workflow_call_batch.py:93 — invokeai/app/services/session_processor/workflow_call_batch.py:93-100 | invokeai/app/services/shared/workflow_graph_builder.py:245-252 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:112 — invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:112-119 | invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py:111-118 — before extracting anything, compare `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py` and `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 161 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (8 lines × 2) invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:235 — invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:235-242 | invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py:235-242 — before extracting anything, compare `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py` and `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 161 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:235` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) invokeai/app/services/style_preset_images/style_preset_images_disk.py:37 — invokeai/app/services/style_preset_images/style_preset_images_disk.py:37-44 | invokeai/app/services/workflow_thumbnails/workflow_thumbnails_disk.py:36-43 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×19
  • Duplicated block (12 lines × 2) invokeai/app/api/routers/images.py:572 — invokeai/app/api/routers/images.py:572-583 | invokeai/app/api/routers/images.py:1010-1021 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/api/routers/images.py:572` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) invokeai/app/invocations/cogview4/cogview4_denoise.py:142 — invokeai/app/invocations/cogview4/cogview4_denoise.py:142-153 | invokeai/app/invocations/sd3/sd3_denoise.py:161-172 — `invokeai/app/invocations/cogview4/cogview4_denoise.py` and `invokeai/app/invocations/sd3/sd3_denoise.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 126 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) invokeai/app/invocations/image.py:1014 — invokeai/app/invocations/image.py:1014-1025 | invokeai/app/invocations/image.py:1079-1090 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (12 lines × 2) invokeai/app/invocations/qwen_image/qwen_image_denoise.py:200 — invokeai/app/invocations/qwen_image/qwen_image_denoise.py:200-211 | invokeai/app/invocations/z_image/z_image_denoise.py:237-248 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) invokeai/app/invocations/text_encoder/anima_text_encoder.py:128 — invokeai/app/invocations/text_encoder/anima_text_encoder.py:128-145 | invokeai/app/invocations/text_encoder/z_image_text_encoder.py:71-82 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/text_encoder/anima_text_encoder.py:128` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) invokeai/app/invocations/vae/ltx2_latents_to_video.py:310 — invokeai/app/invocations/vae/ltx2_latents_to_video.py:310-321 | invokeai/app/invocations/vae/minimax_h3_latents_to_video.py:259-270 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (12 lines × 2) invokeai/app/services/shared/graph_materializer.py:502 — invokeai/app/services/shared/graph_materializer.py:502-513 | invokeai/app/services/shared/graph_materializer.py:614-625 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/shared/graph_materializer.py:502` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) invokeai/app/util/user_management.py:234 — invokeai/app/util/user_management.py:234-245 | invokeai/app/util/user_management.py:467-478 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:9 — invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:9-20 | invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py:9-20 — before extracting anything, compare `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py` and `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 161 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 2) invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:51 — invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:51-62 | invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py:50-61 — before extracting anything, compare `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py` and `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 161 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 2) invokeai/backend/model_manager/configs/ip_adapter.py:93 — invokeai/backend/model_manager/configs/ip_adapter.py:93-104 | invokeai/backend/model_manager/configs/ip_adapter.py:166-177 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) invokeai/backend/patches/lora_conversions/krea2_lora_conversion_utils.py:212 — invokeai/backend/patches/lora_conversions/krea2_lora_conversion_utils.py:212-223 | invokeai/backend/patches/lora_conversions/z_image_lora_conversion_utils.py:130-144 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) invokeai/backend/pid/_src/networks/pid_net.py:364 — invokeai/backend/pid/_src/networks/pid_net.py:364-375 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1458-1469 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/pid/_src/networks/pid_net.py:364` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) invokeai/backend/pid/_src/networks/pixeldit_official.py:1025 — invokeai/backend/pid/_src/networks/pixeldit_official.py:1025-1036 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1099-1110 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) invokeai/backend/stable_diffusion/diffusers_pipeline.py:385 — invokeai/backend/stable_diffusion/diffusers_pipeline.py:385-396 | invokeai/backend/stable_diffusion/multi_diffusion_pipeline.py:82-93 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (12 lines × 2) scripts/calibrate_flux2_denoise_working_memory.py:217 — scripts/calibrate_flux2_denoise_working_memory.py:217-228 | scripts/calibrate_flux3_denoise_working_memory.py:333-344 — before extracting anything, compare `scripts/calibrate_flux2_denoise_working_memory.py` and `scripts/calibrate_flux3_denoise_working_memory.py` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) scripts/calibrate_vae_tiling_working_memory.py:524 — scripts/calibrate_vae_tiling_working_memory.py:524-536 | scripts/calibrate_z_image_working_memory.py:345-356 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) invokeai/app/api/routers/utilities.py:121 — invokeai/app/api/routers/utilities.py:121-133 | REDACTED:660-671 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) invokeai/app/services/style_preset_images/style_preset_images_disk.py:69 — invokeai/app/services/style_preset_images/style_preset_images_disk.py:69-80 | invokeai/app/services/workflow_thumbnails/workflow_thumbnails_disk.py:72-83 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×17
  • Duplicated block (10 lines × 2) invokeai/app/invocations/composition-nodes.py:190 — invokeai/app/invocations/composition-nodes.py:190-199 | invokeai/app/invocations/composition-nodes.py:239-248 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) invokeai/app/invocations/flux2/flux2_control.py:110 — invokeai/app/invocations/flux2/flux2_control.py:110-119 | invokeai/app/invocations/qwen_image/qwen_image_control.py:116-125 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/flux2/flux2_control.py:110` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) invokeai/app/invocations/ltx2/ltx2_denoise.py:222 — invokeai/app/invocations/ltx2/ltx2_denoise.py:222-231 | invokeai/app/invocations/minimax_h3/minimax_h3_denoise.py:651-660 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (10 lines × 2) invokeai/app/invocations/wan/wan_denoise.py:461 — invokeai/app/invocations/wan/wan_denoise.py:461-470 | invokeai/app/invocations/wan/wan_video_denoise.py:208-217 — before extracting anything, compare `invokeai/app/invocations/wan/wan_denoise.py` and `invokeai/app/invocations/wan/wan_video_denoise.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 150 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 2) invokeai/app/services/external_generation/providers/gemini.py:111 — invokeai/app/services/external_generation/providers/gemini.py:111-120 | invokeai/app/services/external_generation/providers/openai.py:117-126 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/external_generation/providers/gemini.py:111` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) invokeai/app/services/gallery_maintenance/gallery_maintenance_default.py:275 — invokeai/app/services/gallery_maintenance/gallery_maintenance_default.py:275-284 | invokeai/app/services/gallery_maintenance/gallery_maintenance_default.py:409-418 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) invokeai/app/services/session_processor/workflow_call_batch.py:439 — invokeai/app/services/session_processor/workflow_call_batch.py:439-448 | invokeai/app/services/session_processor/workflow_call_batch.py:461-470 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) invokeai/app/services/session_queue/session_queue_default.py:1152 — invokeai/app/services/session_queue/session_queue_default.py:1152-1161 | invokeai/app/services/session_queue/session_queue_default.py:1168-1177 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/session_queue/session_queue_default.py:1152` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) invokeai/app/services/shared/database/queries/images.py:371 — invokeai/app/services/shared/database/queries/images.py:371-380 | invokeai/app/services/shared/database/queries/videos.py:323-332 — before extracting anything, compare `invokeai/app/services/shared/database/queries/images.py` and `invokeai/app/services/shared/database/queries/videos.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/shared/database/queries/images.py:371` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (10 lines × 2) invokeai/app/services/shared/graph.py:573 — invokeai/app/services/shared/graph.py:573-582 | invokeai/app/services/shared/graph.py:3595-3604 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) invokeai/app/services/shared/graph_iterate_planner.py:337 — invokeai/app/services/shared/graph_iterate_planner.py:337-346 | invokeai/app/services/shared/graph_iterate_planner.py:392-401 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `fan_in` to `_DirectIterateCollectFanIn` in one and `_BodyIterateCollectFanIn` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (10 lines × 2) invokeai/backend/minimax_h3/transformer_minimax_h3.py:260 — invokeai/backend/minimax_h3/transformer_minimax_h3.py:260-269 | invokeai/backend/minimax_h3/transformer_minimax_h3.py:331-340 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) invokeai/backend/model_manager/load/model_loaders/z_image.py:1581 — invokeai/backend/model_manager/load/model_loaders/z_image.py:1581-1590 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1757-1766 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/model_manager/load/model_loaders/z_image.py:1581` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) invokeai/backend/quantization/int8_convrot.py:377 — invokeai/backend/quantization/int8_convrot.py:377-386 | invokeai/backend/quantization/int8_convrot.py:492-501 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) invokeai/backend/quantization/sdnq/utils.py:122 — invokeai/backend/quantization/sdnq/utils.py:122-131 | invokeai/backend/quantization/sdnq/utils.py:165-174 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/backend/quantization/sdnq/utils.py:164` calls `to` and `invokeai/backend/quantization/sdnq/utils.py:118` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 2) invokeai/backend/flux/extensions/base_controlnet_extension.py:22 — invokeai/backend/flux/extensions/base_controlnet_extension.py:22-31 | invokeai/backend/flux/extensions/xlabs_ip_adapter_extension.py:32-41 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) invokeai/backend/patches/lora_conversions/qwen_image_lora_conversion_utils.py:61 — invokeai/backend/patches/lora_conversions/qwen_image_lora_conversion_utils.py:61-77 | invokeai/backend/patches/lora_conversions/wan_lora_conversion_utils.py:158-167 — before extracting anything, compare `invokeai/backend/patches/lora_conversions/qwen_image_lora_conversion_utils.py` and `invokeai/backend/patches/lora_conversions/wan_lora_conversion_utils.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 72 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
X17 · Uncapped recursion over a caller-supplied document · Recursive walk over a caller-supplied document has no depth cap · ×17
  • Recursive walk over a caller-supplied document has no depth cap invokeai/frontend/webv2/src/workbench/projects/projectAssets.ts:251 — `stripInstallationState` is exported, takes a document from its caller (line 292) and hands it to `mapDocument`, which calls itself at line 251 (`mapDocument`) with a piece of `node` (and at line 272) — and nowhere in `mapDocument` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `mapDocument` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap invokeai/frontend/webv2/src/workbench/projects/invk/fonts.ts:36 — `collectFontDependencies` is exported, takes a document from its caller (line 49) and hands it to `walkTextSources`, which calls itself at line 36 (`walkTextSources`) with a piece of `value` (and at line 44) — and nowhere in `walkTextSources` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `walkTextSources` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/postconditions.ts:44 — `sameValue` is exported and takes `left: unknown` from its caller, and it calls itself at line 44 (`sameValue`) with a piece of `left` (and at line 51) — and nowhere in `sameValue` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `sameValue` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentTree.ts:46 — `collectSubtree` is exported and takes `node: CanvasNodeContract` from its caller, and it calls itself at line 46 (`collectSubtree`) with a piece of `node` — and nowhere in `collectSubtree` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `collectSubtree` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentTree.ts:59 — `collectSubtreeLeaves` is exported and takes `node: CanvasNodeContract` from its caller, and it calls itself at line 59 (`collectSubtreeLeaves`) with a piece of `node` — and nowhere in `collectSubtreeLeaves` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `collectSubtreeLeaves` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentTree.ts:69 — `subtreeDepth` is exported and takes `node: CanvasNodeContract` from its caller, and it calls itself at line 69 (`subtreeDepth`) with a piece of `node` — and nowhere in `subtreeDepth` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `subtreeDepth` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentTree.ts:80 — `cloneSubtree` is exported and takes `node: CanvasNodeContract` from its caller, and it calls itself at line 80 (`cloneSubtree`) with a piece of `node` — and nowhere in `cloneSubtree` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `cloneSubtree` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap invokeai/frontend/webv2/src/platform/ui/theme/rebase.ts:115 — `renameFonts` is exported and takes `value: unknown` from its caller, and it calls itself at line 115 (`renameFonts`) with a piece of `value` (and at line 121) — and nowhere in `renameFonts` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `renameFonts` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap invokeai/frontend/webv2/src/platform/core/json.ts:21 — `areJsonValuesStructurallyEqual` is exported and takes `left: unknown` from its caller, and it calls itself at line 21 (`areJsonValuesStructurallyEqual`) with a piece of `left` (and at line 34) — and nowhere in `areJsonValuesStructurallyEqual` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `areJsonValuesStructurallyEqual` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap invokeai/frontend/webv2/src/features/workflow/data/publication.ts:105 — `isWorkflowContentEquivalent` is exported, takes a document from its caller (line 120) and hands it to `canonicalize`, which calls itself at line 105 (`canonicalize`) with a piece of `value` (and at line 112) — and nowhere in `canonicalize` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `canonicalize` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap invokeai/frontend/webv2/src/features/workflow/data/templates.ts:100 — `parseFieldType` is exported and takes `schema: unknown` from its caller, and it calls itself at line 100 (`parseFieldType`) with a piece of `schema` — and nowhere in `parseFieldType` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `parseFieldType` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap invokeai/frontend/webv2/src/features/queue/core/graphInputMedia.ts:26 — `collectSubmissionInputMediaNames` is exported, takes a document from its caller (line 19) and hands it to `visit`, which calls itself at line 26 (`visit`) with a piece of `value` (and at line 44) — and nowhere in `visit` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `visit` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap invokeai/frontend/webv2/src/features/generation/core/wildcardTransfer.ts:54 — `wildcardsFromNestedRecord` is exported, takes a document from its caller (line 39) and hands it to `walk`, which calls itself at line 54 (`walk`) with a piece of `node` — and nowhere in `walk` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `walk` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap invokeai/backend/pid/_ext/imaginaire/lazy_config/instantiate.py:35 — `dump_dataclass` is public and takes `obj: Any` from its caller, and it calls itself at line 35 (`dump_dataclass`) with a piece of `obj` (and at line 37) — and nowhere in `dump_dataclass` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `dump_dataclass` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap invokeai/app/util/custom_openapi.py:55 — `normalize_path_defaults` is public and takes `node: Any` from its caller, and it calls itself at line 55 (`normalize_path_defaults`) with a piece of `node` (and at line 58) — and nowhere in `normalize_path_defaults` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `normalize_path_defaults` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap invokeai/app/util/custom_openapi.py:80 — `remove_unreferenced_internal_execution_schemas` is public, takes a document from its caller (line 61) and hands it to `collect_refs`, which calls itself at line 80 (`collect_refs`) with a piece of `value` (and at line 83) — and nowhere in `collect_refs` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `collect_refs` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap invokeai/app/services/shared/execution_state_migration.py:168 — `load_execution_state` is public, takes a document from its caller (line 172) and hands it to `_normalize_persisted_effects_in_snapshot`, which calls itself at line 168 (`_normalize_persisted_effects_in_snapshot`) with a piece of `payload` — and nowhere in `_normalize_persisted_effects_in_snapshot` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_normalize_persisted_effects_in_snapshot` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
D3 · God Classes · ClassTooLong · ×16
  • ClassTooLong: GalleryImageGrid invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx:1 — ClassTooLong — 1257 significant lines (blank, comment-only and punctuation-only lines excluded), 10 methods. The bar is 400 significant lines; this is 857 over it, 3.14× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: LayersTree invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx:1 — ClassTooLong — 918 significant lines (blank, comment-only and punctuation-only lines excluded), 7 methods. The bar is 400 significant lines; this is 518 over it, 2.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: useImageActions invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts:1 — ClassTooLong — 836 significant lines (blank, comment-only and punctuation-only lines excluded), 5 methods. The bar is 400 significant lines; this is 436 over it, 2.09× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Editor invokeai/frontend/webv1/src/features/cropper/lib/editor.ts:173 — ClassTooLong — 758 significant lines (blank, comment-only and punctuation-only lines excluded), 46 methods. The bar is 400 significant lines; this is 358 over it, 1.90× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: setEventListeners invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:1 — ClassTooLong — 622 significant lines (blank, comment-only and punctuation-only lines excluded), 2 methods. The bar is 400 significant lines; this is 222 over it, 1.56× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: CanvasEntityTransformer invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityTransformer.ts:100 — ClassTooLong — 618 significant lines (blank, comment-only and punctuation-only lines excluded), 38 methods. The bar is 400 significant lines; this is 218 over it, 1.55× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: VideoWidgetView invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx:1 — ClassTooLong — 602 significant lines (blank, comment-only and punctuation-only lines excluded), 4 methods. The bar is 400 significant lines; this is 202 over it, 1.51× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: buildFLUXGraph invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildFLUXGraph.ts:1 — ClassTooLong — 598 significant lines (blank, comment-only and punctuation-only lines excluded), 1 methods. The bar is 400 significant lines; this is 198 over it, 1.50× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: CanvasToolModule invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasToolModule.ts:73 — ClassTooLong — 592 significant lines (blank, comment-only and punctuation-only lines excluded), 37 methods. The bar is 400 significant lines; this is 192 over it, 1.48× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: usePreviewNavigation invokeai/frontend/webv2/src/workbench/widgets/preview/usePreviewNavigation.ts:1 — ClassTooLong — 589 significant lines (blank, comment-only and punctuation-only lines excluded), 44 methods. The bar is 400 significant lines; this is 189 over it, 1.47× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: UpscaleWidgetView invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsx:1 — ClassTooLong — 529 significant lines (blank, comment-only and punctuation-only lines excluded), 10 methods. The bar is 400 significant lines; this is 129 over it, 1.32× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: useGalleryData invokeai/frontend/webv2/src/features/gallery/ui/useGalleryData.ts:1 — ClassTooLong — 493 significant lines (blank, comment-only and punctuation-only lines excluded), 45 methods. The bar is 400 significant lines; this is 93 over it, 1.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: MergeLayerController invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:174 — ClassTooLong — 489 significant lines (blank, comment-only and punctuation-only lines excluded), 7 methods. The bar is 400 significant lines; this is 89 over it, 1.22× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: GalleryPickerView invokeai/frontend/webv2/src/features/gallery/ui/picker/GalleryPickerView.tsx:1 — ClassTooLong — 466 significant lines (blank, comment-only and punctuation-only lines excluded), 2 methods. The bar is 400 significant lines; this is 66 over it, 1.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: PreviewWidgetView invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx:1 — ClassTooLong — 412 significant lines (blank, comment-only and punctuation-only lines excluded), 13 methods. The bar is 400 significant lines; this is 12 over it, 1.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: CanvasWidgetView invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasWidgetView.tsx:1 — ClassTooLong — 407 significant lines (blank, comment-only and punctuation-only lines excluded), 4 methods. The bar is 400 significant lines; this is 7 over it, 1.02× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
X2 · Cancellation propagation · Async function without AbortSignal · ×16
  • Async function without AbortSignal: fetchImageAsDataUrl invokeai/frontend/webv2/src/features/models/ui/detail/ModelSettingsMenuItems.tsx:167 — `fetchImageAsDataUrl` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: fetchFollowingCancellation invokeai/frontend/webv2/src/features/gallery/data/queries.ts:275 — `fetchFollowingCancellation` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: waitForPreview invokeai/frontend/webv2/scripts/measure-architecture-performance.mjs:108 — `waitForPreview` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: runSample invokeai/frontend/webv2/scripts/measure-architecture-performance.mjs:316 — `runSample` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: waitForPreview REDACTED:20 — `waitForPreview` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: openRepresentativePage REDACTED:70 — `openRepresentativePage` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: ready REDACTED:247 — `ready` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: waitForPreview REDACTED:56 — `waitForPreview` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: assertAssetRoute REDACTED:121 — `assertAssetRoute` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: runRoundTrip REDACTED:301 — `runRoundTrip` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: getResultImageDTOs invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:321 — `getResultImageDTOs` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: imageDTOToFile invokeai/frontend/webv1/src/services/api/endpoints/images.ts:1130 — `imageDTOToFile` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: fetchImageAsDataUrl invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/modelSettingsIO.ts:79 — `fetchImageAsDataUrl` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: getItem invokeai/frontend/webv1/src/app/store/enhancers/reduxRemember/driver.ts:101 — `getItem` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: setItem invokeai/frontend/webv1/src/app/store/enhancers/reduxRemember/driver.ts:154 — `setItem` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: clearStorage invokeai/frontend/webv1/src/app/store/enhancers/reduxRemember/driver.ts:197 — `clearStorage` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
D3 · God Classes · MethodTooLong · ×15
  • MethodTooLong: MergeLayerController.mergeDown invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:186 — MethodTooLong — mergeDown runs 163 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 63 over it, 1.63× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: MergeLayerController.mergeSelectedInto invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:628 — MethodTooLong — mergeSelectedInto runs 151 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 51 over it, 1.51× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ExtractMaskedAreaController.extract invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/extractMaskedAreaController.ts:122 — MethodTooLong — extract runs 140 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 40 over it, 1.40× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: MergeLayerController.mergeVisible invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:394 — MethodTooLong — mergeVisible runs 139 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 39 over it, 1.39× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: GeneratedResultController.commit invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/generatedResultController.ts:56 — MethodTooLong — commit runs 137 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 37 over it, 1.37× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: LayerMutationController.commitDuplicate invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/layerMutationController.ts:206 — MethodTooLong — commitDuplicate runs 136 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 36 over it, 1.36× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: FilterResultController.commit invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/filterResultController.ts:66 — MethodTooLong — commit runs 124 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 24 over it, 1.24× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: StagedResultController.commit invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/stagedResultController.ts:78 — MethodTooLong — commit runs 121 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 21 over it, 1.21× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: CanvasSegmentAnythingModule.constructor invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts:327 — MethodTooLong — constructor runs 113 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 13 over it, 1.13× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: PsdExportController.export invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/psdExportController.ts:81 — MethodTooLong — export runs 113 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 13 over it, 1.13× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: CanvasColorPickerToolModule.constructor invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasColorPickerToolModule.ts:154 — MethodTooLong — constructor runs 111 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 11 over it, 1.11× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Editor.getNextCropBoxByHandleWithAspectRatio invokeai/frontend/webv1/src/features/cropper/lib/editor.ts:746 — MethodTooLong — getNextCropBoxByHandleWithAspectRatio 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× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: BooleanMergeController.merge invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/booleanMergeController.ts:75 — MethodTooLong — merge 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× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ControlDerivationController.commitControlMap invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/controlDerivationController.ts:198 — MethodTooLong — commitControlMap 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× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: CanvasTextToolModule.commitSession invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasTextToolModule.ts:361 — MethodTooLong — commitSession runs 102 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 2 over it, 1.02× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
D4 · Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×15
  • Members sharing a duplicated core (4 members, 50+ identical tokens) invokeai/app/api/routers/workflows.py:394 — invokeai/app/api/routers/workflows.py:394-407 | invokeai/app/api/routers/workflows.py:458-478 | invokeai/app/api/routers/workflows.py:549-560 | invokeai/app/api/routers/workflows.py:572-583 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) invokeai/app/invocations/flux3/flux3_denoise.py:322 — invokeai/app/invocations/flux3/flux3_denoise.py:322-328 | invokeai/app/invocations/qwen_image/qwen_image_denoise.py:811-818 | invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_denoise.py:644-650 | invokeai/app/invocations/text_encoder/krea2_text_encoder.py:188-195 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) invokeai/app/invocations/ltx2/ltx2_lora_loader.py:88 — invokeai/app/invocations/ltx2/ltx2_lora_loader.py:88-113 | invokeai/app/invocations/ltx2/ltx2_lora_loader.py:142-171 | invokeai/app/invocations/minimax_h3/minimax_h3_lora_loader.py:81-106 | invokeai/app/invocations/minimax_h3/minimax_h3_lora_loader.py:135-164 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) invokeai/app/invocations/metadata_linked.py:631 — invokeai/app/invocations/metadata_linked.py:631-689 | invokeai/app/invocations/metadata_linked.py:703-743 | invokeai/app/invocations/metadata_linked.py:757-795 | invokeai/app/invocations/metadata_linked.py:827-871 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) invokeai/app/services/events/events_common.py:143 — invokeai/app/services/events/events_common.py:143-156 | invokeai/app/services/events/events_common.py:199-230 | invokeai/app/services/events/events_common.py:245-259 | invokeai/app/services/events/events_common.py:281-297 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) invokeai/app/services/shared/database/queries/images.py:356 — invokeai/app/services/shared/database/queries/images.py:356-380 | invokeai/app/services/shared/database/queries/images.py:399-423 | invokeai/app/services/shared/database/queries/videos.py:312-332 | invokeai/app/services/shared/database/queries/videos.py:349-369 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) invokeai/app/services/shared/graph_materializer.py:461 — invokeai/app/services/shared/graph_materializer.py:461-527 | invokeai/app/services/shared/graph_materializer.py:544-663 | invokeai/app/services/shared/graph_materializer.py:902-1015 | invokeai/app/services/shared/graph_materializer.py:1025-1195 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) invokeai/app/services/shared/sqlite_migrator/migrations/migration_2026_07_01_add_workflow_call_queue_metadata.py:12 — invokeai/app/services/shared/sqlite_migrator/migrations/migration_2026_07_01_add_workflow_call_queue_metadata.py:12-45 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_27.py:125-141 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_27.py:158-173 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_27.py:190-205 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) invokeai/backend/hidiffusion/hidiffusion.py:1534 — invokeai/backend/hidiffusion/hidiffusion.py:1534-1664 | invokeai/backend/hidiffusion/hidiffusion.py:1669-1814 | invokeai/backend/hidiffusion/hidiffusion.py:1819-1894 | invokeai/backend/hidiffusion/hidiffusion.py:1899-1965 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) invokeai/backend/model_manager/configs/main.py:1270 — invokeai/backend/model_manager/configs/main.py:1270-1312 | invokeai/backend/model_manager/configs/main.py:4002-4060 | invokeai/backend/model_manager/configs/main.py:4156-4210 | invokeai/backend/model_manager/configs/main.py:4321-4366 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_conv2d.py:16 — invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_conv2d.py:16-25 | invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_invoke_linear_8_bit_lt.py:19-28 | invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_invoke_linear_nf4.py:21-30 | invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_linear.py:88-97 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) invokeai/backend/model_manager/load/model_loaders/cogview4.py:28 — invokeai/backend/model_manager/load/model_loaders/cogview4.py:28-59 | invokeai/backend/model_manager/load/model_loaders/flux.py:1111-1141 | invokeai/backend/model_manager/load/model_loaders/flux.py:1153-1218 | invokeai/backend/model_manager/load/model_loaders/qwen_image.py:159-197 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) invokeai/backend/model_manager/load/model_loaders/z_image.py:298 — invokeai/backend/model_manager/load/model_loaders/z_image.py:298-415 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1116-1383 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1423-1594 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1628-1769 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) invokeai/backend/model_manager/load/model_loaders/z_image.py:418 — invokeai/backend/model_manager/load/model_loaders/z_image.py:418-459 | invokeai/backend/model_manager/load/model_loaders/z_image.py:486-734 | invokeai/backend/model_manager/load/model_loaders/z_image.py:761-805 | invokeai/backend/model_manager/load/model_loaders/z_image.py:888-927 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) invokeai/backend/patches/lora_conversions/anima_lora_conversion_utils.py:234 — invokeai/backend/patches/lora_conversions/anima_lora_conversion_utils.py:234-270 | invokeai/backend/patches/lora_conversions/qwen_image_lora_conversion_utils.py:168-202 | invokeai/backend/patches/lora_conversions/wan_lora_conversion_utils.py:219-250 | invokeai/backend/patches/lora_conversions/z_image_lora_conversion_utils.py:214-260 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D30 · Dependency Vulnerabilities · Medium CVE · ×11
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×11
  • Duplicated block (15 lines × 2) invokeai/app/invocations/cogview4/cogview4_denoise.py:156 — invokeai/app/invocations/cogview4/cogview4_denoise.py:156-170 | invokeai/app/invocations/sd3/sd3_denoise.py:175-189 — `invokeai/app/invocations/cogview4/cogview4_denoise.py` and `invokeai/app/invocations/sd3/sd3_denoise.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 126 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (15 lines × 2) invokeai/app/invocations/composition-nodes.py:1427 — invokeai/app/invocations/composition-nodes.py:1427-1441 | invokeai/app/invocations/composition-nodes.py:1511-1525 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) invokeai/app/invocations/vae/anima_image_to_latents.py:127 — invokeai/app/invocations/vae/anima_image_to_latents.py:127-141 | invokeai/app/invocations/vae/z_image_image_to_latents.py:113-127 — before extracting anything, compare `invokeai/app/invocations/vae/anima_image_to_latents.py` and `invokeai/app/invocations/vae/z_image_image_to_latents.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (15 lines × 2) invokeai/app/services/gallery/gallery_default.py:141 — invokeai/app/services/gallery/gallery_default.py:141-155 | invokeai/app/services/gallery/gallery_default.py:176-190 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) invokeai/app/services/image_records/image_records_default.py:159 — invokeai/app/services/image_records/image_records_default.py:159-173 | invokeai/app/services/video_records/video_records_default.py:134-148 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/image_records/image_records_default.py:159` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) invokeai/app/services/model_install/model_install_default.py:1085 — invokeai/app/services/model_install/model_install_default.py:1085-1099 | invokeai/app/services/model_install/model_install_default.py:1101-1115 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) invokeai/app/services/shared/sqlite_migrator/migrations/migration_24.py:136 — invokeai/app/services/shared/sqlite_migrator/migrations/migration_24.py:136-150 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_24.py:158-172 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/shared/sqlite_migrator/migrations/migration_24.py:136` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) invokeai/backend/hidiffusion/hidiffusion.py:526 — invokeai/backend/hidiffusion/hidiffusion.py:526-540 | invokeai/backend/hidiffusion/hidiffusion.py:562-576 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) invokeai/backend/minimax_h3/packing.py:539 — invokeai/backend/minimax_h3/packing.py:539-553 | invokeai/backend/minimax_h3/packing.py:695-709 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/minimax_h3/packing.py:539` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) invokeai/backend/model_manager/load/model_cache/cached_model/cached_model_only_full_load.py:128 — invokeai/backend/model_manager/load/model_cache/cached_model/cached_model_only_full_load.py:128-142 | invokeai/backend/model_manager/load/model_cache/cached_model/cached_model_with_partial_load.py:232-246 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (15 lines × 2) invokeai/backend/model_manager/load/model_loaders/flux.py:1897 — invokeai/backend/model_manager/load/model_loaders/flux.py:1897-1911 | invokeai/backend/model_manager/load/model_loaders/flux.py:1912-1926 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D17 · Explicit Debt · FixmeComment · ×10
  • FixmeComment scripts/generate_vae_linear_approximation.py:44 — # FIXME: uses torch.randn. make reproducible! — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment invokeai/app/invocations/vae/image_to_latents.py:174 — # FIXME: uses torch.randn. make reproducible! — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment invokeai/backend/onnx/onnx_runtime.py:45 — # fixme — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment invokeai/backend/onnx/onnx_runtime.py:52 — # fixme — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment invokeai/backend/onnx/onnx_runtime.py:88 — # fixme — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment invokeai/backend/onnx/onnx_runtime.py:205 — # fixme — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment invokeai/app/util/controlnet_utils.py:82 — # FIXME: not using yet, if used in the future will most likely require modification of preprocessors — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment invokeai/app/invocations/sd/denoise_latents.py:109 — # FIXME — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment invokeai/app/invocations/sd/denoise_latents.py:1115 — # FIXME — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment invokeai/app/invocations/sd/denoise_latents.py:491 — # FIXME: still need to test with different widths, heights, devices, dtypes — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×10
  • Duplicated block (13 lines × 2) invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:197 — invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:197-209 | invokeai/app/invocations/z_image/z_image_lora_loader.py:166-178 — before extracting anything, compare `invokeai/app/invocations/flux2/flux2_klein_lora_loader.py` and `invokeai/app/invocations/z_image/z_image_lora_loader.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 101 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 2) invokeai/app/invocations/metadata_linked.py:536 — invokeai/app/invocations/metadata_linked.py:536-548 | invokeai/app/invocations/metadata_linked.py:592-604 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) invokeai/app/invocations/qwen_image/qwen_image_model_loader.py:121 — invokeai/app/invocations/qwen_image/qwen_image_model_loader.py:121-133 | invokeai/app/invocations/wan/wan_model_loader.py:280-292 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/qwen_image/qwen_image_model_loader.py:121` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) invokeai/app/invocations/sd/denoise_latents.py:286 — invokeai/app/invocations/sd/denoise_latents.py:286-298 | invokeai/backend/stable_diffusion/extensions/ip_adapter.py:141-153 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 2) invokeai/app/services/shared/graph_materializer.py:649 — invokeai/app/services/shared/graph_materializer.py:649-661 | invokeai/app/services/shared/graph_materializer.py:755-767 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/app/services/shared/graph_materializer.py:647` calls `RuntimeError` and `invokeai/app/services/shared/graph_materializer.py:754` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13 lines × 2) invokeai/backend/flux/denoise.py:155 — invokeai/backend/flux/denoise.py:155-167 | invokeai/backend/flux/denoise.py:193-205 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/flux/denoise.py:155` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) invokeai/backend/patches/lora_conversions/flux3_lora_constants.py:328 — invokeai/backend/patches/lora_conversions/flux3_lora_constants.py:328-340 | invokeai/backend/patches/lora_conversions/qwen_image_2_1_lora_constants.py:185-197 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `layer` to `Mapping[str, Any]` in one and `dict[str, Any]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (13 lines × 2) invokeai/backend/quantization/scripts/load_flux_model_bnb_llm_int8.py:49 — invokeai/backend/quantization/scripts/load_flux_model_bnb_llm_int8.py:49-61 | invokeai/backend/quantization/scripts/quantize_t5_xxl_bnb_llm_int8.py:55-67 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (13 lines × 2) scripts/calibrate_flux2_denoise_working_memory.py:340 — scripts/calibrate_flux2_denoise_working_memory.py:340-352 | scripts/calibrate_flux3_denoise_working_memory.py:497-509 — before extracting anything, compare `scripts/calibrate_flux2_denoise_working_memory.py` and `scripts/calibrate_flux3_denoise_working_memory.py` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 2) invokeai/backend/patches/lora_conversions/anima_lora_conversion_utils.py:274 — invokeai/backend/patches/lora_conversions/anima_lora_conversion_utils.py:274-286 | invokeai/backend/patches/lora_conversions/z_image_lora_conversion_utils.py:195-210 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×9
  • Duplicated block (14 lines × 2) invokeai/app/invocations/vae/cogview4_image_to_latents.py:63 — invokeai/app/invocations/vae/cogview4_image_to_latents.py:63-76 | invokeai/app/invocations/vae/sd3_image_to_latents.py:59-72 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (14 lines × 2) invokeai/app/services/shared/graph_nested_iterate_planner.py:177 — invokeai/app/services/shared/graph_nested_iterate_planner.py:177-190 | invokeai/app/services/shared/graph_nested_iterate_planner.py:348-361 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/app/services/shared/graph_nested_iterate_planner.py:176` calls `_get_input_edges` and `invokeai/app/services/shared/graph_nested_iterate_planner.py:347` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (14 lines × 2) invokeai/backend/fun_controlnet/flux2.py:137 — invokeai/backend/fun_controlnet/flux2.py:137-150 | invokeai/backend/fun_controlnet/qwen_image.py:100-113 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/fun_controlnet/flux2.py:137` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) invokeai/backend/fun_controlnet/flux2.py:181 — invokeai/backend/fun_controlnet/flux2.py:181-194 | invokeai/backend/fun_controlnet/qwen_image.py:140-153 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (14 lines × 2) invokeai/backend/minimax_h3/contiguous_attention.py:89 — invokeai/backend/minimax_h3/contiguous_attention.py:89-102 | invokeai/backend/minimax_h3/transformer_minimax_h3.py:192-205 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/backend/minimax_h3/contiguous_attention.py:80` calls `_head_major_contiguous` and `invokeai/backend/minimax_h3/transformer_minimax_h3.py:186` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (14 lines × 2) invokeai/backend/model_manager/configs/main.py:4004 — invokeai/backend/model_manager/configs/main.py:4004-4017 | invokeai/backend/model_manager/configs/main.py:4158-4171 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) invokeai/backend/pid/_src/networks/pid_net.py:378 — invokeai/backend/pid/_src/networks/pid_net.py:378-391 | invokeai/backend/pid/_src/networks/pid_net.py:414-427 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/pid/_src/networks/pid_net.py:378` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) scripts/calibrate_flux2_denoise_working_memory.py:382 — scripts/calibrate_flux2_denoise_working_memory.py:382-395 | scripts/calibrate_flux3_denoise_working_memory.py:544-557 — before extracting anything, compare `scripts/calibrate_flux2_denoise_working_memory.py` and `scripts/calibrate_flux3_denoise_working_memory.py` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) invokeai/app/services/shared/sqlite_migrator/migrations/migration_12.py:24 — invokeai/app/services/shared/sqlite_migrator/migrations/migration_12.py:24-37 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_8.py:78-93 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note first that the copies are not typed on the same thing: `InvokeAIAppConfig` names `invokeai.app.services.config` in one and `invokeai.app.services.config.config_default` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
AC2 · Forms & labels · <Combobox> field component without a label · ×8
  • <Combobox> field component without a label invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:224 — This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Combobox> field component without a label invokeai/frontend/webv1/src/features/controlLayers/components/ControlLayer/ControlLayerControlAdapterControlMode.tsx:49 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Combobox> field component without a label invokeai/frontend/webv1/src/features/controlLayers/components/Filters/FilterTypeSelect.tsx:40 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Combobox> field component without a label invokeai/frontend/webv1/src/features/controlLayers/components/RefImage/IPAdapterMethod.tsx:65 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Combobox> field component without a label invokeai/frontend/webv1/src/features/controlLayers/components/Text/TextToolOptions.tsx:312 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Combobox> field component without a label invokeai/frontend/webv1/src/features/controlLayers/components/common/IPAdapterCLIPVisionModel.tsx:51 — This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Combobox> field component without a label invokeai/frontend/webv1/src/features/dynamicPrompts/components/ParamDynamicPromptsSeedBehaviour.tsx:50 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Combobox> field component without a label invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/ControlAdapterModelDefaultSettings/DefaultPreprocessor.tsx:63 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
D35 · Change Coupling · Change-coupling hub · ×8
  • Change-coupling hub: canvas-tab-auto-layout.tsx → generate-tab-auto-layout.tsx, upscaling-tab-auto-layout.tsx, workflows-tab-auto-layout.tsx invokeai/frontend/webv1/src/features/ui/layouts/canvas-tab-auto-layout.tsx — `invokeai/frontend/webv1/src/features/ui/layouts/canvas-tab-auto-layout.tsx` changes together with 3 other files — `invokeai/frontend/webv1/src/features/ui/layouts/generate-tab-auto-layout.tsx`, `invokeai/frontend/webv1/src/features/ui/layouts/upscaling-tab-auto-layout.tsx`, `invokeai/frontend/webv1/src/features/ui/layouts/workflows-tab-auto-layout.tsx` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
  • Change-coupling hub: flux_denoise.py → flux_controlnet.py, tiled_multi_diffusion_denoise_latents.py, instantx_controlnet_flux.py, denoise.py, instantx_controlnet_extension.py, xlabs_controlnet_extension.py, model.py invokeai/app/invocations/flux_denoise.py — `invokeai/app/invocations/flux_denoise.py` changes together with 7 other files — `invokeai/app/invocations/flux_controlnet.py`, `invokeai/app/invocations/tiled_multi_diffusion_denoise_latents.py`, `invokeai/backend/flux/controlnet/instantx_controlnet_flux.py`, `invokeai/backend/flux/denoise.py`, `invokeai/backend/flux/extensions/instantx_controlnet_extension.py`, `invokeai/backend/flux/extensions/xlabs_controlnet_extension.py`, `invokeai/backend/flux/model.py` — none of which declares a dependency on it: one file is the hub of 7 separate couplings, not 7 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 7.
  • Change-coupling hub: engine.ts → paintTool.ts, operationController.ts, engineStoreHooks.ts, ControlLayerSettings.tsx, layerContextActions.ts invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts — `invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts` changes together with 5 other files — `invokeai/frontend/webv2/src/workbench/canvas-engine/tools/paintTool.ts`, `invokeai/frontend/webv2/src/workbench/canvas-operations/operationController.ts`, `invokeai/frontend/webv2/src/workbench/widgets/canvas/engineStoreHooks.ts`, `invokeai/frontend/webv2/src/workbench/widgets/layers/ControlLayerSettings.tsx`, `invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.ts` — none of which declares a dependency on it: one file is the hub of 5 separate couplings, not 5 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 5.
  • Change-coupling hub: InputFieldRenderer.tsx → nodesSlice.ts, buildFieldInputInstance.ts, buildFieldInputTemplate.ts invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/InputFieldRenderer.tsx — `invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/InputFieldRenderer.tsx` changes together with 3 other files — `invokeai/frontend/webv1/src/features/nodes/store/nodesSlice.ts`, `invokeai/frontend/webv1/src/features/nodes/util/schema/buildFieldInputInstance.ts`, `invokeai/frontend/webv1/src/features/nodes/util/schema/buildFieldInputTemplate.ts` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
  • Change-coupling hub: DividerElementComponent.tsx → ContainerElement.tsx, WorkflowBuilder.tsx, workflow.ts invokeai/frontend/webv1/src/features/nodes/components/sidePanel/builder/DividerElementComponent.tsx — `invokeai/frontend/webv1/src/features/nodes/components/sidePanel/builder/DividerElementComponent.tsx` changes together with 3 other files — `invokeai/frontend/webv1/src/features/nodes/components/sidePanel/builder/ContainerElement.tsx`, `invokeai/frontend/webv1/src/features/nodes/components/sidePanel/builder/WorkflowBuilder.tsx`, `invokeai/frontend/webv1/src/features/nodes/types/workflow.ts` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
  • Change-coupling hub: use-collapsible-gridview-panel.ts → GalleryPanel.tsx, canvas-tab-auto-layout.tsx, generate-tab-auto-layout.tsx, upscaling-tab-auto-layout.tsx, workflows-tab-auto-layout.tsx invokeai/frontend/webv1/src/features/ui/layouts/use-collapsible-gridview-panel.ts — `invokeai/frontend/webv1/src/features/ui/layouts/use-collapsible-gridview-panel.ts` changes together with 5 other files — `invokeai/frontend/webv1/src/features/gallery/components/GalleryPanel.tsx`, `invokeai/frontend/webv1/src/features/ui/layouts/canvas-tab-auto-layout.tsx`, `invokeai/frontend/webv1/src/features/ui/layouts/generate-tab-auto-layout.tsx`, `invokeai/frontend/webv1/src/features/ui/layouts/upscaling-tab-auto-layout.tsx`, `invokeai/frontend/webv1/src/features/ui/layouts/workflows-tab-auto-layout.tsx` — none of which declares a dependency on it: one file is the hub of 5 separate couplings, not 5 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 5.
  • Change-coupling hub: types.ts → ModelBaseBadge.tsx, buildFieldInputInstance.ts, DimensionsAspectRatioSelect.tsx invokeai/frontend/webv1/src/services/api/types.ts — `invokeai/frontend/webv1/src/services/api/types.ts` changes together with 3 other files — `invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelManagerPanel/ModelBaseBadge.tsx`, `invokeai/frontend/webv1/src/features/nodes/util/schema/buildFieldInputInstance.ts`, `invokeai/frontend/webv1/src/features/parameters/components/Dimensions/DimensionsAspectRatioSelect.tsx` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
  • Change-coupling hub: flux_text_encoder.py → compel.py, sd3_text_encoder.py, tiled_multi_diffusion_denoise_latents.py invokeai/app/invocations/flux_text_encoder.py — `invokeai/app/invocations/flux_text_encoder.py` changes together with 3 other files — `invokeai/app/invocations/compel.py`, `invokeai/app/invocations/sd3_text_encoder.py`, `invokeai/app/invocations/tiled_multi_diffusion_denoise_latents.py` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
X3 · Exception handling · Swallowed exception (caught, then discarded) · ×8
  • Swallowed exception (caught, then discarded) scripts/calibrate_qwen_vae_working_memory.py:81 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) invokeai/frontend/webv2/src/workbench/settings/clearWorkspaceData.ts:8 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) invokeai/frontend/webv2/src/workbench/projects/covers.ts:90 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) invokeai/frontend/webv2/src/workbench/projects/covers.ts:125 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:594 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:3791 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:3810 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) invokeai/frontend/webv2/src/workbench/projects/editorSession.ts:80 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
D4 · Code Duplication · Duplicated block (7 lines × 3) · ×7
  • Duplicated block (7 lines × 3) invokeai/app/invocations/metadata_linked.py:737 — invokeai/app/invocations/metadata_linked.py:737-743 | invokeai/app/invocations/metadata_linked.py:788-795 | invokeai/app/invocations/metadata_linked.py:865-871 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/metadata_linked.py:788` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (7 lines × 3) invokeai/app/invocations/pid/flux2_pid_decode.py:123 — invokeai/app/invocations/pid/flux2_pid_decode.py:123-129 | invokeai/app/invocations/pid/qwen_image_pid_decode.py:123-129 | invokeai/app/invocations/pid/sdxl_pid_decode.py:106-112 — before extracting anything, compare `invokeai/app/invocations/pid/flux2_pid_decode.py` and `invokeai/app/invocations/pid/qwen_image_pid_decode.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/pid/flux2_pid_decode.py:123` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 3) invokeai/app/services/session_queue/session_queue_default.py:1136 — invokeai/app/services/session_queue/session_queue_default.py:1136-1142 | invokeai/app/services/session_queue/session_queue_default.py:1154-1160 | invokeai/app/services/session_queue/session_queue_default.py:1170-1176 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (7 lines × 3) invokeai/backend/flux/controlnet/instantx_controlnet_flux.py:127 — invokeai/backend/flux/controlnet/instantx_controlnet_flux.py:127-133 | invokeai/backend/flux/controlnet/xlabs_controlnet_flux.py:108-114 | invokeai/backend/flux/model.py:111-117 — before extracting anything, compare `invokeai/backend/flux/controlnet/instantx_controlnet_flux.py` and `invokeai/backend/flux/controlnet/xlabs_controlnet_flux.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/backend/flux/controlnet/instantx_controlnet_flux.py:125` calls `controlnet_x_embedder` and `invokeai/backend/flux/model.py:110` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 3) invokeai/backend/image_util/hed.py:132 — invokeai/backend/image_util/hed.py:132-138 | invokeai/backend/image_util/lineart.py:152-159 | invokeai/backend/image_util/lineart_anime.py:196-203 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (7 lines × 3) invokeai/backend/model_manager/configs/main.py:3919 — invokeai/backend/model_manager/configs/main.py:3919-3925 | invokeai/backend/model_manager/configs/main.py:4088-4095 | invokeai/backend/model_manager/configs/main.py:4247-4254 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (7 lines × 3) invokeai/backend/pid/_src/networks/pid_net.py:370 — invokeai/backend/pid/_src/networks/pid_net.py:370-376 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1464-1470 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1489-1495 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/pid/_src/networks/pid_net.py:370` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D2 · Cognitive Complexity · durableSyncedPersistence.createDurableSyncedWorkbenchPersistence · ×6
  • durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject (cognitive 73) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:1372 — durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject has cognitive complexity 73 (threshold 15). Drivers by points: if/else 19 (52 pts), ternaries 3 (11 pts), error handling 2 (5 pts), boolean chains 4, loops 1 (nesting depth added 44). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 5 other methods here (durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::adoptNewestDraft, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::stageProject, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::pushHalves, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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.
  • durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::hydrateProjectWithDraft (cognitive 38) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:2186 — durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::hydrateProjectWithDraft has cognitive complexity 38 (threshold 15). Drivers by points: if/else 17 (25 pts), boolean chains 6, ternaries 3 (6 pts), error handling 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 5 other methods here (durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::adoptNewestDraft, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::stageProject, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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.
  • durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::pushHalves (cognitive 27) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:1473 — durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::pushHalves has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (17 pts), ternaries 3 (6 pts), boolean chains 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 5 other methods here (durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::adoptNewestDraft, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::stageProject, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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.
  • durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::stageProject (cognitive 25) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:1105 — durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::stageProject has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (14 pts), ternaries 5 (9 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 5 other methods here (durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::adoptNewestDraft, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::pushHalves, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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.
  • durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::adoptNewestDraft (cognitive 17) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:893 — durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::adoptNewestDraft has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 3 (4 pts), boolean chains 3, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 5 other methods here (durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::stageProject, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::pushHalves, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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.
  • durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::reconcile (cognitive 16) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:1668 — durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::reconcile has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, ternaries 5, if/else 3. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: 5 other methods here (durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::adoptNewestDraft, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::stageProject, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 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.
D4 · Code Duplication · Duplicated block (19 lines × 2) · ×6
  • Duplicated block (19 lines × 2) invokeai/app/invocations/wan/wan_denoise.py:644 — invokeai/app/invocations/wan/wan_denoise.py:644-662 | invokeai/app/invocations/wan/wan_video_denoise.py:299-317 — before extracting anything, compare `invokeai/app/invocations/wan/wan_denoise.py` and `invokeai/app/invocations/wan/wan_video_denoise.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 150 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/wan/wan_denoise.py:644` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (19 lines × 2) invokeai/app/services/shared/graph.py:1703 — invokeai/app/services/shared/graph.py:1703-1721 | invokeai/app/services/shared/graph.py:3044-3062 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `effects` to `Iterable[Any]` in one and `Iterable[Any] = ()` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (19 lines × 2) invokeai/backend/flux/controlnet/state_dict_utils.py:151 — invokeai/backend/flux/controlnet/state_dict_utils.py:151-169 | invokeai/backend/model_manager/load/model_loaders/flux.py:2294-2312 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/flux/controlnet/state_dict_utils.py:151` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19 lines × 2) invokeai/backend/image_util/color_conversion.py:650 — invokeai/backend/image_util/color_conversion.py:650-668 | invokeai/backend/image_util/color_conversion.py:707-725 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:124 — invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:124-142 | invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py:123-141 — before extracting anything, compare `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py` and `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 161 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (19 lines × 2) invokeai/app/api/routers/utilities.py:171 — invokeai/app/api/routers/utilities.py:171-191 | invokeai/app/services/fonts/fonts_parsing.py:35-53 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (17 lines × 2) · ×6
  • Duplicated block (17 lines × 2) invokeai/app/invocations/cogview4/cogview4_denoise.py:271 — invokeai/app/invocations/cogview4/cogview4_denoise.py:271-287 | invokeai/app/invocations/qwen_image/qwen_image_denoise.py:467-483 — `invokeai/app/invocations/cogview4/cogview4_denoise.py` and `invokeai/app/invocations/qwen_image/qwen_image_denoise.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 43 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/cogview4/cogview4_denoise.py:271` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:165 — invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:165-181 | invokeai/app/invocations/z_image/z_image_lora_loader.py:137-153 — before extracting anything, compare `invokeai/app/invocations/flux2/flux2_klein_lora_loader.py` and `invokeai/app/invocations/z_image/z_image_lora_loader.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 101 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17 lines × 2) invokeai/app/services/events/events_common.py:655 — invokeai/app/services/events/events_common.py:655-671 | invokeai/app/services/events/events_common.py:691-707 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17 lines × 2) invokeai/backend/hidiffusion/hidiffusion.py:542 — invokeai/backend/hidiffusion/hidiffusion.py:542-558 | invokeai/backend/hidiffusion/hidiffusion.py:578-594 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17 lines × 2) invokeai/backend/minimax_h3/contiguous_attention.py:59 — invokeai/backend/minimax_h3/contiguous_attention.py:59-75 | invokeai/backend/minimax_h3/transformer_minimax_h3.py:170-186 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `invokeai/backend/minimax_h3/contiguous_attention.py:80` calls `_head_major_contiguous` and `invokeai/backend/minimax_h3/transformer_minimax_h3.py:192` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (17 lines × 2) invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:71 — invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:71-87 | invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py:70-86 — before extracting anything, compare `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py` and `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 161 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:71` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (16 lines × 2) · ×6
  • Duplicated block (16 lines × 2) invokeai/app/invocations/cogview4/cogview4_denoise.py:338 — invokeai/app/invocations/cogview4/cogview4_denoise.py:338-353 | invokeai/app/invocations/sd3/sd3_denoise.py:316-331 — `invokeai/app/invocations/cogview4/cogview4_denoise.py` and `invokeai/app/invocations/sd3/sd3_denoise.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 126 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (16 lines × 2) invokeai/app/invocations/flux/flux_denoise.py:228 — invokeai/app/invocations/flux/flux_denoise.py:228-243 | invokeai/app/invocations/flux2/flux2_denoise.py:240-255 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/app/invocations/flux2/flux2_denoise.py:236` calls `_get_bn_stats` and `invokeai/app/invocations/flux/flux_denoise.py:225` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (16 lines × 2) invokeai/app/invocations/vae/cogview4_image_to_latents.py:44 — invokeai/app/invocations/vae/cogview4_image_to_latents.py:44-59 | invokeai/app/invocations/vae/sd3_image_to_latents.py:40-55 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/vae/cogview4_image_to_latents.py:44` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (16 lines × 2) invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:92 — invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:92-107 | invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py:91-106 — before extracting anything, compare `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py` and `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 161 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (16 lines × 2) invokeai/backend/pid/_src/networks/pixeldit_official.py:1038 — invokeai/backend/pid/_src/networks/pixeldit_official.py:1038-1053 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1112-1127 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) invokeai/backend/patches/lora_conversions/ltx2_lora_conversion_utils.py:119 — invokeai/backend/patches/lora_conversions/ltx2_lora_conversion_utils.py:119-134 | invokeai/backend/patches/lora_conversions/minimax_h3_lora_conversion_utils.py:171-186 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
AC2 · Forms & labels · <CompositeNumberInput> field component without a label · ×5
  • <CompositeNumberInput> field component without a label invokeai/frontend/webv1/src/features/controlLayers/components/ParamDenoisingStrength.tsx:91 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <CompositeNumberInput> field component without a label invokeai/frontend/webv1/src/features/controlLayers/components/Tool/ToolWidthPicker.tsx:200 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <CompositeNumberInput> field component without a label invokeai/frontend/webv1/src/features/controlLayers/components/common/Weight.tsx:43 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <CompositeNumberInput> field component without a label invokeai/frontend/webv1/src/features/dynamicPrompts/components/ParamDynamicPromptsMaxPrompts.tsx:48 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <CompositeNumberInput> field component without a label invokeai/frontend/webv1/src/features/lora/components/LoRACard.tsx:106 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
D1 · Cyclomatic Complexity · durableSyncedPersistence.createDurableSyncedWorkbenchPersistence · ×5
  • durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject (cyclomatic 31) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:1372 — durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 4 other methods here (durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::stageProject, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::pushHalves, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::reconcile, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 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.
  • durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::hydrateProjectWithDraft (cyclomatic 28) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:2186 — durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::hydrateProjectWithDraft has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 4 other methods here (durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::stageProject, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::pushHalves, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 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.
  • durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::pushHalves (cyclomatic 21) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:1473 — durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::pushHalves has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 4 other methods here (durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::stageProject, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::reconcile, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 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.
  • durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::stageProject (cyclomatic 18) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:1105 — durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::stageProject has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 4 other methods here (durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::pushHalves, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::reconcile, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 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.
  • durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::reconcile (cyclomatic 18) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:1668 — durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::reconcile has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: 4 other methods here (durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::stageProject, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject, durableSyncedPersistence.createDurableSyncedWorkbenchPersistence::pushStagedProject::pushHalves, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 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.
D4 · Code Duplication · Duplicated block (12–15 lines × 2) · ×5
  • Duplicated block (12–15 lines × 2) invokeai/app/invocations/ltx2/ltx2_lora_loader.py:88 — invokeai/app/invocations/ltx2/ltx2_lora_loader.py:88-102 | invokeai/app/invocations/ltx2/ltx2_lora_loader.py:153-164 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12–15 lines × 2) invokeai/app/invocations/minimax_h3/minimax_h3_lora_loader.py:81 — invokeai/app/invocations/minimax_h3/minimax_h3_lora_loader.py:81-95 | invokeai/app/invocations/minimax_h3/minimax_h3_lora_loader.py:146-157 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12–15 lines × 2) invokeai/backend/hidiffusion/hidiffusion.py:2151 — invokeai/backend/hidiffusion/hidiffusion.py:2151-2162 | invokeai/backend/hidiffusion/hidiffusion.py:2206-2220 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12–15 lines × 2) invokeai/backend/minimax_h3/rocm_causal_conv3d.py:50 — invokeai/backend/minimax_h3/rocm_causal_conv3d.py:50-61 | invokeai/backend/wan/rocm_causal_conv3d.py:41-55 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (12–15 lines × 2) scripts/calibrate_flux2_denoise_working_memory.py:576 — scripts/calibrate_flux2_denoise_working_memory.py:576-587 | scripts/calibrate_krea2_working_memory.py:698-712 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/calibrate_krea2_working_memory.py:698` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (10–11 lines × 2) · ×5
  • Duplicated block (10–11 lines × 2) invokeai/app/invocations/resize_latents.py:54 — invokeai/app/invocations/resize_latents.py:54-64 | invokeai/app/invocations/resize_latents.py:94-103 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/resize_latents.py:54` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (10–11 lines × 2) invokeai/app/invocations/sd/denoise_latents.py:1133 — invokeai/app/invocations/sd/denoise_latents.py:1133-1143 | invokeai/app/invocations/sd/tiled_multi_diffusion_denoise_latents.py:220-229 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (10–11 lines × 2) invokeai/app/services/shared/graph_materializer.py:938 — invokeai/app/services/shared/graph_materializer.py:938-948 | invokeai/app/services/shared/graph_materializer.py:979-988 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/shared/graph_materializer.py:938` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (10–11 lines × 2) invokeai/backend/image_util/lineart_anime.py:184 — invokeai/backend/image_util/lineart_anime.py:184-193 | invokeai/backend/image_util/lineart_anime.py:251-261 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10–11 lines × 2) invokeai/backend/model_manager/load/model_loaders/vae.py:324 — invokeai/backend/model_manager/load/model_loaders/vae.py:324-333 | invokeai/backend/model_manager/load/model_loaders/vae.py:474-484 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (8 lines × 3) · ×5
  • Duplicated block (8 lines × 3) invokeai/app/invocations/text_encoder/anima_text_encoder.py:286 — invokeai/app/invocations/text_encoder/anima_text_encoder.py:286-293 | invokeai/app/invocations/text_encoder/flux2_klein_text_encoder.py:213-220 | invokeai/app/invocations/text_encoder/z_image_text_encoder.py:213-220 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (8 lines × 3) invokeai/app/services/external_generation/providers/gemini.py:111 — invokeai/app/services/external_generation/providers/gemini.py:111-120 | invokeai/app/services/external_generation/providers/openai.py:117-126 | invokeai/app/services/external_generation/providers/seedream.py:101-108 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/external_generation/providers/gemini.py:111` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) invokeai/app/services/shared/graph.py:1646 — invokeai/app/services/shared/graph.py:1646-1653 | invokeai/app/services/shared/graph.py:1688-1695 | invokeai/app/services/shared/graph.py:1751-1758 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/shared/graph.py:1646` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) invokeai/backend/pid/_src/networks/pixeldit_official.py:460 — invokeai/backend/pid/_src/networks/pixeldit_official.py:460-467 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1063-1070 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1137-1144 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (8 lines × 3) invokeai/backend/image_util/color_conversion.py:420 — invokeai/backend/image_util/color_conversion.py:420-427 | invokeai/backend/image_util/color_conversion.py:429-436 | invokeai/backend/image_util/color_conversion.py:437-444 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/image_util/color_conversion.py:420` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/backend/image_util/color_conversion.py:420` calls `where` and `invokeai/backend/image_util/color_conversion.py:437` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
AC1 · Text alternatives · <canvas> without a text alternative · ×4
  • <canvas> without a text alternative invokeai/frontend/webv1/src/features/controlLayers/components/RasterLayer/RasterLayerCurvesAdjustmentsGraph.tsx:421 — A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content.
  • <canvas> without a text alternative invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasSurface.tsx:129 — A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content.
  • <canvas> without a text alternative invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasSurface.tsx:130 — A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content.
  • <canvas> without a text alternative invokeai/frontend/webv2/src/workbench/widgets/layers/LayerThumbnail.tsx:94 — A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content.
D2 · Cognitive Complexity · promptAST.parseTokens · ×4
  • promptAST.parseTokens::tryParseUnquotedPromptFunction (cognitive 48) invokeai/frontend/webv1/src/common/util/promptAST.ts:535 — promptAST.parseTokens::tryParseUnquotedPromptFunction has cognitive complexity 48 (threshold 15). Drivers by points: if/else 14 (30 pts), loops 5 (11 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (promptAST.parseTokens::isUnquotedPromptFunctionAhead, promptAST.parseTokens::tryParsePromptFunction, promptAST.parseTokens::parseGroup) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • promptAST.parseTokens::parseGroup (cognitive 45) invokeai/frontend/webv1/src/common/util/promptAST.ts:651 — promptAST.parseTokens::parseGroup has cognitive complexity 45 (threshold 15). Drivers by points: if/else 11 (36 pts), loops 2 (4 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (promptAST.parseTokens::isUnquotedPromptFunctionAhead, promptAST.parseTokens::tryParsePromptFunction, promptAST.parseTokens::tryParseUnquotedPromptFunction) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • promptAST.parseTokens::tryParsePromptFunction (cognitive 38) invokeai/frontend/webv1/src/common/util/promptAST.ts:407 — promptAST.parseTokens::tryParsePromptFunction has cognitive complexity 38 (threshold 15). Drivers by points: if/else 14 (28 pts), loops 4 (9 pts), boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (promptAST.parseTokens::isUnquotedPromptFunctionAhead, promptAST.parseTokens::tryParseUnquotedPromptFunction, promptAST.parseTokens::parseGroup) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • promptAST.parseTokens::isUnquotedPromptFunctionAhead (cognitive 18) invokeai/frontend/webv1/src/common/util/promptAST.ts:311 — promptAST.parseTokens::isUnquotedPromptFunctionAhead has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (promptAST.parseTokens::tryParsePromptFunction, promptAST.parseTokens::tryParseUnquotedPromptFunction, promptAST.parseTokens::parseGroup) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · documentModel.createDocumentModel · ×4
  • documentModel.createDocumentModel::prepareReorder (cognitive 26) invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts:734 — documentModel.createDocumentModel::prepareReorder has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (24 pts), loops 1, ternaries 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (documentModel.createDocumentModel::prepareInsert, documentModel.createDocumentModel::checkReparent, documentModel.createDocumentModel::preparePatchConfigBatch) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • documentModel.createDocumentModel::checkReparent (cognitive 23) invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts:832 — documentModel.createDocumentModel::checkReparent has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 5, ternaries 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition. This shape REPEATS in the file: 3 other methods here (documentModel.createDocumentModel::prepareInsert, documentModel.createDocumentModel::prepareReorder, documentModel.createDocumentModel::preparePatchConfigBatch) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • documentModel.createDocumentModel::prepareInsert (cognitive 20) invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts:530 — documentModel.createDocumentModel::prepareInsert has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 4, loops 2, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (documentModel.createDocumentModel::prepareReorder, documentModel.createDocumentModel::checkReparent, documentModel.createDocumentModel::preparePatchConfigBatch) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • documentModel.createDocumentModel::preparePatchConfigBatch (cognitive 16) invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts:1266 — documentModel.createDocumentModel::preparePatchConfigBatch has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (documentModel.createDocumentModel::prepareInsert, documentModel.createDocumentModel::prepareReorder, documentModel.createDocumentModel::checkReparent) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D29 · Static Analysis (SAST) · REDACTED · ×4
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) · ×4
  • Members sharing a duplicated core (5 members, 50+ identical tokens) invokeai/app/invocations/anima/anima_lora_loader.py:125 — invokeai/app/invocations/anima/anima_lora_loader.py:125-166 | invokeai/app/invocations/flux/flux_lora_loader.py:147-186 | invokeai/app/invocations/flux2/flux2_dev_lora_loader.py:146-184 | invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:164-212 | invokeai/app/invocations/z_image/z_image_lora_loader.py:136-181 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) invokeai/backend/model_manager/configs/base.py:244 — invokeai/backend/model_manager/configs/base.py:244-255 | invokeai/backend/model_manager/configs/main.py:3987-3998 | invokeai/backend/model_manager/configs/main.py:4141-4152 | invokeai/backend/model_manager/configs/main.py:4305-4317 | invokeai/backend/model_manager/model_on_disk.py:166-180 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) invokeai/backend/model_manager/load/model_loaders/flux.py:872 — invokeai/backend/model_manager/load/model_loaders/flux.py:872-1013 | invokeai/backend/model_manager/load/model_loaders/flux.py:1265-1549 | invokeai/backend/model_manager/load/model_loaders/ideogram4.py:362-516 | invokeai/backend/model_manager/load/model_loaders/krea2.py:542-779 | invokeai/backend/model_manager/load/model_loaders/z_image.py:486-734 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) scripts/calibrate_flux2_denoise_working_memory.py:569 — scripts/calibrate_flux2_denoise_working_memory.py:569-640 | scripts/calibrate_flux3_denoise_working_memory.py:804-894 | scripts/calibrate_krea2_working_memory.py:689-783 | scripts/calibrate_vae_tiling_working_memory.py:676-715 | scripts/calibrate_z_image_working_memory.py:506-569 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication · Duplicated block (20 lines × 2) · ×4
  • Duplicated block (20 lines × 2) invokeai/app/api/routers/utilities.py:141 — invokeai/app/api/routers/utilities.py:141-160 | invokeai/app/services/fonts/fonts_parsing.py:69-88 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `record` to `object` in one and `Any` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (20 lines × 2) invokeai/app/invocations/video_concat.py:346 — invokeai/app/invocations/video_concat.py:346-365 | invokeai/app/invocations/video_frame_extract_range.py:309-328 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (20 lines × 2) invokeai/backend/image_util/clarity.py:23 — invokeai/backend/image_util/clarity.py:23-42 | invokeai/backend/image_util/texture.py:24-43 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `size` to `float = 40` in one and `float = 8` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (20 lines × 2) invokeai/backend/minimax_h3/autoencoder_kl_minimax_h3.py:901 — invokeai/backend/minimax_h3/autoencoder_kl_minimax_h3.py:901-920 | invokeai/backend/minimax_h3/autoencoder_kl_minimax_h3_audio.py:659-678 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (11–12 lines × 2) · ×4
  • Duplicated block (11–12 lines × 2) invokeai/app/api/routers/image_map.py:643 — invokeai/app/api/routers/image_map.py:643-654 | invokeai/app/api/routers/image_map.py:869-879 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/api/routers/image_map.py:643` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11–12 lines × 2) invokeai/app/invocations/text_encoder/flux2_klein_text_encoder.py:87 — invokeai/app/invocations/text_encoder/flux2_klein_text_encoder.py:87-98 | invokeai/app/invocations/text_encoder/flux_text_encoder.py:67-77 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11–12 lines × 2) invokeai/app/services/shared/graph_if_dependencies.py:42 — invokeai/app/services/shared/graph_if_dependencies.py:42-53 | invokeai/app/services/shared/graph_if_dependencies.py:116-126 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `invokeai/app/services/shared/graph_if_dependencies.py:127` calls `_get_input_edges` and `invokeai/app/services/shared/graph_if_dependencies.py:55` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11–12 lines × 2) invokeai/backend/pid/_src/networks/pid_net.py:394 — invokeai/backend/pid/_src/networks/pid_net.py:394-405 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1480-1490 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (6 lines × 3) · ×4
  • Duplicated block (6 lines × 3) invokeai/app/services/shared/execution_engine/child.py:40 — invokeai/app/services/shared/execution_engine/child.py:40-45 | invokeai/app/services/shared/execution_engine/primitives.py:99-104 | invokeai/app/services/shared/execution_engine/scheduler.py:47-52 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (6 lines × 3) invokeai/backend/flux/controlnet/instantx_controlnet_flux.py:56 — invokeai/backend/flux/controlnet/instantx_controlnet_flux.py:56-61 | invokeai/backend/flux/controlnet/xlabs_controlnet_flux.py:36-41 | invokeai/backend/flux/model.py:54-59 — before extracting anything, compare `invokeai/backend/flux/controlnet/instantx_controlnet_flux.py` and `invokeai/backend/flux/controlnet/xlabs_controlnet_flux.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 3) invokeai/backend/model_manager/load/model_loaders/vae.py:396 — invokeai/backend/model_manager/load/model_loaders/vae.py:396-401 | invokeai/backend/model_manager/load/model_loaders/vae.py:520-525 | invokeai/backend/model_manager/load/model_loaders/wan.py:535-540 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/backend/model_manager/load/model_loaders/vae.py:519` calls `_wan_family_dtype` and `invokeai/backend/model_manager/load/model_loaders/vae.py:394` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 3) scripts/calibrate_flux2_denoise_working_memory.py:425 — scripts/calibrate_flux2_denoise_working_memory.py:425-430 | scripts/calibrate_flux3_denoise_working_memory.py:598-603 | scripts/calibrate_z_image_working_memory.py:406-411 — before extracting anything, compare `scripts/calibrate_flux2_denoise_working_memory.py` and `scripts/calibrate_flux3_denoise_working_memory.py` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
AC6 · Visual & motion safety · Animation without a prefers-reduced-motion guard · ×3
  • Animation without a prefers-reduced-motion guard docs/src/styles/custom.css:50 — `.site-title` moves (`transition: transform 100ms ease-in-out`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard docs/src/styles/custom.css:309 — `.sl-link-button` moves (`transition: transform 100ms ease-in-out`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard docs/src/styles/custom.css:401 — `.splash-img::before` moves (`animation: splash-animate 6s ease-in-out infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
D1 · Cyclomatic Complexity · promptAST.parseTokens · ×3
  • promptAST.parseTokens::tryParseUnquotedPromptFunction (cyclomatic 24) invokeai/frontend/webv1/src/common/util/promptAST.ts:535 — promptAST.parseTokens::tryParseUnquotedPromptFunction has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 2 other methods here (promptAST.parseTokens::tryParsePromptFunction, promptAST.parseTokens::parseGroup) have the same decision points, in the same order, at the same nesting depths — 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.
  • promptAST.parseTokens::parseGroup (cyclomatic 23) invokeai/frontend/webv1/src/common/util/promptAST.ts:651 — promptAST.parseTokens::parseGroup has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 2 other methods here (promptAST.parseTokens::tryParsePromptFunction, promptAST.parseTokens::tryParseUnquotedPromptFunction) have the same decision points, in the same order, at the same nesting depths — 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.
  • promptAST.parseTokens::tryParsePromptFunction (cyclomatic 19) invokeai/frontend/webv1/src/common/util/promptAST.ts:407 — promptAST.parseTokens::tryParsePromptFunction has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 2 other methods here (promptAST.parseTokens::tryParseUnquotedPromptFunction, promptAST.parseTokens::parseGroup) have the same decision points, in the same order, at the same nesting depths — 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.
D29 · Static Analysis (SAST) · REDACTED · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D31 · IaC & Container Security · Medium IaC · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) · ×3
  • Members sharing a duplicated core (6 members, 50+ identical tokens) invokeai/app/invocations/anima/anima_denoise.py:1105 — invokeai/app/invocations/anima/anima_denoise.py:1105-1127 | invokeai/app/invocations/text_encoder/anima_text_encoder.py:286-294 | invokeai/app/invocations/text_encoder/flux2_dev_text_encoder.py:256-265 | invokeai/app/invocations/text_encoder/flux2_klein_text_encoder.py:213-221 | invokeai/app/invocations/text_encoder/z_image_text_encoder.py:213-221 | invokeai/app/invocations/z_image/z_image_denoise.py:761-769 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) invokeai/app/invocations/vae/anima_image_to_latents.py:69 — invokeai/app/invocations/vae/anima_image_to_latents.py:69-120 | invokeai/app/invocations/vae/anima_latents_to_image.py:82-197 | invokeai/app/invocations/vae/minimax_h3_latents_to_video.py:56-134 | invokeai/app/invocations/vae/wan_image_to_latents.py:54-89 | invokeai/app/invocations/vae/wan_latents_to_image.py:51-121 | invokeai/app/invocations/vae/wan_latents_to_video.py:99-272 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) invokeai/app/util/user_management.py:82 — invokeai/app/util/user_management.py:82-140 | invokeai/app/util/user_management.py:144-180 | invokeai/app/util/user_management.py:218-268 | invokeai/app/util/user_management.py:272-316 | invokeai/app/util/user_management.py:450-542 | invokeai/app/util/user_management.py:551-599 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication · Duplicated block (27 lines × 2) · ×3
  • Duplicated block (27 lines × 2) invokeai/app/invocations/metadata_linked.py:1015 — invokeai/app/invocations/metadata_linked.py:1015-1041 | invokeai/app/invocations/metadata_linked.py:1095-1121 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (27 lines × 2) invokeai/app/invocations/text_encoder/flux2_dev_text_encoder.py:148 — invokeai/app/invocations/text_encoder/flux2_dev_text_encoder.py:148-174 | invokeai/app/invocations/text_encoder/flux2_klein_text_encoder.py:125-151 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (27 lines × 2) invokeai/backend/pid/_src/networks/pid_net.py:322 — invokeai/backend/pid/_src/networks/pid_net.py:322-348 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1423-1449 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `invokeai/backend/pid/_src/networks/pid_net.py:353` calls `split_inputs_cp` and `invokeai/backend/pid/_src/networks/pixeldit_official.py:1450` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (25 lines × 2) · ×3
  • Duplicated block (25 lines × 2) invokeai/app/invocations/ltx2/ltx2_extend_conditioning.py:262 — invokeai/app/invocations/ltx2/ltx2_extend_conditioning.py:262-286 | invokeai/app/invocations/ltx2/ltx2_video_conditioning.py:131-155 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/ltx2/ltx2_extend_conditioning.py:262` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (25 lines × 2) invokeai/app/util/user_management.py:116 — invokeai/app/util/user_management.py:116-140 | invokeai/app/util/user_management.py:156-180 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (25 lines × 2) invokeai/app/util/user_management.py:244 — invokeai/app/util/user_management.py:244-268 | invokeai/app/util/user_management.py:292-316 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (24 lines × 2) · ×3
  • Duplicated block (24 lines × 2) invokeai/backend/flux2/denoise.py:141 — invokeai/backend/flux2/denoise.py:141-164 | invokeai/backend/flux2/denoise.py:259-282 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (24 lines × 2) invokeai/backend/ltx2/denoise.py:387 — invokeai/backend/ltx2/denoise.py:387-410 | invokeai/backend/ltx2/denoise.py:569-592 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (24 lines × 2) invokeai/backend/model_manager/configs/qwen3_encoder.py:308 — invokeai/backend/model_manager/configs/qwen3_encoder.py:308-331 | invokeai/backend/model_manager/configs/qwen3_encoder.py:492-515 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (22 lines × 2) · ×3
  • Duplicated block (22 lines × 2) invokeai/app/invocations/wan/wan_denoise.py:691 — invokeai/app/invocations/wan/wan_denoise.py:691-712 | invokeai/app/invocations/wan/wan_video_denoise.py:352-373 — before extracting anything, compare `invokeai/app/invocations/wan/wan_denoise.py` and `invokeai/app/invocations/wan/wan_video_denoise.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 150 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/app/invocations/wan/wan_video_denoise.py:347` calls `expand` and `invokeai/app/invocations/wan/wan_denoise.py:689` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (22 lines × 2) invokeai/app/services/shared/database/queries/images.py:356 — invokeai/app/services/shared/database/queries/images.py:356-377 | invokeai/app/services/shared/database/queries/images.py:399-420 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/shared/database/queries/images.py:356` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (22 lines × 2) invokeai/app/util/user_management.py:521 — invokeai/app/util/user_management.py:521-542 | invokeai/app/util/user_management.py:578-599 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (18 lines × 2) · ×3
  • Duplicated block (18 lines × 2) invokeai/app/services/shared/database/queries/videos.py:312 — invokeai/app/services/shared/database/queries/videos.py:312-329 | invokeai/app/services/shared/database/queries/videos.py:349-366 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/shared/database/queries/videos.py:312` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (18 lines × 2) invokeai/backend/flux2/denoise.py:169 — invokeai/backend/flux2/denoise.py:169-186 | invokeai/backend/flux2/denoise.py:287-304 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) invokeai/backend/flux2/denoise_working_memory.py:137 — invokeai/backend/flux2/denoise_working_memory.py:137-154 | invokeai/backend/flux3/denoise_working_memory.py:156-173 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (14–16 lines × 2) · ×3
  • Duplicated block (14–16 lines × 2) invokeai/app/invocations/composition-nodes.py:123 — invokeai/app/invocations/composition-nodes.py:123-136 | invokeai/app/invocations/composition-nodes.py:220-235 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14–16 lines × 2) invokeai/app/services/images/images_default.py:108 — invokeai/app/services/images/images_default.py:108-123 | invokeai/app/services/videos/videos_default.py:92-105 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/images/images_default.py:108` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14–16 lines × 2) invokeai/backend/quantization/scripts/load_flux_model_bnb_llm_int8.py:45 — invokeai/backend/quantization/scripts/load_flux_model_bnb_llm_int8.py:45-58 | invokeai/backend/quantization/scripts/load_flux_model_bnb_nf4.py:58-73 — before extracting anything, compare `invokeai/backend/quantization/scripts/load_flux_model_bnb_llm_int8.py` and `invokeai/backend/quantization/scripts/load_flux_model_bnb_nf4.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/quantization/scripts/load_flux_model_bnb_nf4.py:58` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14–15 lines × 2) · ×3
  • Duplicated block (14–15 lines × 2) invokeai/app/api/routers/style_presets.py:109 — invokeai/app/api/routers/style_presets.py:109-123 | invokeai/app/api/routers/style_presets.py:201-214 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14–15 lines × 2) invokeai/app/invocations/cogview4/cogview4_denoise.py:330 — invokeai/app/invocations/cogview4/cogview4_denoise.py:330-344 | invokeai/app/invocations/z_image/z_image_denoise.py:665-678 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/cogview4/cogview4_denoise.py:330` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14–15 lines × 2) invokeai/app/services/shared/graph_materializer.py:984 — invokeai/app/services/shared/graph_materializer.py:984-998 | invokeai/app/services/shared/graph_materializer.py:1092-1105 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/shared/graph_materializer.py:984` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (9–11 lines × 3) · ×3
  • Duplicated block (9–11 lines × 3) invokeai/app/api/sockets.py:1063 — invokeai/app/api/sockets.py:1063-1073 | invokeai/app/api/sockets.py:1122-1131 | invokeai/app/api/sockets.py:1169-1177 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/api/sockets.py:1063` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9–11 lines × 3) invokeai/app/invocations/vae/anima_image_to_latents.py:124 — invokeai/app/invocations/vae/anima_image_to_latents.py:124-134 | invokeai/app/invocations/vae/wan_image_to_latents.py:93-101 | invokeai/app/invocations/vae/z_image_image_to_latents.py:110-120 — before extracting anything, compare `invokeai/app/invocations/vae/anima_image_to_latents.py` and `invokeai/app/invocations/vae/z_image_image_to_latents.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/vae/anima_image_to_latents.py:124` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (9–11 lines × 3) invokeai/app/services/images/images_default.py:405 — invokeai/app/services/images/images_default.py:405-413 | invokeai/app/services/images/images_default.py:419-427 | invokeai/app/services/images/images_default.py:433-443 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/images/images_default.py:433` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10 lines × 4) · ×3
  • Duplicated block (10 lines × 4) invokeai/app/services/shared/graph_materializer.py:503 — invokeai/app/services/shared/graph_materializer.py:503-513 | invokeai/app/services/shared/graph_materializer.py:615-625 | invokeai/app/services/shared/graph_materializer.py:943-953 | invokeai/app/services/shared/graph_materializer.py:1049-1058 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/shared/graph_materializer.py:503` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 4) invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_conv2d.py:16 — invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_conv2d.py:16-25 | invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_invoke_linear_8_bit_lt.py:19-28 | invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_invoke_linear_nf4.py:21-30 | invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_linear.py:88-97 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (10 lines × 4) scripts/calibrate_flux2_denoise_working_memory.py:592 — scripts/calibrate_flux2_denoise_working_memory.py:592-601 | scripts/calibrate_krea2_working_memory.py:725-734 | scripts/calibrate_vae_tiling_working_memory.py:685-694 | scripts/calibrate_z_image_working_memory.py:526-535 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/calibrate_flux2_denoise_working_memory.py:592` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `scripts/calibrate_flux2_denoise_working_memory.py:602` calls `list` and `scripts/calibrate_z_image_working_memory.py:536` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (9 lines × 4) · ×3
  • Duplicated block (9 lines × 4) invokeai/app/api/routers/workflows.py:394 — invokeai/app/api/routers/workflows.py:394-402 | invokeai/app/api/routers/workflows.py:458-466 | invokeai/app/api/routers/workflows.py:549-557 | invokeai/app/api/routers/workflows.py:572-580 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9 lines × 4) invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:92 — invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:92-100 | invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:194-202 | invokeai/app/invocations/z_image/z_image_lora_loader.py:71-79 | invokeai/app/invocations/z_image/z_image_lora_loader.py:163-171 — before extracting anything, compare `invokeai/app/invocations/flux2/flux2_klein_lora_loader.py` and `invokeai/app/invocations/z_image/z_image_lora_loader.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 101 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:191` calls `_assert_not_dev_lora` and `invokeai/app/invocations/z_image/z_image_lora_loader.py:162` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 4) invokeai/app/invocations/vae/anima_image_to_latents.py:134 — invokeai/app/invocations/vae/anima_image_to_latents.py:134-142 | invokeai/app/invocations/vae/flux2_vae_encode.py:139-147 | invokeai/app/invocations/vae/qwen_image_image_to_latents.py:190-198 | invokeai/app/invocations/vae/z_image_image_to_latents.py:120-128 — before extracting anything, compare `invokeai/app/invocations/vae/anima_image_to_latents.py` and `invokeai/app/invocations/vae/z_image_image_to_latents.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/vae/anima_image_to_latents.py:134` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/app/invocations/vae/anima_image_to_latents.py:132` calls `signal_progress` and `invokeai/app/invocations/vae/qwen_image_image_to_latents.py:187` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8–9 lines × 2) · ×3
  • Duplicated block (8–9 lines × 2) invokeai/app/invocations/sd/denoise_latents.py:1101 — invokeai/app/invocations/sd/denoise_latents.py:1101-1108 | invokeai/app/invocations/sd/tiled_multi_diffusion_denoise_latents.py:195-203 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (8–9 lines × 2) invokeai/app/services/shared/graph_materializer.py:910 — invokeai/app/services/shared/graph_materializer.py:910-918 | invokeai/app/services/shared/graph_materializer.py:1029-1036 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8–9 lines × 2) invokeai/app/util/aac_splice.py:160 — invokeai/app/util/aac_splice.py:160-168 | invokeai/app/util/h264_splice.py:355-362 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (7–8 lines × 2) · ×3
  • Duplicated block (7–8 lines × 2) invokeai/app/invocations/model.py:532 — invokeai/app/invocations/model.py:532-538 | invokeai/app/invocations/model.py:692-699 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `invokeai/app/invocations/model.py:702` calls `model_copy` and `invokeai/app/invocations/model.py:540` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7–8 lines × 2) invokeai/backend/flux/controlnet/instantx_controlnet_flux.py:149 — invokeai/backend/flux/controlnet/instantx_controlnet_flux.py:149-155 | invokeai/backend/flux/controlnet/xlabs_controlnet_flux.py:116-123 — before extracting anything, compare `invokeai/backend/flux/controlnet/instantx_controlnet_flux.py` and `invokeai/backend/flux/controlnet/xlabs_controlnet_flux.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7–8 lines × 2) invokeai/backend/image_util/imwatermark/vendor.py:229 — invokeai/backend/image_util/imwatermark/vendor.py:229-236 | invokeai/backend/image_util/imwatermark/vendor.py:295-301 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/image_util/imwatermark/vendor.py:229` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7 lines × 4) · ×3
  • Duplicated block (7 lines × 4) invokeai/app/invocations/flux/flux_lora_loader.py:160 — invokeai/app/invocations/flux/flux_lora_loader.py:160-167 | invokeai/app/invocations/flux2/flux2_dev_lora_loader.py:155-161 | invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:174-181 | invokeai/app/invocations/z_image/z_image_lora_loader.py:146-153 — before extracting anything, compare `invokeai/app/invocations/flux2/flux2_klein_lora_loader.py` and `invokeai/app/invocations/z_image/z_image_lora_loader.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 101 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 4) invokeai/app/invocations/text_encoder/anima_text_encoder.py:288 — invokeai/app/invocations/text_encoder/anima_text_encoder.py:288-294 | invokeai/app/invocations/text_encoder/flux2_klein_text_encoder.py:215-221 | invokeai/app/invocations/text_encoder/z_image_text_encoder.py:215-221 | invokeai/app/invocations/z_image/z_image_denoise.py:763-769 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times.
  • Duplicated block (7 lines × 4) invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_diffusers_rms_norm.py:34 — invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_diffusers_rms_norm.py:34-40 | invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_embedding.py:23-29 | invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_group_norm.py:16-22 | invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_layer_norm.py:19-25 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (5 lines × 4) · ×3
  • Duplicated block (5 lines × 4) invokeai/app/invocations/ltx2/ltx2_lora_loader.py:98 — invokeai/app/invocations/ltx2/ltx2_lora_loader.py:98-102 | invokeai/app/invocations/ltx2/ltx2_lora_loader.py:160-164 | invokeai/app/invocations/minimax_h3/minimax_h3_lora_loader.py:91-95 | invokeai/app/invocations/minimax_h3/minimax_h3_lora_loader.py:153-157 — `invokeai/app/invocations/ltx2/ltx2_lora_loader.py` and `invokeai/app/invocations/minimax_h3/minimax_h3_lora_loader.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 30 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (5 lines × 4) invokeai/backend/pid/_src/networks/pid_net.py:374 — invokeai/backend/pid/_src/networks/pid_net.py:374-378 | invokeai/backend/pid/_src/networks/pid_net.py:410-414 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1468-1472 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1493-1497 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (5 lines × 4) scripts/calibrate_flux2_denoise_working_memory.py:574 — scripts/calibrate_flux2_denoise_working_memory.py:574-578 | scripts/calibrate_krea2_working_memory.py:696-700 | scripts/calibrate_krea2_working_memory.py:711-717 | scripts/calibrate_z_image_working_memory.py:513-518 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/calibrate_flux2_denoise_working_memory.py:574` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `scripts/calibrate_z_image_working_memory.py:520` calls `list` and `scripts/calibrate_krea2_working_memory.py:719` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
IC1 · Incompleteness & stubs · Both branches are identical · ×3
  • Both branches are identical — the condition decides nothing invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasShapeToolModule.ts:839 — Both arms of this conditional expression are the same, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition.
  • Both branches are identical — the condition decides nothing invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasShapeToolModule.ts:840 — Both arms of this conditional expression are the same, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition.
  • Both branches are identical — the condition decides nothing invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasToolModule.ts:346 — The `if` and its `else` contain the same statements, so no input can make the condition matter. Implement the distinction that was intended, or drop the branch and keep the body.
P7 · Outbound HTTP resilience · Outbound HTTP without resilience · ×3
  • Outbound HTTP without resilience scripts/check_classifiers.py:21 — `urllib.request.urlopen(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience scripts/get_external_contributions.py:50 — `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience scripts/get_external_contributions.py:61 — `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
X15 · Unvalidated length from an untrusted reader · Length read from the parsed input is spent without ever being bounded · ×3
  • Length read from the parsed input is spent without ever being bounded scripts/calibrate_flux3_denoise_working_memory.py:267 — `length` is read from the bytes being parsed at line 266 (`struct.unpack("<Q")`), then passed as the size of `read` at line 267 — and nowhere in its function is `length` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `length` against the bytes actually remaining and a maximum the format allows before reading.
  • Length read from the parsed input is spent without ever being bounded invokeai/backend/quantization/int8_convrot.py:241 — `header_len` is read from the bytes being parsed at line 240 (`struct.unpack("<Q")`), then passed as the size of `read` at line 241 — and nowhere in its function is `header_len` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `header_len` against the bytes actually remaining and a maximum the format allows before reading.
  • Length read from the parsed input is spent without ever being bounded invokeai/backend/model_manager/util/model_util.py:25 — `definition_len` is read from the bytes being parsed at line 24 (`int.from_bytes(… 8 bytes …)`), then passed as the size of `read` at line 25 — and nowhere in its function is `definition_len` compared to anything, clamped, or bounded against the input that remains. Whoever wrote those bytes therefore chooses the allocation directly: the call reserves the whole length before a single byte of the payload is known to exist, so a 32-bit length asks for up to 4 GiB (a 64-bit one for more than any machine has), and the reservation either raises `MemoryError` out of a parser whose failure path was written for malformed input, not for hostile input, or succeeds and holds gigabytes for a few bytes on the wire. Bound `definition_len` against the bytes actually remaining and a maximum the format allows before reading.
AC2 · Forms & labels · <RadioGroup> field component without a label · ×2
  • <RadioGroup> field component without a label invokeai/frontend/webv1/src/features/controlLayers/components/SelectObject/SelectObjectModel.tsx:25 — This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <RadioGroup> field component without a label invokeai/frontend/webv1/src/features/controlLayers/components/SelectObject/SelectObjectPointType.tsx:26 — This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
D1 · Cyclomatic Complexity · forLoops.validateForLoopGraph · ×2
  • forLoops.validateForLoopGraph::getSupportedNestedForBody (cyclomatic 59) invokeai/frontend/webv2/src/features/workflow/core/forLoops.ts:414 — forLoops.validateForLoopGraph::getSupportedNestedForBody has cyclomatic complexity 59 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 2 other methods here (forLoops.validateForLoopGraph, forLoops.validateForLoopGraph::supportsNestedIterateBody) have the same decision points, in the same order, at the same nesting depths — 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.
  • forLoops.validateForLoopGraph::supportsNestedIterateBody (cyclomatic 25) invokeai/frontend/webv2/src/features/workflow/core/forLoops.ts:333 — forLoops.validateForLoopGraph::supportsNestedIterateBody has cyclomatic complexity 25 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: 2 other methods here (forLoops.validateForLoopGraph, forLoops.validateForLoopGraph::getSupportedNestedForBody) have the same decision points, in the same order, at the same nesting depths — 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.
D1 · Cyclomatic Complexity · documentModel.createDocumentModel · ×2
  • documentModel.createDocumentModel::checkReparent (cyclomatic 23) invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts:832 — documentModel.createDocumentModel::checkReparent has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (documentModel.createDocumentModel::prepareInsert) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • documentModel.createDocumentModel::prepareInsert (cyclomatic 17) invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts:530 — documentModel.createDocumentModel::prepareInsert 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 (documentModel.createDocumentModel::checkReparent) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D10 · Test Quality · Fixed-sleep synchronisation · ×2
  • Fixed-sleep synchronisation: extracts through a live unflushed mask whose contract bitmap is still null invokeai/frontend/webv2/src/workbench/canvas-engine/engine.mask.test.ts:565 — This test starts work it did not wait for (`engine`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => { setTimeout(resolve, 0); })` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
  • Fixed-sleep synchronisation: waits for a held lock until its holder lets it go, and stops waiting once aborted invokeai/frontend/webv2/src/platform/browser/webLocks.browser.test.ts:58 — This test starts work it did not wait for (`waiting`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => { setTimeout(resolve, 20); })` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
D2 · Cognitive Complexity · forLoops.validateForLoopGraph · ×2
  • forLoops.validateForLoopGraph::getSupportedNestedForBody (cognitive 76) invokeai/frontend/webv2/src/features/workflow/core/forLoops.ts:414 — forLoops.validateForLoopGraph::getSupportedNestedForBody has cognitive complexity 76 (threshold 15). Drivers by points: if/else 26 (38 pts), boolean chains 20, loops 9 (16 pts), ternaries 1 (2 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (forLoops.validateForLoopGraph, forLoops.validateForLoopGraph::supportsNestedIterateBody) have the same decision points, in the same order, at the same nesting depths — 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.
  • forLoops.validateForLoopGraph::supportsNestedIterateBody (cognitive 23) invokeai/frontend/webv2/src/features/workflow/core/forLoops.ts:333 — forLoops.validateForLoopGraph::supportsNestedIterateBody has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 9, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition. This shape REPEATS in the file: 2 other methods here (forLoops.validateForLoopGraph, forLoops.validateForLoopGraph::getSupportedNestedForBody) have the same decision points, in the same order, at the same nesting depths — 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.
D2 · Cognitive Complexity · onInvocationComplete.buildOnInvocationComplete · ×2
  • onInvocationComplete.buildOnInvocationComplete::addImagesToGallery (cognitive 21) invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:117 — onInvocationComplete.buildOnInvocationComplete::addImagesToGallery has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (16 pts), loops 3, boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: one other method here (onInvocationComplete.buildOnInvocationComplete::getResultVideoDTOs) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • onInvocationComplete.buildOnInvocationComplete::getResultVideoDTOs (cognitive 16) invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:365 — onInvocationComplete.buildOnInvocationComplete::getResultVideoDTOs has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (14 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. This shape REPEATS in the file: one other method here (onInvocationComplete.buildOnInvocationComplete::addImagesToGallery) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D4 · Code Duplication · Edited copy of a member (18 corresponding lines) · ×2
  • Edited copy of a member (18 corresponding lines) invokeai/backend/image_util/lineart_anime.py:165 — invokeai/backend/image_util/lineart_anime.py:165-206 | invokeai/backend/image_util/lineart_anime.py:242-274 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) invokeai/backend/patches/lora_conversions/flux3_lora_constants.py:328 — invokeai/backend/patches/lora_conversions/flux3_lora_constants.py:328-345 | invokeai/backend/patches/lora_conversions/qwen_image_2_1_lora_constants.py:185-202 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (37 lines × 2) · ×2
  • Duplicated block (37 lines × 2) invokeai/app/invocations/z_image/z_image_denoise.py:535 — invokeai/app/invocations/z_image/z_image_denoise.py:535-571 | invokeai/app/invocations/z_image/z_image_denoise.py:630-666 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (37 lines × 2) invokeai/backend/hidiffusion/hidiffusion.py:1600 — invokeai/backend/hidiffusion/hidiffusion.py:1600-1636 | invokeai/backend/hidiffusion/hidiffusion.py:1756-1792 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (31–35 lines × 2) · ×2
  • Duplicated block (31–35 lines × 2) invokeai/backend/anima/regional_prompting.py:143 — invokeai/backend/anima/regional_prompting.py:143-173 | invokeai/backend/z_image/extensions/regional_prompting_extension.py:171-205 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/z_image/extensions/regional_prompting_extension.py:171` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (31–35 lines × 2) invokeai/backend/model_manager/configs/main.py:4026 — invokeai/backend/model_manager/configs/main.py:4026-4060 | invokeai/backend/model_manager/configs/main.py:4180-4210 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (30 lines × 2) · ×2
  • Duplicated block (30 lines × 2) invokeai/app/invocations/vae/cogview4_latents_to_image.py:49 — invokeai/app/invocations/vae/cogview4_latents_to_image.py:49-78 | invokeai/app/invocations/vae/sd3_latents_to_image.py:51-80 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/vae/cogview4_latents_to_image.py:49` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (30 lines × 2) invokeai/backend/llava_onevision_pipeline.py:90 — invokeai/backend/llava_onevision_pipeline.py:90-119 | invokeai/backend/text_llm_pipeline.py:267-296 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (29 lines × 2) · ×2
  • Duplicated block (29 lines × 2) invokeai/app/services/session_processor/workflow_call_batch.py:106 — invokeai/app/services/session_processor/workflow_call_batch.py:106-134 | invokeai/app/services/shared/workflow_graph_builder.py:282-310 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note first that the copies are not typed on the same thing: the declarations holding them bind `workflow_nodes` to `Mapping[str, Mapping[str, Any]]` in one and `dict[str, Mapping[str, Any]]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (29 lines × 2) invokeai/backend/quantization/scripts/load_flux_model_bnb_llm_int8.py:14 — invokeai/backend/quantization/scripts/load_flux_model_bnb_llm_int8.py:14-42 | invokeai/backend/quantization/scripts/load_flux_model_bnb_nf4.py:27-55 — before extracting anything, compare `invokeai/backend/quantization/scripts/load_flux_model_bnb_llm_int8.py` and `invokeai/backend/quantization/scripts/load_flux_model_bnb_nf4.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (27–28 lines × 2) · ×2
  • Duplicated block (27–28 lines × 2) invokeai/backend/model_manager/load/model_loaders/cogview4.py:32 — invokeai/backend/model_manager/load/model_loaders/cogview4.py:32-59 | invokeai/backend/model_manager/load/model_loaders/flux.py:1115-1141 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (27–28 lines × 2) REDACTED:530 — REDACTED:530-557 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1046-1072 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (18–19 lines × 2) · ×2
  • Duplicated block (18–19 lines × 2) invokeai/app/invocations/text_encoder/flux2_klein_text_encoder.py:118 — invokeai/app/invocations/text_encoder/flux2_klein_text_encoder.py:118-135 | invokeai/app/invocations/text_encoder/z_image_text_encoder.py:89-107 — before extracting anything, compare `invokeai/app/invocations/text_encoder/flux2_klein_text_encoder.py` and `invokeai/app/invocations/text_encoder/z_image_text_encoder.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/text_encoder/flux2_klein_text_encoder.py:118` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/app/invocations/text_encoder/flux2_klein_text_encoder.py:117` calls `load`, `enter_context`, `model_on_device` and `invokeai/app/invocations/text_encoder/z_image_text_encoder.py:89` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (18–19 lines × 2) invokeai/backend/patches/lora_conversions/flux3_lora_constants.py:143 — invokeai/backend/patches/lora_conversions/flux3_lora_constants.py:143-160 | invokeai/backend/patches/lora_conversions/qwen_image_2_1_lora_constants.py:98-116 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (15–19 lines × 2) · ×2
  • Duplicated block (15–19 lines × 2) invokeai/app/services/image_files/image_files_disk.py:643 — invokeai/app/services/image_files/image_files_disk.py:643-661 | invokeai/app/services/video_files/video_files_disk.py:286-300 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (15–19 lines × 2) scripts/calibrate_flux2_denoise_working_memory.py:476 — scripts/calibrate_flux2_denoise_working_memory.py:476-494 | scripts/calibrate_flux3_denoise_working_memory.py:660-674 — before extracting anything, compare `scripts/calibrate_flux2_denoise_working_memory.py` and `scripts/calibrate_flux3_denoise_working_memory.py` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (17–19 lines × 2) · ×2
  • Duplicated block (17–19 lines × 2) invokeai/app/services/shared/graph_nested_iterate_planner.py:265 — invokeai/app/services/shared/graph_nested_iterate_planner.py:265-281 | invokeai/app/services/shared/graph_nested_iterate_planner.py:311-329 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/app/services/shared/graph_nested_iterate_planner.py:264` calls `_discard_source_executed` and `invokeai/app/services/shared/graph_nested_iterate_planner.py:310` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (17–19 lines × 2) invokeai/backend/stable_diffusion/diffusion/shared_invokeai_diffusion.py:282 — invokeai/backend/stable_diffusion/diffusion/shared_invokeai_diffusion.py:282-298 | invokeai/backend/stable_diffusion/diffusion/shared_invokeai_diffusion.py:402-420 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (14–18 lines × 4) · ×2
  • Duplicated block (14–18 lines × 4) invokeai/app/services/shared/sqlite_migrator/migrations/migration_2026_07_01_add_workflow_call_queue_metadata.py:12 — invokeai/app/services/shared/sqlite_migrator/migrations/migration_2026_07_01_add_workflow_call_queue_metadata.py:12-29 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_27.py:127-141 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_27.py:160-173 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_27.py:192-205 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (14–18 lines × 4) invokeai/backend/model_manager/load/model_loaders/z_image.py:391 — invokeai/backend/model_manager/load/model_loaders/z_image.py:391-404 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1351-1368 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1558-1571 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1741-1754 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/backend/model_manager/load/model_loaders/z_image.py:1555` calls `info` and `invokeai/backend/model_manager/load/model_loaders/z_image.py:389` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (16–18 lines × 2) · ×2
  • Duplicated block (16–18 lines × 2) invokeai/app/invocations/vae/qwen_image_2_1_image_to_latents.py:72 — invokeai/app/invocations/vae/qwen_image_2_1_image_to_latents.py:72-89 | invokeai/app/invocations/vae/qwen_image_2_1_latents_to_image.py:37-52 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (16–18 lines × 2) invokeai/backend/quantization/scripts/load_flux_model_bnb_llm_int8.py:61 — invokeai/backend/quantization/scripts/load_flux_model_bnb_llm_int8.py:61-76 | invokeai/backend/quantization/scripts/load_flux_model_bnb_nf4.py:76-93 — before extracting anything, compare `invokeai/backend/quantization/scripts/load_flux_model_bnb_llm_int8.py` and `invokeai/backend/quantization/scripts/load_flux_model_bnb_nf4.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/quantization/scripts/load_flux_model_bnb_nf4.py:76` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (13–18 lines × 2) · ×2
  • Duplicated block (13–18 lines × 2) invokeai/backend/model_manager/load/model_loaders/flux.py:1398 — invokeai/backend/model_manager/load/model_loaders/flux.py:1398-1415 | invokeai/backend/model_manager/load/model_loaders/flux.py:1742-1754 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/model_manager/load/model_loaders/flux.py:1398` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13–18 lines × 2) invokeai/backend/util/vae_working_memory.py:757 — invokeai/backend/util/vae_working_memory.py:757-774 | invokeai/backend/util/vae_working_memory.py:905-917 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (16 lines × 3) · ×2
  • Duplicated block (16 lines × 3) invokeai/app/invocations/anima/anima_lora_loader.py:134 — invokeai/app/invocations/anima/anima_lora_loader.py:134-149 | invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:165-180 | invokeai/app/invocations/z_image/z_image_lora_loader.py:137-152 — before extracting anything, compare `invokeai/app/invocations/anima/anima_lora_loader.py` and `invokeai/app/invocations/flux2/flux2_klein_lora_loader.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 3) invokeai/app/services/shared/sqlite_migrator/migrations/migration_11.py:61 — invokeai/app/services/shared/sqlite_migrator/migrations/migration_11.py:61-77 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_2.py:143-168 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_3.py:57-72 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (15–16 lines × 2) · ×2
  • Duplicated block (15–16 lines × 2) invokeai/app/services/external_generation/providers/openai.py:48 — invokeai/app/services/external_generation/providers/openai.py:48-63 | invokeai/app/services/external_generation/providers/openai.py:94-108 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `invokeai/app/services/external_generation/providers/openai.py:109` calls `get` and `invokeai/app/services/external_generation/providers/openai.py:64` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (15–16 lines × 2) invokeai/backend/model_manager/load/model_loaders/flux.py:2215 — invokeai/backend/model_manager/load/model_loaders/flux.py:2215-2229 | invokeai/backend/model_manager/load/model_loaders/flux.py:2281-2296 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/model_manager/load/model_loaders/flux.py:2215` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13–16 lines × 2) · ×2
  • Duplicated block (13–16 lines × 2) invokeai/backend/minimax_h3/transformer_minimax_h3.py:581 — invokeai/backend/minimax_h3/transformer_minimax_h3.py:581-596 | invokeai/backend/minimax_h3/transformer_minimax_h3_pruned.py:191-203 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (13–16 lines × 2) invokeai/backend/model_manager/load/model_loaders/z_image.py:1455 — invokeai/backend/model_manager/load/model_loaders/z_image.py:1455-1470 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1662-1674 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/model_manager/load/model_loaders/z_image.py:1455` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (15 lines × 3) · ×2
  • Duplicated block (15 lines × 3) invokeai/app/api/dependencies.py:276 — invokeai/app/api/dependencies.py:276-290 | invokeai/app/services/image_records/image_records_common.py:201-215 | invokeai/backend/pid/_src/networks/pid_net.py:114-128 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/api/dependencies.py:276` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 3) invokeai/app/invocations/pid/flux_pid_decode.py:149 — invokeai/app/invocations/pid/flux_pid_decode.py:149-163 | invokeai/app/invocations/pid/pid_upscale.py:188-202 | invokeai/app/invocations/pid/z_image_pid_decode.py:162-176 — before extracting anything, compare `invokeai/app/invocations/pid/flux_pid_decode.py` and `invokeai/app/invocations/pid/pid_upscale.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 70 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (13–14 lines × 3) · ×2
  • Duplicated block (13–14 lines × 3) invokeai/app/invocations/cogview4/cogview4_denoise.py:334 — invokeai/app/invocations/cogview4/cogview4_denoise.py:334-347 | invokeai/app/invocations/sd3/sd3_denoise.py:313-325 | invokeai/app/invocations/z_image/z_image_denoise.py:669-681 — `invokeai/app/invocations/cogview4/cogview4_denoise.py` and `invokeai/app/invocations/sd3/sd3_denoise.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 126 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/cogview4/cogview4_denoise.py:334` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13–14 lines × 3) invokeai/app/invocations/flux/flux_lora_loader.py:84 — invokeai/app/invocations/flux/flux_lora_loader.py:84-96 | invokeai/app/invocations/model.py:464-477 | invokeai/app/invocations/model.py:627-640 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/flux/flux_lora_loader.py:84` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12–14 lines × 2) · ×2
  • Duplicated block (12–14 lines × 2) invokeai/backend/patches/lora_conversions/flux_bfl_peft_lora_conversion_utils.py:166 — invokeai/backend/patches/lora_conversions/flux_bfl_peft_lora_conversion_utils.py:166-179 | invokeai/backend/patches/lora_conversions/flux_onetrainer_bfl_lora_conversion_utils.py:81-92 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12–14 lines × 2) invokeai/backend/quantization/gguf/ggml_tensor.py:42 — invokeai/backend/quantization/gguf/ggml_tensor.py:42-55 | invokeai/backend/quantization/sdnq/sdnq_tensor.py:59-70 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/backend/quantization/sdnq/sdnq_tensor.py:57` calls `isinstance`, `process_tensor` and `invokeai/backend/quantization/gguf/ggml_tensor.py:41` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (12–13 lines × 3) · ×2
  • Duplicated block (12–13 lines × 3) invokeai/app/invocations/composition-nodes.py:93 — invokeai/app/invocations/composition-nodes.py:93-105 | invokeai/app/invocations/composition-nodes.py:1429-1440 | invokeai/app/invocations/composition-nodes.py:1513-1524 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (12–13 lines × 3) invokeai/backend/model_manager/load/model_loaders/flux.py:999 — invokeai/backend/model_manager/load/model_loaders/flux.py:999-1010 | invokeai/backend/model_manager/load/model_loaders/flux.py:1535-1546 | invokeai/backend/model_manager/load/model_loaders/z_image.py:710-722 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/model_manager/load/model_loaders/z_image.py:710` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (11–13 lines × 2) · ×2
  • Duplicated block (11–13 lines × 2) invokeai/app/api/routers/image_map.py:498 — invokeai/app/api/routers/image_map.py:498-508 | invokeai/app/api/routers/image_map.py:1002-1014 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11–13 lines × 2) invokeai/backend/model_manager/load/model_loaders/krea2.py:223 — invokeai/backend/model_manager/load/model_loaders/krea2.py:223-235 | invokeai/backend/model_manager/load/model_loaders/krea2.py:236-246 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/model_manager/load/model_loaders/krea2.py:236` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/backend/model_manager/load/model_loaders/krea2.py:236` calls `startswith` and `invokeai/backend/model_manager/load/model_loaders/krea2.py:223` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (12 lines × 5) · ×2
  • Duplicated block (12 lines × 5) invokeai/backend/model_manager/configs/base.py:244 — invokeai/backend/model_manager/configs/base.py:244-255 | invokeai/backend/model_manager/configs/main.py:3987-3998 | invokeai/backend/model_manager/configs/main.py:4141-4152 | invokeai/backend/model_manager/configs/main.py:4306-4317 | invokeai/backend/model_manager/model_on_disk.py:169-180 — there are 5 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 5) invokeai/app/services/shared/sqlite_migrator/migrations/migration_22.py:78 — invokeai/app/services/shared/sqlite_migrator/migrations/migration_22.py:78-91 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_23.py:184-195 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_24.py:228-250 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_25.py:51-63 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_26.py:104-117 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (10–12 lines × 2) · ×2
  • Duplicated block (10–12 lines × 2) invokeai/backend/model_manager/configs/main.py:3916 — invokeai/backend/model_manager/configs/main.py:3916-3925 | invokeai/backend/model_manager/configs/main.py:4243-4254 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10–12 lines × 2) invokeai/backend/tiles/tiles.py:281 — invokeai/backend/tiles/tiles.py:281-290 | invokeai/backend/tiles/tiles.py:384-395 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (9–11 lines × 2) · ×2
  • Duplicated block (9–11 lines × 2) invokeai/app/api/routers/session_queue.py:647 — invokeai/app/api/routers/session_queue.py:647-657 | invokeai/app/api/routers/session_queue.py:906-914 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (9–11 lines × 2) invokeai/backend/flux/controlnet/instantx_controlnet_flux.py:48 — invokeai/backend/flux/controlnet/instantx_controlnet_flux.py:48-58 | invokeai/backend/flux/controlnet/xlabs_controlnet_flux.py:30-38 — before extracting anything, compare `invokeai/backend/flux/controlnet/instantx_controlnet_flux.py` and `invokeai/backend/flux/controlnet/xlabs_controlnet_flux.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (9–10 lines × 2) · ×2
  • Duplicated block (9–10 lines × 2) invokeai/app/invocations/mask.py:157 — invokeai/app/invocations/mask.py:157-166 | invokeai/app/invocations/mask.py:191-199 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (9–10 lines × 2) invokeai/app/invocations/vae/flux2_vae_encode.py:127 — invokeai/app/invocations/vae/flux2_vae_encode.py:127-136 | invokeai/app/invocations/vae/flux_vae_encode.py:110-118 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (7–9 lines × 2) · ×2
  • Duplicated block (7–9 lines × 2) invokeai/backend/anima/anima_transformer.py:248 — invokeai/backend/anima/anima_transformer.py:248-256 | invokeai/backend/anima/anima_transformer.py:856-862 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7–9 lines × 2) invokeai/backend/pid/_src/networks/pid_net.py:354 — invokeai/backend/pid/_src/networks/pid_net.py:354-362 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1450-1456 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/backend/pid/_src/networks/pid_net.py:353` calls `split_inputs_cp` and `invokeai/backend/pid/_src/networks/pixeldit_official.py:1449` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (6 lines × 4) · ×2
  • Duplicated block (6 lines × 4) invokeai/app/invocations/flux3/flux3_denoise.py:323 — invokeai/app/invocations/flux3/flux3_denoise.py:323-328 | invokeai/app/invocations/qwen_image/qwen_image_denoise.py:813-818 | invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_denoise.py:645-650 | invokeai/app/invocations/text_encoder/krea2_text_encoder.py:190-195 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times. Note first that the copies are not typed on the same thing: `Iterator` names `collections.abc` in one and `typing` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (6 lines × 4) invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_conv1d.py:38 — invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_conv1d.py:38-43 | invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_flux_rms_norm.py:31-36 | invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_invoke_linear_8_bit_lt.py:62-67 | invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules/custom_invoke_linear_nf4.py:89-94 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (5 lines × 3) · ×2
  • Duplicated block (5 lines × 3) invokeai/backend/flux/custom_block_processor.py:42 — invokeai/backend/flux/custom_block_processor.py:42-46 | invokeai/backend/flux/ip_adapter/ip_double_stream_block_processor.py:57-61 | invokeai/backend/flux/modules/layers.py:171-175 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/flux/ip_adapter/ip_double_stream_block_processor.py:57` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 3) invokeai/backend/minimax_h3/taehv_decoder.py:82 — invokeai/backend/minimax_h3/taehv_decoder.py:82-86 | invokeai/backend/minimax_h3/taehv_decoder.py:88-92 | invokeai/backend/minimax_h3/taehv_decoder.py:94-98 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
P8 · Schema migrations · Schema created by SQLAlchemy create_all() (no migration path) · ×2
  • Schema created by SQLAlchemy create_all() (no migration path) invokeai/app/services/shared/sqlite_migrator/sqlite_migrator_impl.py:565 — SQLAlchemy create_all() builds the schema from the model at startup and keeps no migration history, so there is no reviewed, repeatable upgrade path for an existing production database — a renamed column is dropped and re-added rather than migrated. Adopt Alembic (`alembic revision --autogenerate` + `alembic upgrade head`), so every schema change is a versioned file applied the same way in every environment.
  • Schema created by SQLAlchemy create_all() (no migration path) invokeai/app/services/shared/database/copy.py:213 — SQLAlchemy create_all() builds the schema from the model at startup and keeps no migration history, so there is no reviewed, repeatable upgrade path for an existing production database — a renamed column is dropped and re-added rather than migrated. Adopt Alembic (`alembic revision --autogenerate` + `alembic upgrade head`), so every schema change is a versioned file applied the same way in every environment.
R10 · Code Duplication · Duplication concentrated across 5 sibling directories (5 clone groups) · ×2
  • Duplication concentrated across 5 sibling directories (5 clone groups) invokeai/frontend/webv1/src/features/gallery/components/Boards/BoardsSettingsPopover.tsx:23 — 5 duplicated blocks under invokeai/frontend/webv1/src/features/gallery/components/ have copies in at least two of the sibling directories Boards, ContextMenu, GallerySettingsPopover, ImageGrid, ImageViewer — 4 of them are reported below, and 1 is counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 5 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 5 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 5 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
  • Duplication concentrated across 5 sibling directories (5 clone groups) invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/GraphPreviewOpenAsMenu.tsx:326 — 5 duplicated blocks under invokeai/frontend/webv2/src/features/workflow/ui/ have copies in at least two of the sibling directories editor, fields, graph-preview, library, linear — 4 of them are reported below, and 1 is counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 5 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 5 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 5 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication · Wholesale file copy (168 identical lines × 2 files) · ×2
  • Wholesale file copy (168 identical lines × 2 files) invokeai/frontend/webv1/src/features/ui/layouts/generate-tab-auto-layout.tsx:1 — invokeai/frontend/webv1/src/features/ui/layouts/generate-tab-auto-layout.tsx:1 · invokeai/frontend/webv1/src/features/ui/layouts/upscaling-tab-auto-layout.tsx:1 — these 2 files are line-for-line copies of one another — 168 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
  • Wholesale file copy (168 identical lines × 2 files) invokeai/frontend/webv1/src/features/ui/layouts/generate-tab-auto-layout.tsx:1 — invokeai/frontend/webv1/src/features/ui/layouts/generate-tab-auto-layout.tsx:1 · invokeai/frontend/webv1/src/features/ui/layouts/workflows-tab-auto-layout.tsx:1 — these 2 files are line-for-line copies of one another — 168 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication · Duplicated block with local edits (103 matched lines × 2 locations) · ×2
  • Duplicated block with local edits (103 matched lines × 2 locations) invokeai/frontend/webv1/src/features/auth/components/AdministratorSetup.tsx:26 — invokeai/frontend/webv1/src/features/auth/components/AdministratorSetup.tsx:26 · invokeai/frontend/webv1/src/features/auth/components/LoginPage.tsx:25 — the two spans are one implementation copied and then locally edited — 689 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
  • Duplicated block with local edits (103 matched lines × 2 locations) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasLassoToolModule.ts:339 — invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasLassoToolModule.ts:339 · invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasShapeToolModule.ts:640 — the two spans are one implementation copied and then locally edited — 669 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
X24 · Document value interpolated into markup unescaped · Untrusted text written into markup unescaped · ×2
  • Untrusted text written into markup unescaped invokeai/frontend/webv1/src/features/controlLayers/konva/util.ts:465 — `label` is text this program did not author, and it is written into the text of an element through `document.write` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
  • Untrusted text written into markup unescaped invokeai/frontend/webv1/src/features/controlLayers/konva/util.ts:468 — `url` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through `document.write` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path.
AC1 · Text alternatives · <video> without a captions track · ×1
  • <video> without a captions track invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.tsx:900 — Video with no captions <track> offers no captions. This player's source is set at runtime, so there is no caption file to author here: give the player a way to carry captions — accept a track/captions URL alongside the media and render a <track kind="captions"> when one is supplied — and capture that asset wherever the media enters the product (upload, import or generation).
AC2 · Forms & labels · <SearchInput> field component without a label · ×1
  • <SearchInput> field component without a label invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx:797 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
AC2 · Forms & labels · <FilterTypeSelect> field component without a label · ×1
  • <FilterTypeSelect> field component without a label invokeai/frontend/webv1/src/features/controlLayers/components/Filters/Filter.tsx:84 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
AC2 · Forms & labels · <BoardAutoAddSelect> field component without a label · ×1
  • <BoardAutoAddSelect> field component without a label invokeai/frontend/webv1/src/features/gallery/components/Boards/BoardsSettingsPopover.tsx:52 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
AC6 · Visual & motion safety · Focus outline removed inline · ×1
  • Focus outline removed inline invokeai/frontend/webv1/src/features/gallery/components/ImageViewer/CurrentVideoPreview.tsx:393 — <video> takes keyboard focus, and outline:none/0 in its inline style removes the focus ring with no chance of a :focus replacement (an inline style outranks every stylesheet rule). Keep a visible focus indicator.
D1 · Cyclomatic Complexity · mock-backend.startMockBackend.server (cyclomatic 638) · ×1
  • mock-backend.startMockBackend.server (cyclomatic 638) invokeai/frontend/webv2/scripts/mock-backend.mjs:1169 — mock-backend.startMockBackend.server has cyclomatic complexity 638 (threshold 15). Of this number, 605 points are the body's own statements and 33 belong to 17 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · workbenchState.reduceWorkbenchAction (cyclomatic 412) · ×1
  • workbenchState.reduceWorkbenchAction (cyclomatic 412) invokeai/frontend/webv2/src/workbench/workbenchState.ts:4424 — workbenchState.reduceWorkbenchAction has cyclomatic complexity 412 (threshold 15). Of this number, 228 points are the body's own statements and 184 belong to 72 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GalleryImageGrid.GalleryImageGrid (cyclomatic 318) · ×1
  • GalleryImageGrid.GalleryImageGrid (cyclomatic 318) invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx:409 — GalleryImageGrid.GalleryImageGrid has cyclomatic complexity 318 (threshold 15). Of this number, 86 points are the body's own statements and 232 belong to 47 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LayersTree.LayersTree (cyclomatic 229) · ×1
  • LayersTree.LayersTree (cyclomatic 229) invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx:169 — LayersTree.LayersTree has cyclomatic complexity 229 (threshold 15). Of this number, 29 points are the body's own statements and 200 belong to 50 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · modelSelected.addModelSelectedListener (cyclomatic 205) · ×1
  • modelSelected.addModelSelectedListener (cyclomatic 205) invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/modelSelected.ts:97 — modelSelected.addModelSelectedListener has cyclomatic complexity 205 (threshold 15). Most of this is not in the body itself: 1 of the 205 points is its own statement and the rest belongs to 9 function literals inside it that branch (lines 100, 739, 118, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · GraphExecutionState._validate_effects (cyclomatic 155) · ×1
  • GraphExecutionState._validate_effects (cyclomatic 155) invokeai/app/services/shared/graph.py:2565 — GraphExecutionState._validate_effects has cyclomatic complexity 155 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WorkflowEditorView.WorkflowFlow (cyclomatic 151) · ×1
  • WorkflowEditorView.WorkflowFlow (cyclomatic 151) invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowEditorView.tsx:320 — WorkflowEditorView.WorkflowFlow has cyclomatic complexity 151 (threshold 15). Of this number, 20 points are the body's own statements and 131 belong to 49 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · readiness.getReasonsWhyCannotEnqueueCanvasTab (cyclomatic 150) · ×1
  • readiness.getReasonsWhyCannotEnqueueCanvasTab (cyclomatic 150) invokeai/frontend/webv1/src/features/queue/store/readiness.ts:773 — readiness.getReasonsWhyCannotEnqueueCanvasTab has cyclomatic complexity 150 (threshold 15). Of this number, 145 points are the body's own statements and 5 belong to 5 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · useImageActions.useImageActions (cyclomatic 148) · ×1
  • useImageActions.useImageActions (cyclomatic 148) invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts:200 — useImageActions.useImageActions has cyclomatic complexity 148 (threshold 15). Most of this is not in the body itself: 1 of the 148 points is its own statement and the rest belongs to 50 function literals inside it that branch (lines 463, 355, 894, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · LayerContextMenu.LayerMenu (cyclomatic 138) · ×1
  • LayerContextMenu.LayerMenu (cyclomatic 138) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx:223 — LayerContextMenu.LayerMenu has cyclomatic complexity 138 (threshold 15). Most of this is not in the body itself: 8 of the 138 points are its own statements and the rest belongs to 40 function literals inside it that branch (lines 504, 702, 379, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · setEventListeners.setEventListeners (cyclomatic 112) · ×1
  • setEventListeners.setEventListeners (cyclomatic 112) invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:86 — setEventListeners.setEventListeners has cyclomatic complexity 112 (threshold 15). Most of this is not in the body itself: 1 of the 112 points is its own statement and the rest belongs to 39 function items inside it that branch (a function literal at line 594, a function literal at line 836, a function literal at line 719, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · recallParameters.buildRecallParametersSettings (cyclomatic 112) · ×1
  • recallParameters.buildRecallParametersSettings (cyclomatic 112) invokeai/frontend/webv2/src/workbench/image-actions/recallParameters.ts:186 — recallParameters.buildRecallParametersSettings has cyclomatic complexity 112 (threshold 15). Of this number, 93 points are the body's own statements and 19 belong to 13 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WorkflowLibraryDetailPanel.WorkflowLibraryDetailPanel (cyclomatic 108) · ×1
  • WorkflowLibraryDetailPanel.WorkflowLibraryDetailPanel (cyclomatic 108) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryDetailPanel.tsx:101 — WorkflowLibraryDetailPanel.WorkflowLibraryDetailPanel has cyclomatic complexity 108 (threshold 15). Of this number, 36 points are the body's own statements and 72 belong to 22 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ScrubberField.ScrubberField (cyclomatic 99) · ×1
  • ScrubberField.ScrubberField (cyclomatic 99) invokeai/frontend/webv2/src/platform/ui/ScrubberField.tsx:231 — ScrubberField.ScrubberField has cyclomatic complexity 99 (threshold 15). Of this number, 18 points are the body's own statements and 81 belong to 28 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · canvasProjectMutations.applyCanvasProjectMutation (cyclomatic 98) · ×1
  • canvasProjectMutations.applyCanvasProjectMutation (cyclomatic 98) invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts:769 — canvasProjectMutations.applyCanvasProjectMutation has cyclomatic complexity 98 (threshold 15). Of this number, 83 points are the body's own statements and 15 belong to 10 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · videoPolicies.getVideoValidationReasons (cyclomatic 96) · ×1
  • videoPolicies.getVideoValidationReasons (cyclomatic 96) invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:2293 — videoPolicies.getVideoValidationReasons has cyclomatic complexity 96 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · document.applyProjectGraphAction (cyclomatic 96) · ×1
  • document.applyProjectGraphAction (cyclomatic 96) invokeai/frontend/webv2/src/features/workflow/core/document.ts:910 — document.applyProjectGraphAction has cyclomatic complexity 96 (threshold 15). Of this number, 71 points are the body's own statements and 25 belong to 9 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · videoRecall.buildVideoRecallSettings (cyclomatic 96) · ×1
  • videoRecall.buildVideoRecallSettings (cyclomatic 96) invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts:546 — videoRecall.buildVideoRecallSettings has cyclomatic complexity 96 (threshold 15). Of this number, 93 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · VideoWidgetView.VideoWidgetView (cyclomatic 94) · ×1
  • VideoWidgetView.VideoWidgetView (cyclomatic 94) invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx:131 — VideoWidgetView.VideoWidgetView has cyclomatic complexity 94 (threshold 15). Of this number, 65 points are the body's own statements and 29 belong to 13 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GalleryPickerView.GalleryPickerView (cyclomatic 93) · ×1
  • GalleryPickerView.GalleryPickerView (cyclomatic 93) invokeai/frontend/webv2/src/features/gallery/ui/picker/GalleryPickerView.tsx:67 — GalleryPickerView.GalleryPickerView has cyclomatic complexity 93 (threshold 15). Of this number, 56 points are the body's own statements and 37 belong to 10 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · readiness.getReasonsWhyCannotEnqueueGenerateTab (cyclomatic 90) · ×1
  • readiness.getReasonsWhyCannotEnqueueGenerateTab (cyclomatic 90) invokeai/frontend/webv1/src/features/queue/store/readiness.ts:357 — readiness.getReasonsWhyCannotEnqueueGenerateTab has cyclomatic complexity 90 (threshold 15). Of this number, 89 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · queueRunRestoration.normalizeRestoredQueueItem (cyclomatic 90) · ×1
  • queueRunRestoration.normalizeRestoredQueueItem (cyclomatic 90) invokeai/frontend/webv2/src/workbench/queue-integration/queueRunRestoration.ts:17 — queueRunRestoration.normalizeRestoredQueueItem has cyclomatic complexity 90 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · video_smart_concat.try_build_smart_render_plan (cyclomatic 89) · ×1
  • video_smart_concat.try_build_smart_render_plan (cyclomatic 89) invokeai/app/util/video_smart_concat.py:60 — video_smart_concat.try_build_smart_render_plan has cyclomatic complexity 89 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · runtime.createFontRuntime (cyclomatic 89) · ×1
  • runtime.createFontRuntime (cyclomatic 89) invokeai/frontend/webv2/src/features/fonts/runtime.ts:263 — runtime.createFontRuntime has cyclomatic complexity 89 (threshold 15). Most of this is not in the body itself: 1 of the 89 points is its own statement and the rest belongs to 24 function items inside it that branch (a function literal at line 452, a function literal at line 575, removeState, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · ModelInstallQueueItem.ModelInstallQueueItem (cyclomatic 81) · ×1
  • ModelInstallQueueItem.ModelInstallQueueItem (cyclomatic 81) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/AddModelPanel/ModelInstallQueue/ModelInstallQueueItem.tsx:109 — ModelInstallQueueItem.ModelInstallQueueItem has cyclomatic complexity 81 (threshold 15). Of this number, 37 points are the body's own statements and 44 belong to 14 function literals inside it that branch. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · useGalleryData.useGalleryData (cyclomatic 81) · ×1
  • useGalleryData.useGalleryData (cyclomatic 81) invokeai/frontend/webv2/src/features/gallery/ui/useGalleryData.ts:280 — useGalleryData.useGalleryData has cyclomatic complexity 81 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · PreviewFrame.PreviewVideo (cyclomatic 79) · ×1
  • PreviewFrame.PreviewVideo (cyclomatic 79) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.tsx:387 — PreviewFrame.PreviewVideo has cyclomatic complexity 79 (threshold 15). Most of this is not in the body itself: 11 of the 79 points are its own statements and the rest belongs to 23 function literals inside it that branch (lines 473, 798, 607, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · WorkflowPublicationHost.WorkflowPublicationHost (cyclomatic 78) · ×1
  • WorkflowPublicationHost.WorkflowPublicationHost (cyclomatic 78) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowPublicationHost.tsx:91 — WorkflowPublicationHost.WorkflowPublicationHost has cyclomatic complexity 78 (threshold 15). Of this number, 33 points are the body's own statements and 45 belong to 20 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · canvasHotkeyCommands.executeCanvasHotkeyCommand (cyclomatic 74) · ×1
  • canvasHotkeyCommands.executeCanvasHotkeyCommand (cyclomatic 74) invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHotkeyCommands.ts:166 — canvasHotkeyCommands.executeCanvasHotkeyCommand has cyclomatic complexity 74 (threshold 15). Of this number, 69 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ImageMapPlot.ImageMapPlot (cyclomatic 74) · ×1
  • ImageMapPlot.ImageMapPlot (cyclomatic 74) invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapPlot.tsx:114 — ImageMapPlot.ImageMapPlot has cyclomatic complexity 74 (threshold 15). Most of this is not in the body itself: 5 of the 74 points are its own statements and the rest belongs to 25 function items inside it that branch (a function literal at line 447, a function literal at line 393, a function literal at line 198, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · videoPolicies.getVideoModelSelectionResult (cyclomatic 73) · ×1
  • videoPolicies.getVideoModelSelectionResult (cyclomatic 73) invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:1966 — videoPolicies.getVideoModelSelectionResult has cyclomatic complexity 73 (threshold 15). Of this number, 70 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FloatingWidgetWindow.FloatingWidgetWindow (cyclomatic 72) · ×1
  • FloatingWidgetWindow.FloatingWidgetWindow (cyclomatic 72) invokeai/frontend/webv2/src/workbench/widget-frame/FloatingWidgetWindow.tsx:357 — FloatingWidgetWindow.FloatingWidgetWindow has cyclomatic complexity 72 (threshold 15). Of this number, 25 points are the body's own statements and 47 belong to 16 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · validateWorkflow.validateWorkflow (cyclomatic 70) · ×1
  • validateWorkflow.validateWorkflow (cyclomatic 70) invokeai/frontend/webv1/src/features/nodes/util/workflow/validateWorkflow.ts:140 — validateWorkflow.validateWorkflow has cyclomatic complexity 70 (threshold 15). Of this number, 69 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LayerRow.LayerRowComponent (cyclomatic 70) · ×1
  • LayerRow.LayerRowComponent (cyclomatic 70) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerRow.tsx:80 — LayerRow.LayerRowComponent has cyclomatic complexity 70 (threshold 15). Of this number, 50 points are the body's own statements and 20 belong to 9 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CanvasTextOverlay.TextEditor (cyclomatic 69) · ×1
  • CanvasTextOverlay.TextEditor (cyclomatic 69) invokeai/frontend/webv1/src/features/controlLayers/components/Text/CanvasTextOverlay.tsx:95 — CanvasTextOverlay.TextEditor has cyclomatic complexity 69 (threshold 15). Most of this is not in the body itself: 12 of the 69 points are its own statements and the rest belongs to 24 function literals inside it that branch (lines 307, 571, 230, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · IntermediatesManager.IntermediatesManager (cyclomatic 69) · ×1
  • IntermediatesManager.IntermediatesManager (cyclomatic 69) invokeai/frontend/webv2/src/features/intermediates/ui/IntermediatesManager.tsx:63 — IntermediatesManager.IntermediatesManager has cyclomatic complexity 69 (threshold 15). Of this number, 56 points are the body's own statements and 13 belong to 8 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PreviewWidgetView.PreviewWidgetView (cyclomatic 69) · ×1
  • PreviewWidgetView.PreviewWidgetView (cyclomatic 69) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx:196 — PreviewWidgetView.PreviewWidgetView has cyclomatic complexity 69 (threshold 15). Of this number, 17 points are the body's own statements and 52 belong to 15 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · settings.isVideoSettings (cyclomatic 67) · ×1
  • settings.isVideoSettings (cyclomatic 67) invokeai/frontend/webv2/src/features/video/core/settings.ts:470 — settings.isVideoSettings has cyclomatic complexity 67 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AddNodeDialog.AddNodeDialogContent (cyclomatic 67) · ×1
  • AddNodeDialog.AddNodeDialogContent (cyclomatic 67) invokeai/frontend/webv2/src/features/workflow/ui/editor/AddNodeDialog.tsx:375 — AddNodeDialog.AddNodeDialogContent has cyclomatic complexity 67 (threshold 15). Of this number, 27 points are the body's own statements and 40 belong to 13 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · lora._is_flux2_lora_state_dict (cyclomatic 66) · ×1
  • lora._is_flux2_lora_state_dict (cyclomatic 66) invokeai/backend/model_manager/configs/lora.py:285 — lora._is_flux2_lora_state_dict has cyclomatic complexity 66 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CanvasWidgetView.CanvasWidgetView (cyclomatic 66) · ×1
  • CanvasWidgetView.CanvasWidgetView (cyclomatic 66) invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasWidgetView.tsx:109 — CanvasWidgetView.CanvasWidgetView has cyclomatic complexity 66 (threshold 15). Of this number, 21 points are the body's own statements and 45 belong to 20 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · utils.pred_squares (cyclomatic 65) · ×1
  • utils.pred_squares (cyclomatic 65) invokeai/backend/image_util/mlsd/utils.py:97 — utils.pred_squares has cyclomatic complexity 65 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · validateConnection.validateConnection (cyclomatic 65) · ×1
  • validateConnection.validateConnection (cyclomatic 65) invokeai/frontend/webv1/src/features/nodes/store/util/validateConnection.ts:202 — validateConnection.validateConnection has cyclomatic complexity 65 (threshold 15). Of this number, 59 points are the body's own statements and 6 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · useGalleryActions.useGalleryActions (cyclomatic 65) · ×1
  • useGalleryActions.useGalleryActions (cyclomatic 65) invokeai/frontend/webv2/src/features/gallery/ui/useGalleryActions.ts:38 — useGalleryActions.useGalleryActions has cyclomatic complexity 65 (threshold 15). Most of this is not in the body itself: 2 of the 65 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 119, 318, 232, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · InputFieldRenderer.InputFieldRenderer (cyclomatic 64) · ×1
  • InputFieldRenderer.InputFieldRenderer (cyclomatic 64) invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/InputFieldRenderer.tsx:93 — InputFieldRenderer.InputFieldRenderer has cyclomatic complexity 64 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · addRegions.addRegions (cyclomatic 64) · ×1
  • addRegions.addRegions (cyclomatic 64) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/addRegions.ts:84 — addRegions.addRegions has cyclomatic complexity 64 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · buildFLUXGraph.buildFLUXGraph (cyclomatic 64) · ×1
  • buildFLUXGraph.buildFLUXGraph (cyclomatic 64) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildFLUXGraph.ts:55 — buildFLUXGraph.buildFLUXGraph has cyclomatic complexity 64 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (buildFLUXGraph.buildFLUXGraph::addFlux2Features) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · GalleryMediaSlot.GalleryMediaSlot (cyclomatic 63) · ×1
  • GalleryMediaSlot.GalleryMediaSlot (cyclomatic 63) invokeai/frontend/webv2/src/features/gallery/ui/picker/GalleryMediaSlot.tsx:82 — GalleryMediaSlot.GalleryMediaSlot has cyclomatic complexity 63 (threshold 15). Of this number, 47 points are the body's own statements and 16 belong to 6 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AddModelsView.AddModelsView (cyclomatic 63) · ×1
  • AddModelsView.AddModelsView (cyclomatic 63) invokeai/frontend/webv2/src/features/models/ui/add-models/AddModelsView.tsx:72 — AddModelsView.AddModelsView has cyclomatic complexity 63 (threshold 15). Of this number, 25 points are the body's own statements and 38 belong to 14 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · InvokeButton.InvokeButton (cyclomatic 63) · ×1
  • InvokeButton.InvokeButton (cyclomatic 63) invokeai/frontend/webv2/src/workbench/shell/topbar/InvokeButton.tsx:72 — InvokeButton.InvokeButton has cyclomatic complexity 63 (threshold 15). Of this number, 31 points are the body's own statements and 32 belong to 17 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · UpscaleWidgetView.UpscaleWidgetView (cyclomatic 62) · ×1
  • UpscaleWidgetView.UpscaleWidgetView (cyclomatic 62) invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsx:424 — UpscaleWidgetView.UpscaleWidgetView has cyclomatic complexity 62 (threshold 15). Of this number, 36 points are the body's own statements and 26 belong to 13 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · baseGenerationPolicies.getSettingsWithCompatibleModelSelections (cyclomatic 61) · ×1
  • baseGenerationPolicies.getSettingsWithCompatibleModelSelections (cyclomatic 61) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:1879 — baseGenerationPolicies.getSettingsWithCompatibleModelSelections has cyclomatic complexity 61 (threshold 15). Of this number, 43 points are the body's own statements and 18 belong to 7 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WorkingMemorySection.WorkingMemoryBody (cyclomatic 61) · ×1
  • WorkingMemorySection.WorkingMemoryBody (cyclomatic 61) invokeai/frontend/webv2/src/features/models/ui/detail/WorkingMemorySection.tsx:211 — WorkingMemorySection.WorkingMemoryBody has cyclomatic complexity 61 (threshold 15). Of this number, 29 points are the body's own statements and 32 belong to 10 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · graph.buildLtx2VideoGraph (cyclomatic 61) · ×1
  • graph.buildLtx2VideoGraph (cyclomatic 61) invokeai/frontend/webv2/src/features/video/core/graph.ts:654 — graph.buildLtx2VideoGraph has cyclomatic complexity 61 (threshold 15). Of this number, 59 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · GenerationSettingsAccordion.GenerationSettingsAccordion (cyclomatic 60) · ×1
  • GenerationSettingsAccordion.GenerationSettingsAccordion (cyclomatic 60) invokeai/frontend/webv1/src/features/settingsAccordions/components/GenerationSettingsAccordion/GenerationSettingsAccordion.tsx:62 — GenerationSettingsAccordion.GenerationSettingsAccordion has cyclomatic complexity 60 (threshold 15). Of this number, 58 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · executeVideoRecall.applyVideoRecallMetadata (cyclomatic 60) · ×1
  • executeVideoRecall.applyVideoRecallMetadata (cyclomatic 60) invokeai/frontend/webv2/src/workbench/image-actions/executeVideoRecall.ts:247 — executeVideoRecall.applyVideoRecallMetadata has cyclomatic complexity 60 (threshold 15). Of this number, 58 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MergeLayerController.mergeDown (cyclomatic 59) · ×1
  • MergeLayerController.mergeDown (cyclomatic 59) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:186 — MergeLayerController.mergeDown has cyclomatic complexity 59 (threshold 15). Of this number, 46 points are the body's own statements and 13 belong to 6 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · imageRecall.buildImageRecallSettings (cyclomatic 59) · ×1
  • imageRecall.buildImageRecallSettings (cyclomatic 59) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:1231 — imageRecall.buildImageRecallSettings has cyclomatic complexity 59 (threshold 15). Of this number, 57 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · runtime.createQueueRuntime.reconcile (cyclomatic 58) · ×1
  • runtime.createQueueRuntime.reconcile (cyclomatic 58) invokeai/frontend/webv2/src/features/queue/runtime.ts:2140 — runtime.createQueueRuntime.reconcile has cyclomatic complexity 58 (threshold 15). Most of this is not in the body itself: 8 of the 58 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 2232, 2185, 2156, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · workbenchState.enqueueCompiledSnapshot (cyclomatic 58) · ×1
  • workbenchState.enqueueCompiledSnapshot (cyclomatic 58) invokeai/frontend/webv2/src/workbench/workbenchState.ts:3948 — workbenchState.enqueueCompiledSnapshot has cyclomatic complexity 58 (threshold 15). Of this number, 54 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GenerateAdvancedFields.GenerateAdvancedFields (cyclomatic 57) · ×1
  • GenerateAdvancedFields.GenerateAdvancedFields (cyclomatic 57) invokeai/frontend/webv2/src/features/generation/ui/GenerateAdvancedFields.tsx:85 — GenerateAdvancedFields.GenerateAdvancedFields has cyclomatic complexity 57 (threshold 15). Of this number, 51 points are the body's own statements and 6 belong to 5 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · utilityGraph.runUtilityGraph (cyclomatic 57) · ×1
  • utilityGraph.runUtilityGraph (cyclomatic 57) invokeai/frontend/webv2/src/features/queue/runtime/utilityGraph.ts:541 — utilityGraph.runUtilityGraph has cyclomatic complexity 57 (threshold 15). Most of this is not in the body itself: 5 of the 57 points are its own statements and the rest belongs to 14 function literals inside it that branch (lines 706, 605, 566, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · graph_loop_topology._recognize_nested_for_body (cyclomatic 56) · ×1
  • graph_loop_topology._recognize_nested_for_body (cyclomatic 56) invokeai/app/services/shared/graph_loop_topology.py:465 — graph_loop_topology._recognize_nested_for_body has cyclomatic complexity 56 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GalleryItemSearch.GalleryItemSearch (cyclomatic 56) · ×1
  • GalleryItemSearch.GalleryItemSearch (cyclomatic 56) invokeai/frontend/webv2/src/features/gallery/ui/GalleryItemSearch.tsx:66 — GalleryItemSearch.GalleryItemSearch has cyclomatic complexity 56 (threshold 15). Of this number, 24 points are the body's own statements and 32 belong to 13 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · hidiffusion.apply_hidiffusion (cyclomatic 55) · ×1
  • hidiffusion.apply_hidiffusion (cyclomatic 55) invokeai/backend/hidiffusion/hidiffusion.py:2040 — hidiffusion.apply_hidiffusion has cyclomatic complexity 55 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WorkflowFieldRenderer.WorkflowFieldRenderer (cyclomatic 55) · ×1
  • WorkflowFieldRenderer.WorkflowFieldRenderer (cyclomatic 55) invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:50 — WorkflowFieldRenderer.WorkflowFieldRenderer has cyclomatic complexity 55 (threshold 15). Of this number, 18 points are the body's own statements and 37 belong to 10 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ReferenceImageCropDialog.ReferenceImageCropDialog (cyclomatic 55) · ×1
  • ReferenceImageCropDialog.ReferenceImageCropDialog (cyclomatic 55) invokeai/frontend/webv2/src/features/generation/ui/reference-images/ReferenceImageCropDialog.tsx:212 — ReferenceImageCropDialog.ReferenceImageCropDialog has cyclomatic complexity 55 (threshold 15). Most of this is not in the body itself: 7 of the 55 points are its own statements and the rest belongs to 19 function literals inside it that branch (lines 459, 389, 403, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · ExtractMaskedAreaController.extract (cyclomatic 55) · ×1
  • ExtractMaskedAreaController.extract (cyclomatic 55) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/extractMaskedAreaController.ts:122 — ExtractMaskedAreaController.extract has cyclomatic complexity 55 (threshold 15). Of this number, 52 points are the body's own statements and 3 belong to 3 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · forLoops.validateForLoopGraph (cyclomatic 54) · ×1
  • forLoops.validateForLoopGraph (cyclomatic 54) invokeai/frontend/webv2/src/features/workflow/core/forLoops.ts:268 — forLoops.validateForLoopGraph has cyclomatic complexity 54 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions. This shape REPEATS in the file: 2 other methods here (forLoops.validateForLoopGraph::supportsNestedIterateBody, forLoops.validateForLoopGraph::getSupportedNestedForBody) have the same decision points, in the same order, at the same nesting depths — 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.
D1 · Cyclomatic Complexity · WorkflowLibraryDialog.WorkflowLibraryDialog (cyclomatic 54) · ×1
  • WorkflowLibraryDialog.WorkflowLibraryDialog (cyclomatic 54) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryDialog.tsx:153 — WorkflowLibraryDialog.WorkflowLibraryDialog has cyclomatic complexity 54 (threshold 15). Of this number, 28 points are the body's own statements and 26 belong to 13 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · List.List (cyclomatic 54) · ×1
  • List.List (cyclomatic 54) invokeai/frontend/webv2/src/platform/ui/list/List.tsx:145 — List.List has cyclomatic complexity 54 (threshold 15). Of this number, 19 points are the body's own statements and 35 belong to 13 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · widgetValues.syncVideoWidgetValuesWithModels (cyclomatic 53) · ×1
  • widgetValues.syncVideoWidgetValuesWithModels (cyclomatic 53) invokeai/frontend/webv2/src/features/video/core/widgetValues.ts:39 — widgetValues.syncVideoWidgetValuesWithModels has cyclomatic complexity 53 (threshold 15). Of this number, 44 points are the body's own statements and 9 belong to 2 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AdvancedSettingsAccordion.AdvancedSettingsAccordion (cyclomatic 52) · ×1
  • AdvancedSettingsAccordion.AdvancedSettingsAccordion (cyclomatic 52) invokeai/frontend/webv1/src/features/settingsAccordions/components/AdvancedSettingsAccordion/AdvancedSettingsAccordion.tsx:69 — AdvancedSettingsAccordion.AdvancedSettingsAccordion has cyclomatic complexity 52 (threshold 15). Of this number, 37 points are the body's own statements and 15 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · settings.getUpscaleValidationReasons (cyclomatic 52) · ×1
  • settings.getUpscaleValidationReasons (cyclomatic 52) invokeai/frontend/webv2/src/features/upscale/core/settings.ts:977 — settings.getUpscaleValidationReasons has cyclomatic complexity 52 (threshold 15). Of this number, 51 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · batch.planWorkflowBatch (cyclomatic 52) · ×1
  • batch.planWorkflowBatch (cyclomatic 52) invokeai/frontend/webv2/src/features/workflow/core/batch.ts:682 — batch.planWorkflowBatch has cyclomatic complexity 52 (threshold 15). Of this number, 49 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DownloadQueueService._do_download (cyclomatic 51) · ×1
  • DownloadQueueService._do_download (cyclomatic 51) invokeai/app/services/download/download_default.py:425 — DownloadQueueService._do_download 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.
D1 · Cyclomatic Complexity · settings.normalizeGenerateSettings (cyclomatic 51) · ×1
  • settings.normalizeGenerateSettings (cyclomatic 51) invokeai/frontend/webv2/src/features/generation/core/settings.ts:874 — settings.normalizeGenerateSettings has cyclomatic complexity 51 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PreviewFrame.PreviewImageFrame (cyclomatic 51) · ×1
  • PreviewFrame.PreviewImageFrame (cyclomatic 51) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.tsx:100 — PreviewFrame.PreviewImageFrame has cyclomatic complexity 51 (threshold 15). Of this number, 36 points are the body's own statements and 15 belong to 6 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · RegionalGuidanceSettings.RegionalGuidanceSettings (cyclomatic 51) · ×1
  • RegionalGuidanceSettings.RegionalGuidanceSettings (cyclomatic 51) invokeai/frontend/webv2/src/workbench/widgets/layers/RegionalGuidanceSettings.tsx:84 — RegionalGuidanceSettings.RegionalGuidanceSettings has cyclomatic complexity 51 (threshold 15). Of this number, 24 points are the body's own statements and 27 belong to 6 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _ExecutionNodeBuilder.prepare (cyclomatic 50) · ×1
  • _ExecutionNodeBuilder.prepare (cyclomatic 50) invokeai/app/services/shared/graph_materializer.py:2385 — _ExecutionNodeBuilder.prepare has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FontsPage.FontLibrary (cyclomatic 50) · ×1
  • FontsPage.FontLibrary (cyclomatic 50) invokeai/frontend/webv2/src/features/fonts/ui/FontsPage.tsx:291 — FontsPage.FontLibrary has cyclomatic complexity 50 (threshold 15). Of this number, 26 points are the body's own statements and 24 belong to 14 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · VideoReferenceListField.VideoReferenceListField (cyclomatic 50) · ×1
  • VideoReferenceListField.VideoReferenceListField (cyclomatic 50) invokeai/frontend/webv2/src/features/video/ui/VideoReferenceListField.tsx:363 — VideoReferenceListField.VideoReferenceListField has cyclomatic complexity 50 (threshold 15). Most of this is not in the body itself: 14 of the 50 points are its own statements and the rest belongs to 17 function literals inside it that branch (lines 539, 557, 469, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · layerChildRows.layerChildRowCommand (cyclomatic 50) · ×1
  • layerChildRows.layerChildRowCommand (cyclomatic 50) invokeai/frontend/webv2/src/workbench/widgets/layers/layerChildRows.ts:540 — layerChildRows.layerChildRowCommand has cyclomatic complexity 50 (threshold 15). Of this number, 46 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GraphExecutionState._can_use_generic_two_sibling_nested_for_scheduler (cyclomatic 49) · ×1
  • GraphExecutionState._can_use_generic_two_sibling_nested_for_scheduler (cyclomatic 49) invokeai/app/services/shared/graph.py:1050 — GraphExecutionState._can_use_generic_two_sibling_nested_for_scheduler has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · compositor.compositeDocument (cyclomatic 49) · ×1
  • compositor.compositeDocument (cyclomatic 49) invokeai/frontend/webv2/src/workbench/canvas-engine/render/compositor.ts:560 — compositor.compositeDocument has cyclomatic complexity 49 (threshold 15). Of this number, 32 points are the body's own statements and 17 belong to 5 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ControlLayerSettings.ControlLayerSettings (cyclomatic 49) · ×1
  • ControlLayerSettings.ControlLayerSettings (cyclomatic 49) invokeai/frontend/webv2/src/workbench/widgets/layers/ControlLayerSettings.tsx:85 — ControlLayerSettings.ControlLayerSettings has cyclomatic complexity 49 (threshold 15). Of this number, 20 points are the body's own statements and 29 belong to 16 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · GraphExecutionState._can_use_generic_for_scheduler (cyclomatic 48) · ×1
  • GraphExecutionState._can_use_generic_for_scheduler (cyclomatic 48) invokeai/app/services/shared/graph.py:1251 — GraphExecutionState._can_use_generic_for_scheduler has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · useGalleryUploadAction.useGalleryUploadAction (cyclomatic 48) · ×1
  • useGalleryUploadAction.useGalleryUploadAction (cyclomatic 48) invokeai/frontend/webv2/src/features/gallery/ui/useGalleryUploadAction.ts:47 — useGalleryUploadAction.useGalleryUploadAction has cyclomatic complexity 48 (threshold 15). Most of this is not in the body itself: 1 of the 48 points is its own statement and the rest belongs to 7 function literals inside it that branch (lines 77, 167, 257, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · draftStore.isProjectDraftCandidate (cyclomatic 48) · ×1
  • draftStore.isProjectDraftCandidate (cyclomatic 48) invokeai/frontend/webv2/src/workbench/projects/draftStore.ts:452 — draftStore.isProjectDraftCandidate has cyclomatic complexity 48 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · GalleryMaintenance.GalleryMaintenance (cyclomatic 48) · ×1
  • GalleryMaintenance.GalleryMaintenance (cyclomatic 48) invokeai/frontend/webv2/src/workbench/settings/GalleryMaintenance.tsx:79 — GalleryMaintenance.GalleryMaintenance has cyclomatic complexity 48 (threshold 15). Most of this is not in the body itself: 13 of the 48 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 159, 237, 110, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · ProjectConflictBanner.ProjectConflictBanner (cyclomatic 48) · ×1
  • ProjectConflictBanner.ProjectConflictBanner (cyclomatic 48) invokeai/frontend/webv2/src/workbench/shell/ProjectConflictBanner.tsx:28 — ProjectConflictBanner.ProjectConflictBanner has cyclomatic complexity 48 (threshold 15). Of this number, 33 points are the body's own statements and 15 belong to 7 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ModelSelect.ModelSelect (cyclomatic 47) · ×1
  • ModelSelect.ModelSelect (cyclomatic 47) invokeai/frontend/webv2/src/features/models/ui/components/ModelSelect.tsx:98 — ModelSelect.ModelSelect has cyclomatic complexity 47 (threshold 15). Of this number, 39 points are the body's own statements and 8 belong to 7 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · settings.normalizeVideoSettings (cyclomatic 47) · ×1
  • settings.normalizeVideoSettings (cyclomatic 47) invokeai/frontend/webv2/src/features/video/core/settings.ts:347 — settings.normalizeVideoSettings has cyclomatic complexity 47 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ListItem.ListItem (cyclomatic 47) · ×1
  • ListItem.ListItem (cyclomatic 47) invokeai/frontend/webv2/src/platform/ui/list/ListItem.tsx:85 — ListItem.ListItem has cyclomatic complexity 47 (threshold 15). Of this number, 32 points are the body's own statements and 15 belong to 6 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · WanDenoiseInvocation._run_diffusion (cyclomatic 46) · ×1
  • WanDenoiseInvocation._run_diffusion (cyclomatic 46) invokeai/app/invocations/wan/wan_denoise.py:424 — WanDenoiseInvocation._run_diffusion has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · workflow_graph_builder.build_graph_from_workflow (cyclomatic 46) · ×1
  • workflow_graph_builder.build_graph_from_workflow (cyclomatic 46) invokeai/app/services/shared/workflow_graph_builder.py:367 — workflow_graph_builder.build_graph_from_workflow has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · useCanvasWorkflowIntegrationExecute.useCanvasWorkflowIntegrationExecute.execute (cyclomatic 46) · ×1
  • useCanvasWorkflowIntegrationExecute.useCanvasWorkflowIntegrationExecute.execute (cyclomatic 46) invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/useCanvasWorkflowIntegrationExecute.tsx:40 — useCanvasWorkflowIntegrationExecute.useCanvasWorkflowIntegrationExecute.execute has cyclomatic complexity 46 (threshold 15). Of this number, 35 points are the body's own statements and 11 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Editor.getNextCropBoxByHandleWithAspectRatio (cyclomatic 46) · ×1
  • Editor.getNextCropBoxByHandleWithAspectRatio (cyclomatic 46) invokeai/frontend/webv1/src/features/cropper/lib/editor.ts:746 — Editor.getNextCropBoxByHandleWithAspectRatio has cyclomatic complexity 46 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CurrentVideoPreview.CurrentVideoPreview (cyclomatic 46) · ×1
  • CurrentVideoPreview.CurrentVideoPreview (cyclomatic 46) invokeai/frontend/webv1/src/features/gallery/components/ImageViewer/CurrentVideoPreview.tsx:66 — CurrentVideoPreview.CurrentVideoPreview has cyclomatic complexity 46 (threshold 15). Of this number, 17 points are the body's own statements and 29 belong to 12 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · GalleryBoardsPanel.GalleryBoardsPanel (cyclomatic 46) · ×1
  • GalleryBoardsPanel.GalleryBoardsPanel (cyclomatic 46) invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardsPanel.tsx:47 — GalleryBoardsPanel.GalleryBoardsPanel has cyclomatic complexity 46 (threshold 15). Of this number, 25 points are the body's own statements and 21 belong to 12 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · templates.parseInvocationSchema (cyclomatic 46) · ×1
  • templates.parseInvocationSchema (cyclomatic 46) invokeai/frontend/webv2/src/features/workflow/data/templates.ts:331 — templates.parseInvocationSchema has cyclomatic complexity 46 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · usePreviewNavigation.usePreviewNavigation.navigate (cyclomatic 46) · ×1
  • usePreviewNavigation.usePreviewNavigation.navigate (cyclomatic 46) invokeai/frontend/webv2/src/workbench/widgets/preview/usePreviewNavigation.ts:705 — usePreviewNavigation.usePreviewNavigation.navigate has cyclomatic complexity 46 (threshold 15). Most of this is not in the body itself: 12 of the 46 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 774, stepTo, isCurrentNavigation, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · layerRasterizer.createLayerRasterizer.getOrStartLayerRasterization (cyclomatic 46) · ×1
  • layerRasterizer.createLayerRasterizer.getOrStartLayerRasterization (cyclomatic 46) invokeai/frontend/webv2/src/workbench/canvas-engine/layerRasterizer.ts:138 — layerRasterizer.createLayerRasterizer.getOrStartLayerRasterization has cyclomatic complexity 46 (threshold 15). Most of this is not in the body itself: 13 of the 46 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 216, 185). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · graph_if_dependencies._can_use_fresh_flat_if_activation (cyclomatic 45) · ×1
  • graph_if_dependencies._can_use_fresh_flat_if_activation (cyclomatic 45) invokeai/app/services/shared/graph_if_dependencies.py:195 — graph_if_dependencies._can_use_fresh_flat_if_activation has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · video_smart_concat.encode_rgb_frames (cyclomatic 45) · ×1
  • video_smart_concat.encode_rgb_frames (cyclomatic 45) invokeai/app/util/video_smart_concat.py:340 — video_smart_concat.encode_rgb_frames has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GraphExecutionState._can_use_generic_nested_iterate_scheduler (cyclomatic 44) · ×1
  • GraphExecutionState._can_use_generic_nested_iterate_scheduler (cyclomatic 44) invokeai/app/services/shared/graph.py:1404 — GraphExecutionState._can_use_generic_nested_iterate_scheduler has cyclomatic complexity 44 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · index.dynamicBaseQuery (cyclomatic 44) · ×1
  • index.dynamicBaseQuery (cyclomatic 44) invokeai/frontend/webv1/src/services/api/index.ts:99 — index.dynamicBaseQuery has cyclomatic complexity 44 (threshold 15). Of this number, 42 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · InvocationFlowNode.ExpandedInvocationNode (cyclomatic 44) · ×1
  • InvocationFlowNode.ExpandedInvocationNode (cyclomatic 44) invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx:1001 — InvocationFlowNode.ExpandedInvocationNode has cyclomatic complexity 44 (threshold 15). Of this number, 43 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MergeLayerController.mergeVisible (cyclomatic 44) · ×1
  • MergeLayerController.mergeVisible (cyclomatic 44) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:394 — MergeLayerController.mergeVisible has cyclomatic complexity 44 (threshold 15). Of this number, 33 points are the body's own statements and 11 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · strokeSession.createStrokeSession.paint (cyclomatic 44) · ×1
  • strokeSession.createStrokeSession.paint (cyclomatic 44) invokeai/frontend/webv2/src/workbench/canvas-engine/tools/strokeSession.ts:323 — strokeSession.createStrokeSession.paint has cyclomatic complexity 44 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AnimaDenoiseInvocation._run_diffusion (cyclomatic 43) · ×1
  • AnimaDenoiseInvocation._run_diffusion (cyclomatic 43) invokeai/app/invocations/anima/anima_denoise.py:639 — AnimaDenoiseInvocation._run_diffusion has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · lora._get_flux2_lora_variant (cyclomatic 43) · ×1
  • lora._get_flux2_lora_variant (cyclomatic 43) invokeai/backend/model_manager/configs/lora.py:455 — lora._get_flux2_lora_variant has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PidNet.forward (cyclomatic 43) · ×1
  • PidNet.forward (cyclomatic 43) invokeai/backend/pid/_src/networks/pid_net.py:274 — PidNet.forward has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CanvasEntityObjectRenderer.renderObject (cyclomatic 43) · ×1
  • CanvasEntityObjectRenderer.renderObject (cyclomatic 43) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityObjectRenderer.ts:348 — CanvasEntityObjectRenderer.renderObject has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ModelView.ModelView (cyclomatic 43) · ×1
  • ModelView.ModelView (cyclomatic 43) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/ModelView.tsx:64 — ModelView.ModelView has cyclomatic complexity 43 (threshold 15). Of this number, 34 points are the body's own statements and 9 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · WildcardsPanel.WildcardsPanel (cyclomatic 43) · ×1
  • WildcardsPanel.WildcardsPanel (cyclomatic 43) invokeai/frontend/webv2/src/features/generation/ui/promptFields/WildcardsPanel.tsx:71 — WildcardsPanel.WildcardsPanel has cyclomatic complexity 43 (threshold 15). Of this number, 29 points are the body's own statements and 14 belong to 8 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BooleanMergeController.merge (cyclomatic 43) · ×1
  • BooleanMergeController.merge (cyclomatic 43) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/booleanMergeController.ts:75 — BooleanMergeController.merge has cyclomatic complexity 43 (threshold 15). Of this number, 42 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ZImageDenoiseInvocation._run_diffusion (cyclomatic 42) · ×1
  • ZImageDenoiseInvocation._run_diffusion (cyclomatic 42) invokeai/app/invocations/z_image/z_image_denoise.py:259 — ZImageDenoiseInvocation._run_diffusion has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GeminiProvider.generate (cyclomatic 42) · ×1
  • GeminiProvider.generate (cyclomatic 42) invokeai/app/services/external_generation/providers/gemini.py:29 — GeminiProvider.generate has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · groupSurfaceCache.createGroupSurfaceCache.resolve (cyclomatic 42) · ×1
  • groupSurfaceCache.createGroupSurfaceCache.resolve (cyclomatic 42) invokeai/frontend/webv2/src/workbench/canvas-engine/render/groupSurfaceCache.ts:706 — groupSurfaceCache.createGroupSurfaceCache.resolve has cyclomatic complexity 42 (threshold 15). Of this number, 39 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · QueueRecoveryNotice.QueueRecoveryNotice (cyclomatic 42) · ×1
  • QueueRecoveryNotice.QueueRecoveryNotice (cyclomatic 42) invokeai/frontend/webv2/src/workbench/queue-integration/QueueRecoveryNotice.tsx:34 — QueueRecoveryNotice.QueueRecoveryNotice has cyclomatic complexity 42 (threshold 15). Most of this is not in the body itself: 14 of the 42 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 71, 97, 118, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · working_memory_calibration_fits.model_lines (cyclomatic 41) · ×1
  • working_memory_calibration_fits.model_lines (cyclomatic 41) invokeai/app/services/working_memory_calibration/working_memory_calibration_fits.py:223 — working_memory_calibration_fits.model_lines has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · parseFieldType.parseFieldType (cyclomatic 41) · ×1
  • parseFieldType.parseFieldType (cyclomatic 41) invokeai/frontend/webv1/src/features/nodes/util/schema/parseFieldType.ts:45 — parseFieldType.parseFieldType has cyclomatic complexity 41 (threshold 15). Of this number, 39 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · useCompareLoupe.useCompareLoupe (cyclomatic 41) · ×1
  • useCompareLoupe.useCompareLoupe (cyclomatic 41) invokeai/frontend/webv2/src/workbench/widgets/preview/useCompareLoupe.ts:57 — useCompareLoupe.useCompareLoupe has cyclomatic complexity 41 (threshold 15). Most of this is not in the body itself: 2 of the 41 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 399, 323, 210, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · imageRecall.getMetadataExternalProvider (cyclomatic 41) · ×1
  • imageRecall.getMetadataExternalProvider (cyclomatic 41) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:625 — imageRecall.getMetadataExternalProvider has cyclomatic complexity 41 (threshold 15). Of this number, 28 points are the body's own statements and 13 belong to 5 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · InvokeImageBlendInvocation.apply_blend (cyclomatic 40) · ×1
  • InvokeImageBlendInvocation.apply_blend (cyclomatic 40) invokeai/app/invocations/composition-nodes.py:679 — InvokeImageBlendInvocation.apply_blend has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GraphExecutionState._can_use_generic_serial_nested_for_scheduler (cyclomatic 40) · ×1
  • GraphExecutionState._can_use_generic_serial_nested_for_scheduler (cyclomatic 40) invokeai/app/services/shared/graph.py:1158 — GraphExecutionState._can_use_generic_serial_nested_for_scheduler has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · denoise.denoise (cyclomatic 40) · ×1
  • denoise.denoise (cyclomatic 40) invokeai/backend/flux2/denoise.py:25 — denoise.denoise has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · UserProfile.UserProfile (cyclomatic 40) · ×1
  • UserProfile.UserProfile (cyclomatic 40) invokeai/frontend/webv1/src/features/auth/components/UserProfile.tsx:38 — UserProfile.UserProfile has cyclomatic complexity 40 (threshold 15). Of this number, 31 points are the body's own statements and 9 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · GalleryThumbnail.GalleryThumbnail (cyclomatic 40) · ×1
  • GalleryThumbnail.GalleryThumbnail (cyclomatic 40) invokeai/frontend/webv2/src/features/gallery/ui/GalleryThumbnail.tsx:76 — GalleryThumbnail.GalleryThumbnail has cyclomatic complexity 40 (threshold 15). Of this number, 20 points are the body's own statements and 20 belong to 14 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ExternalModelSection.ExternalModelSection (cyclomatic 40) · ×1
  • ExternalModelSection.ExternalModelSection (cyclomatic 40) invokeai/frontend/webv2/src/features/models/ui/detail/ExternalModelSection.tsx:160 — ExternalModelSection.ExternalModelSection has cyclomatic complexity 40 (threshold 15). Of this number, 26 points are the body's own statements and 14 belong to 11 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · fields.isWorkflowFieldValueValid (cyclomatic 40) · ×1
  • fields.isWorkflowFieldValueValid (cyclomatic 40) invokeai/frontend/webv2/src/features/workflow/core/fields.ts:384 — fields.isWorkflowFieldValueValid has cyclomatic complexity 40 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · LayerMutationController.commitDuplicate (cyclomatic 40) · ×1
  • LayerMutationController.commitDuplicate (cyclomatic 40) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/layerMutationController.ts:206 — LayerMutationController.commitDuplicate has cyclomatic complexity 40 (threshold 15). Of this number, 17 points are the body's own statements and 23 belong to 11 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · bitmapStore.createBitmapStore.flushLayer (cyclomatic 40) · ×1
  • bitmapStore.createBitmapStore.flushLayer (cyclomatic 40) invokeai/frontend/webv2/src/workbench/canvas-engine/document/bitmapStore.ts:397 — bitmapStore.createBitmapStore.flushLayer has cyclomatic complexity 40 (threshold 15). Of this number, 38 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Flux2DenoiseInvocation._run_diffusion (cyclomatic 39) · ×1
  • Flux2DenoiseInvocation._run_diffusion (cyclomatic 39) invokeai/app/invocations/flux2/flux2_denoise.py:229 — Flux2DenoiseInvocation._run_diffusion has cyclomatic complexity 39 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · select_hf_files._filter_by_variant (cyclomatic 39) · ×1
  • select_hf_files._filter_by_variant (cyclomatic 39) invokeai/backend/model_manager/util/select_hf_files.py:114 — select_hf_files._filter_by_variant has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · UserManagement.UserFormModal (cyclomatic 39) · ×1
  • UserManagement.UserFormModal (cyclomatic 39) invokeai/frontend/webv1/src/features/auth/components/UserManagement.tsx:77 — UserManagement.UserFormModal has cyclomatic complexity 39 (threshold 15). Of this number, 22 points are the body's own statements and 17 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · runtime.createQueueRuntime.submitQueueItem (cyclomatic 39) · ×1
  • runtime.createQueueRuntime.submitQueueItem (cyclomatic 39) invokeai/frontend/webv2/src/features/queue/runtime.ts:1806 — runtime.createQueueRuntime.submitQueueItem has cyclomatic complexity 39 (threshold 15). Of this number, 18 points are the body's own statements and 21 belong to 4 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · usePreviewNavigation.usePreviewNavigation (cyclomatic 39) · ×1
  • usePreviewNavigation.usePreviewNavigation (cyclomatic 39) invokeai/frontend/webv2/src/workbench/widgets/preview/usePreviewNavigation.ts:205 — usePreviewNavigation.usePreviewNavigation has cyclomatic complexity 39 (threshold 15). Of this number, 35 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · Krea2DenoiseInvocation._run_diffusion (cyclomatic 38) · ×1
  • Krea2DenoiseInvocation._run_diffusion (cyclomatic 38) invokeai/app/invocations/krea2/krea2_denoise.py:488 — Krea2DenoiseInvocation._run_diffusion has cyclomatic complexity 38 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · QwenImageDenoiseInvocation._run_diffusion (cyclomatic 38) · ×1
  • QwenImageDenoiseInvocation._run_diffusion (cyclomatic 38) invokeai/app/invocations/qwen_image/qwen_image_denoise.py:311 — QwenImageDenoiseInvocation._run_diffusion has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GalleryMaintenanceService._remove_missing_page (cyclomatic 38) · ×1
  • GalleryMaintenanceService._remove_missing_page (cyclomatic 38) invokeai/app/services/gallery_maintenance/gallery_maintenance_default.py:595 — GalleryMaintenanceService._remove_missing_page has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · graph_iterate_planner._get_direct_iterate_collect_nodes (cyclomatic 38) · ×1
  • graph_iterate_planner._get_direct_iterate_collect_nodes (cyclomatic 38) invokeai/app/services/shared/graph_iterate_planner.py:164 — graph_iterate_planner._get_direct_iterate_collect_nodes has cyclomatic complexity 38 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ResizeHandle.ResizeHandle (cyclomatic 38) · ×1
  • ResizeHandle.ResizeHandle (cyclomatic 38) invokeai/frontend/webv2/src/platform/ui/ResizeHandle.tsx:197 — ResizeHandle.ResizeHandle has cyclomatic complexity 38 (threshold 15). Most of this is not in the body itself: 4 of the 38 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 299, 224, 277, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · store.normalizeWorkbenchPreferences (cyclomatic 38) · ×1
  • store.normalizeWorkbenchPreferences (cyclomatic 38) invokeai/frontend/webv2/src/workbench/settings/store.ts:372 — store.normalizeWorkbenchPreferences has cyclomatic complexity 38 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MergeLayerController.mergeSelectedInto (cyclomatic 38) · ×1
  • MergeLayerController.mergeSelectedInto (cyclomatic 38) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:628 — MergeLayerController.mergeSelectedInto has cyclomatic complexity 38 (threshold 15). Of this number, 34 points are the body's own statements and 4 belong to 4 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · useProjectActions.useProjectActions (cyclomatic 38) · ×1
  • useProjectActions.useProjectActions (cyclomatic 38) invokeai/frontend/webv2/src/workbench/projects/useProjectActions.ts:56 — useProjectActions.useProjectActions has cyclomatic complexity 38 (threshold 15). Most of this is not in the body itself: 1 of the 38 points is its own statement and the rest belongs to 9 function literals inside it that branch (lines 73, 190, 239, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · GraphExecutionState._rehydrate_generic_runtime_state (cyclomatic 37) · ×1
  • GraphExecutionState._rehydrate_generic_runtime_state (cyclomatic 37) invokeai/app/services/shared/graph.py:3771 — GraphExecutionState._rehydrate_generic_runtime_state has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · aac_splice._read_audio_track (cyclomatic 37) · ×1
  • aac_splice._read_audio_track (cyclomatic 37) invokeai/app/util/aac_splice.py:145 — aac_splice._read_audio_track has cyclomatic complexity 37 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · UseDefaultSettingsButton.UseDefaultSettingsButton (cyclomatic 37) · ×1
  • UseDefaultSettingsButton.UseDefaultSettingsButton (cyclomatic 37) invokeai/frontend/webv1/src/features/parameters/components/MainModel/UseDefaultSettingsButton.tsx:24 — UseDefaultSettingsButton.UseDefaultSettingsButton has cyclomatic complexity 37 (threshold 15). Most of this is not in the body itself: 3 of the 37 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 62, 51, 56, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · GalleryBoardMenu.GalleryBoardMenu (cyclomatic 37) · ×1
  • GalleryBoardMenu.GalleryBoardMenu (cyclomatic 37) invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardMenu.tsx:38 — GalleryBoardMenu.GalleryBoardMenu has cyclomatic complexity 37 (threshold 15). Of this number, 25 points are the body's own statements and 12 belong to 9 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · compileCanvasGraph.getCanvasValidationReasons (cyclomatic 37) · ×1
  • compileCanvasGraph.getCanvasValidationReasons (cyclomatic 37) invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.ts:145 — compileCanvasGraph.getCanvasValidationReasons has cyclomatic complexity 37 (threshold 15). Of this number, 36 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · runtime.createQueueItemBackendSubmission (cyclomatic 37) · ×1
  • runtime.createQueueItemBackendSubmission (cyclomatic 37) invokeai/frontend/webv2/src/features/queue/runtime.ts:267 — runtime.createQueueItemBackendSubmission has cyclomatic complexity 37 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · VideoReferenceListField.ReferenceCard (cyclomatic 37) · ×1
  • VideoReferenceListField.ReferenceCard (cyclomatic 37) invokeai/frontend/webv2/src/features/video/ui/VideoReferenceListField.tsx:82 — VideoReferenceListField.ReferenceCard has cyclomatic complexity 37 (threshold 15). Most of this is not in the body itself: 15 of the 37 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 216, 132, 141, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · validation.isValidLoopLinkageConnection (cyclomatic 37) · ×1
  • validation.isValidLoopLinkageConnection (cyclomatic 37) invokeai/frontend/webv2/src/features/workflow/core/validation.ts:370 — validation.isValidLoopLinkageConnection has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RasterExportController.rasterize (cyclomatic 37) · ×1
  • RasterExportController.rasterize (cyclomatic 37) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/rasterExportController.ts:167 — RasterExportController.rasterize has cyclomatic complexity 37 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · createCanvasEngine.createCanvasEngine (cyclomatic 37) · ×1
  • createCanvasEngine.createCanvasEngine (cyclomatic 37) invokeai/frontend/webv2/src/workbench/canvas-operations/createCanvasEngine.ts:81 — createCanvasEngine.createCanvasEngine has cyclomatic complexity 37 (threshold 15). Most of this is not in the body itself: 3 of the 37 points are its own statements and the rest belongs to 15 function items inside it that branch (a function literal at line 161, resolveUploadProjectId, uploadImage, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · ChildExecutionCapability.create_dependency (cyclomatic 36) · ×1
  • ChildExecutionCapability.create_dependency (cyclomatic 36) invokeai/app/services/shared/execution_engine/child.py:311 — ChildExecutionCapability.create_dependency has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · graph_if_runtime._get_if_iteration_paths_with_ancestry (cyclomatic 36) · ×1
  • graph_if_runtime._get_if_iteration_paths_with_ancestry (cyclomatic 36) invokeai/app/services/shared/graph_if_runtime.py:393 — graph_if_runtime._get_if_iteration_paths_with_ancestry has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ProtectedRoute.ProtectedRoute (cyclomatic 36) · ×1
  • ProtectedRoute.ProtectedRoute (cyclomatic 36) invokeai/frontend/webv1/src/features/auth/components/ProtectedRoute.tsx:21 — ProtectedRoute.ProtectedRoute has cyclomatic complexity 36 (threshold 15). Most of this is not in the body itself: 11 of the 36 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 114, 100, 42, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · rasterSnapshotCapture.createRasterSnapshotCapture.captureRasterSnapshot (cyclomatic 36) · ×1
  • rasterSnapshotCapture.createRasterSnapshotCapture.captureRasterSnapshot (cyclomatic 36) invokeai/frontend/webv2/src/workbench/canvas-engine/rasterSnapshotCapture.ts:85 — rasterSnapshotCapture.createRasterSnapshotCapture.captureRasterSnapshot has cyclomatic complexity 36 (threshold 15). Of this number, 35 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CanvasEntityBufferObjectRenderer.renderBufferObject (cyclomatic 35) · ×1
  • CanvasEntityBufferObjectRenderer.renderBufferObject (cyclomatic 35) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityBufferObjectRenderer.ts:115 — CanvasEntityBufferObjectRenderer.renderBufferObject has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · modelSettingsIO.validateImportData (cyclomatic 35) · ×1
  • modelSettingsIO.validateImportData (cyclomatic 35) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/modelSettingsIO.ts:100 — modelSettingsIO.validateImportData has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · buildNodesGraph.buildNodesGraph (cyclomatic 35) · ×1
  • buildNodesGraph.buildNodesGraph (cyclomatic 35) invokeai/frontend/webv1/src/features/nodes/util/graph/buildNodesGraph.ts:48 — buildNodesGraph.buildNodesGraph has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 1 of the 35 points is its own statement and the rest belongs to 8 function literals inside it that branch (lines 130, 68, 211, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · measure-architecture-performance.runSample (cyclomatic 35) · ×1
  • measure-architecture-performance.runSample (cyclomatic 35) invokeai/frontend/webv2/scripts/measure-architecture-performance.mjs:316 — measure-architecture-performance.runSample has cyclomatic complexity 35 (threshold 15). Of this number, 23 points are the body's own statements and 12 belong to 10 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · InvocationFlowNode.InputFieldRow (cyclomatic 35) · ×1
  • InvocationFlowNode.InputFieldRow (cyclomatic 35) invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx:541 — InvocationFlowNode.InputFieldRow has cyclomatic complexity 35 (threshold 15). Of this number, 33 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · indexedDbDraftStore.createIndexedDbProjectDraftStore.retargetAcknowledgedCopy (cyclomatic 35) · ×1
  • indexedDbDraftStore.createIndexedDbProjectDraftStore.retargetAcknowledgedCopy (cyclomatic 35) invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:991 — indexedDbDraftStore.createIndexedDbProjectDraftStore.retargetAcknowledgedCopy has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 14 of the 35 points are its own statements and the rest belongs to one function literal inside it that branches (line 1025). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · canvasProjectMutations.patchLayerConfig (cyclomatic 35) · ×1
  • canvasProjectMutations.patchLayerConfig (cyclomatic 35) invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts:603 — canvasProjectMutations.patchLayerConfig has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LayerGroupContextMenu.LayerGroupContextMenu (cyclomatic 35) · ×1
  • LayerGroupContextMenu.LayerGroupContextMenu (cyclomatic 35) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerGroupContextMenu.tsx:74 — LayerGroupContextMenu.LayerGroupContextMenu has cyclomatic complexity 35 (threshold 15). Of this number, 23 points are the body's own statements and 12 belong to 6 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · OverviewPane.ConnectedOverview (cyclomatic 35) · ×1
  • OverviewPane.ConnectedOverview (cyclomatic 35) invokeai/frontend/webv2/src/workbench/widgets/layers/panes/OverviewPane.tsx:60 — OverviewPane.ConnectedOverview has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 1 of the 35 points is its own statement and the rest belongs to 13 function literals inside it that branch (lines 244, 72, 124, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · WanVideoDenoiseInvocation._run_diffusion (cyclomatic 34) · ×1
  • WanVideoDenoiseInvocation._run_diffusion (cyclomatic 34) invokeai/app/invocations/wan/wan_video_denoise.py:157 — WanVideoDenoiseInvocation._run_diffusion has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PixDiT_T2I.forward (cyclomatic 34) · ×1
  • PixDiT_T2I.forward (cyclomatic 34) invokeai/backend/pid/_src/networks/pixeldit_official.py:1412 — PixDiT_T2I.forward has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StagingAreaApi.onItemsChangedEvent (cyclomatic 34) · ×1
  • StagingAreaApi.onItemsChangedEvent (cyclomatic 34) invokeai/frontend/webv1/src/features/controlLayers/components/StagingArea/state.ts:460 — StagingAreaApi.onItemsChangedEvent has cyclomatic complexity 34 (threshold 15). Of this number, 32 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DefaultSettingsSection.DefaultSettingsSection (cyclomatic 34) · ×1
  • DefaultSettingsSection.DefaultSettingsSection (cyclomatic 34) invokeai/frontend/webv2/src/features/models/ui/detail/DefaultSettingsSection.tsx:160 — DefaultSettingsSection.DefaultSettingsSection has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 8 of the 34 points are its own statements and the rest belongs to 10 function items inside it that branch (a function literal at line 316, a function literal at line 188, retrySchedulerRules, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · CallSavedWorkflowSyncRuntime.CallSavedWorkflowSyncRuntime · ×1
  • CallSavedWorkflowSyncRuntime.CallSavedWorkflowSyncRuntime::reconcile (cyclomatic 34) invokeai/frontend/webv2/src/features/workflow/ui/editor/CallSavedWorkflowSyncRuntime.tsx:175 — CallSavedWorkflowSyncRuntime.CallSavedWorkflowSyncRuntime::reconcile has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WorkflowLibraryThumbnail.WorkflowLibraryThumbnail (cyclomatic 34) · ×1
  • WorkflowLibraryThumbnail.WorkflowLibraryThumbnail (cyclomatic 34) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryThumbnail.tsx:47 — WorkflowLibraryThumbnail.WorkflowLibraryThumbnail has cyclomatic complexity 34 (threshold 15). Of this number, 22 points are the body's own statements and 12 belong to 6 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HsvWheelPicker.HsvWheelPicker (cyclomatic 34) · ×1
  • HsvWheelPicker.HsvWheelPicker (cyclomatic 34) invokeai/frontend/webv2/src/platform/ui/HsvWheelPicker.tsx:38 — HsvWheelPicker.HsvWheelPicker has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 7 of the 34 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 62, 171, 189, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · ControlLayerCanvasOverlay.SelectedControlLayerOverlay (cyclomatic 34) · ×1
  • ControlLayerCanvasOverlay.SelectedControlLayerOverlay (cyclomatic 34) invokeai/frontend/webv2/src/workbench/widgets/canvas/ControlLayerCanvasOverlay.tsx:64 — ControlLayerCanvasOverlay.SelectedControlLayerOverlay has cyclomatic complexity 34 (threshold 15). Of this number, 28 points are the body's own statements and 6 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · layerPanelRows.navigateTree (cyclomatic 34) · ×1
  • layerPanelRows.navigateTree (cyclomatic 34) invokeai/frontend/webv2/src/workbench/widgets/layers/layerPanelRows.ts:147 — layerPanelRows.navigateTree has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RunLayerWorkflowDialog.RunLayerWorkflowDialog (cyclomatic 34) · ×1
  • RunLayerWorkflowDialog.RunLayerWorkflowDialog (cyclomatic 34) invokeai/frontend/webv2/src/workbench/widgets/layers/RunLayerWorkflowDialog.tsx:198 — RunLayerWorkflowDialog.RunLayerWorkflowDialog has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 13 of the 34 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 354, 320, 255, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · paintTool.resolveTarget (cyclomatic 34) · ×1
  • paintTool.resolveTarget (cyclomatic 34) invokeai/frontend/webv2/src/workbench/canvas-engine/tools/paintTool.ts:144 — paintTool.resolveTarget has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · projectFile.importProjectFile (cyclomatic 34) · ×1
  • projectFile.importProjectFile (cyclomatic 34) invokeai/frontend/webv2/src/workbench/projects/projectFile.ts:283 — projectFile.importProjectFile has cyclomatic complexity 34 (threshold 15). Of this number, 33 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · WorkbenchShell.WorkbenchShell (cyclomatic 34) · ×1
  • WorkbenchShell.WorkbenchShell (cyclomatic 34) invokeai/frontend/webv2/src/workbench/shell/WorkbenchShell.tsx:65 — WorkbenchShell.WorkbenchShell has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 10 of the 34 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 221, 147, 173, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · QwenImage21DenoiseInvocation._run_diffusion (cyclomatic 33) · ×1
  • QwenImage21DenoiseInvocation._run_diffusion (cyclomatic 33) invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_denoise.py:323 — QwenImage21DenoiseInvocation._run_diffusion has cyclomatic complexity 33 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · WanModelLoaderInvocation.invoke (cyclomatic 33) · ×1
  • WanModelLoaderInvocation.invoke (cyclomatic 33) invokeai/app/invocations/wan/wan_model_loader.py:125 — WanModelLoaderInvocation.invoke has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OpenAIProvider.generate (cyclomatic 33) · ×1
  • OpenAIProvider.generate (cyclomatic 33) invokeai/app/services/external_generation/providers/openai.py:31 — OpenAIProvider.generate has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SeedreamProvider.generate (cyclomatic 33) · ×1
  • SeedreamProvider.generate (cyclomatic 33) invokeai/app/services/external_generation/providers/seedream.py:39 — SeedreamProvider.generate has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · working_memory_calibration_plan.build_plan (cyclomatic 33) · ×1
  • working_memory_calibration_plan.build_plan (cyclomatic 33) invokeai/app/services/working_memory_calibration/working_memory_calibration_plan.py:570 — working_memory_calibration_plan.build_plan has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · denoise.denoise (cyclomatic 33) · ×1
  • denoise.denoise (cyclomatic 33) invokeai/backend/flux/denoise.py:26 — denoise.denoise has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · hidiffusion_utils.hidiffusion_patch (cyclomatic 33) · ×1
  • hidiffusion_utils.hidiffusion_patch (cyclomatic 33) invokeai/backend/stable_diffusion/hidiffusion_utils.py:19 — hidiffusion_utils.hidiffusion_patch has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ControlNetModel.__init__ (cyclomatic 33) · ×1
  • ControlNetModel.__init__ (cyclomatic 33) invokeai/backend/util/hotfixes.py:109 — ControlNetModel.__init__ has cyclomatic complexity 33 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ToolWidthPicker.ToolWidthPicker (cyclomatic 33) · ×1
  • ToolWidthPicker.ToolWidthPicker (cyclomatic 33) invokeai/frontend/webv1/src/features/controlLayers/components/Tool/ToolWidthPicker.tsx:223 — ToolWidthPicker.ToolWidthPicker has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 3 of the 33 points are its own statements and the rest belongs to 16 function literals inside it that branch (lines 388, 314, 233, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · mock-working-memory.createWorkingMemoryMock.calibrate (cyclomatic 33) · ×1
  • mock-working-memory.createWorkingMemoryMock.calibrate (cyclomatic 33) invokeai/frontend/webv2/scripts/mock-working-memory.mjs:710 — mock-working-memory.createWorkingMemoryMock.calibrate has cyclomatic complexity 33 (threshold 15). Of this number, 29 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · galleryBoardGroups.getGalleryBoardGroups (cyclomatic 33) · ×1
  • galleryBoardGroups.getGalleryBoardGroups (cyclomatic 33) invokeai/frontend/webv2/src/features/gallery/ui/galleryBoardGroups.ts:61 — galleryBoardGroups.getGalleryBoardGroups has cyclomatic complexity 33 (threshold 15). Of this number, 18 points are the body's own statements and 15 belong to 9 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · GenerateReferenceImagesSection.GenerateReferenceImagesContent (cyclomatic 33) · ×1
  • GenerateReferenceImagesSection.GenerateReferenceImagesContent (cyclomatic 33) invokeai/frontend/webv2/src/features/generation/ui/reference-images/GenerateReferenceImagesSection.tsx:61 — GenerateReferenceImagesSection.GenerateReferenceImagesContent has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 15 of the 33 points are its own statements and the rest belongs to 10 function items inside it that branch (addGalleryImages, a function literal at line 163, a function literal at line 177, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · settings.normalizeUpscaleWidgetValues (cyclomatic 33) · ×1
  • settings.normalizeUpscaleWidgetValues (cyclomatic 33) invokeai/frontend/webv2/src/features/upscale/core/settings.ts:785 — settings.normalizeUpscaleWidgetValues has cyclomatic complexity 33 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · outputImages.visitOutputImageNames (cyclomatic 33) · ×1
  • outputImages.visitOutputImageNames (cyclomatic 33) invokeai/frontend/webv2/src/platform/core/outputImages.ts:10 — outputImages.visitOutputImageNames has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 15 of the 33 points are its own statements and the rest belongs to 4 function items inside it that branch (visitWorkflowReturnValue, visitImageField, visitImageCollection, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · LayerChildRow.LayerChildRowComponent (cyclomatic 33) · ×1
  • LayerChildRow.LayerChildRowComponent (cyclomatic 33) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerChildRow.tsx:89 — LayerChildRow.LayerChildRowComponent has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 14 of the 33 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 171, 147, 192, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · FilterResultController.commit (cyclomatic 33) · ×1
  • FilterResultController.commit (cyclomatic 33) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/filterResultController.ts:66 — FilterResultController.commit has cyclomatic complexity 33 (threshold 15). Of this number, 30 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · maskOutline.traceMaskOutlinePath (cyclomatic 33) · ×1
  • maskOutline.traceMaskOutlinePath (cyclomatic 33) invokeai/frontend/webv2/src/workbench/canvas-engine/selection/maskOutline.ts:22 — maskOutline.traceMaskOutlinePath has cyclomatic complexity 33 (threshold 15). Of this number, 23 points are the body's own statements and 10 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · selectObjectSession.createSelectObjectSession.runRequest (cyclomatic 33) · ×1
  • selectObjectSession.createSelectObjectSession.runRequest (cyclomatic 33) invokeai/frontend/webv2/src/workbench/canvas-operations/selectObjectSession.ts:282 — selectObjectSession.createSelectObjectSession.runRequest has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 13 of the 33 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 293, 355). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · generationComposite.composeForGeneration (cyclomatic 33) · ×1
  • generationComposite.composeForGeneration (cyclomatic 33) invokeai/frontend/webv2/src/workbench/canvas-operations/generationComposite.ts:144 — generationComposite.composeForGeneration has cyclomatic complexity 33 (threshold 15). Of this number, 29 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · revealGalleryItem.revealGalleryItem (cyclomatic 33) · ×1
  • revealGalleryItem.revealGalleryItem (cyclomatic 33) invokeai/frontend/webv2/src/workbench/image-actions/revealGalleryItem.ts:54 — revealGalleryItem.revealGalleryItem has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 2 of the 33 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 70, isCurrent). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · TextOptions.TextFontSettings (cyclomatic 33) · ×1
  • TextOptions.TextFontSettings (cyclomatic 33) invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/TextOptions.tsx:566 — TextOptions.TextFontSettings has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 7 of the 33 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 637, 680, 705, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · InvokeAdjustImageHuePlusInvocation.invoke (cyclomatic 32) · ×1
  • InvokeAdjustImageHuePlusInvocation.invoke (cyclomatic 32) invokeai/app/invocations/composition-nodes.py:85 — InvokeAdjustImageHuePlusInvocation.invoke has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Qwen3EncoderCheckpointLoader._load_from_singlefile (cyclomatic 32) · ×1
  • Qwen3EncoderCheckpointLoader._load_from_singlefile (cyclomatic 32) invokeai/backend/model_manager/load/model_loaders/z_image.py:1112 — Qwen3EncoderCheckpointLoader._load_from_singlefile has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · validators.getRegionalGuidanceWarnings (cyclomatic 32) · ×1
  • validators.getRegionalGuidanceWarnings (cyclomatic 32) invokeai/frontend/webv1/src/features/controlLayers/store/validators.ts:37 — validators.getRegionalGuidanceWarnings has cyclomatic complexity 32 (threshold 15). Of this number, 29 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AddNodeCmdk.NodeCommandList (cyclomatic 32) · ×1
  • AddNodeCmdk.NodeCommandList (cyclomatic 32) invokeai/frontend/webv1/src/features/nodes/components/flow/AddNodeCmdk/AddNodeCmdk.tsx:386 — AddNodeCmdk.NodeCommandList has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 3 of the 32 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 426, 514, 486, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · GraphPreviewOpenAsMenu.GraphPreviewOpenAsMenu (cyclomatic 32) · ×1
  • GraphPreviewOpenAsMenu.GraphPreviewOpenAsMenu (cyclomatic 32) invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/GraphPreviewOpenAsMenu.tsx:51 — GraphPreviewOpenAsMenu.GraphPreviewOpenAsMenu has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 5 of the 32 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 115, 179, 215, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · WorkflowWidgetChrome.WorkflowDialogHost (cyclomatic 32) · ×1
  • WorkflowWidgetChrome.WorkflowDialogHost (cyclomatic 32) invokeai/frontend/webv2/src/features/workflow/ui/WorkflowWidgetChrome.tsx:405 — WorkflowWidgetChrome.WorkflowDialogHost has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 6 of the 32 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 487, 585, 440, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · Picker.Picker (cyclomatic 32) · ×1
  • Picker.Picker (cyclomatic 32) invokeai/frontend/webv2/src/platform/ui/Picker.tsx:125 — Picker.Picker has cyclomatic complexity 32 (threshold 15). Of this number, 16 points are the body's own statements and 16 belong to 6 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · indexedDbDraftStore.createIndexedDbProjectDraftStore.reconcileUnloadJournal (cyclomatic 32) · ×1
  • indexedDbDraftStore.createIndexedDbProjectDraftStore.reconcileUnloadJournal (cyclomatic 32) invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:784 — indexedDbDraftStore.createIndexedDbProjectDraftStore.reconcileUnloadJournal has cyclomatic complexity 32 (threshold 15). Of this number, 16 points are the body's own statements and 16 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · indexedDbDraftStore.createIndexedDbProjectDraftStore.stage (cyclomatic 32) · ×1
  • indexedDbDraftStore.createIndexedDbProjectDraftStore.stage (cyclomatic 32) invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:1275 — indexedDbDraftStore.createIndexedDbProjectDraftStore.stage has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ControlDerivationController.commitControlMap (cyclomatic 32) · ×1
  • ControlDerivationController.commitControlMap (cyclomatic 32) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/controlDerivationController.ts:198 — ControlDerivationController.commitControlMap has cyclomatic complexity 32 (threshold 15). Of this number, 20 points are the body's own statements and 12 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · GeneratedResultController.commit (cyclomatic 32) · ×1
  • GeneratedResultController.commit (cyclomatic 32) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/generatedResultController.ts:56 — GeneratedResultController.commit has cyclomatic complexity 32 (threshold 15). Of this number, 24 points are the body's own statements and 8 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ImageContextMenu.SingleItemMenuItems (cyclomatic 32) · ×1
  • ImageContextMenu.SingleItemMenuItems (cyclomatic 32) invokeai/frontend/webv2/src/workbench/image-actions/ImageContextMenu.tsx:275 — ImageContextMenu.SingleItemMenuItems has cyclomatic complexity 32 (threshold 15). Of this number, 23 points are the body's own statements and 9 belong to 6 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · FluxDenoiseInvocation._run_diffusion (cyclomatic 31) · ×1
  • FluxDenoiseInvocation._run_diffusion (cyclomatic 31) invokeai/app/invocations/flux/flux_denoise.py:220 — FluxDenoiseInvocation._run_diffusion has cyclomatic complexity 31 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · h264_splice._read_video_stbl (cyclomatic 31) · ×1
  • h264_splice._read_video_stbl (cyclomatic 31) invokeai/app/util/h264_splice.py:344 — h264_splice._read_video_stbl has cyclomatic complexity 31 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · LoRALoader._load_model (cyclomatic 31) · ×1
  • LoRALoader._load_model (cyclomatic 31) invokeai/backend/model_manager/load/model_loaders/lora.py:102 — LoRALoader._load_model has cyclomatic complexity 31 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AdministratorSetup.AdministratorSetup (cyclomatic 31) · ×1
  • AdministratorSetup.AdministratorSetup (cyclomatic 31) invokeai/frontend/webv1/src/features/auth/components/AdministratorSetup.tsx:26 — AdministratorSetup.AdministratorSetup has cyclomatic complexity 31 (threshold 15). Of this number, 24 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · ModelInstallQueue.ModelInstallQueue (cyclomatic 31) · ×1
  • ModelInstallQueue.ModelInstallQueue (cyclomatic 31) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/AddModelPanel/ModelInstallQueue/ModelInstallQueue.tsx:75 — ModelInstallQueue.ModelInstallQueue has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 11 of the 31 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 90, 127, 137, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · validateConnectionTypes.validateConnectionTypes (cyclomatic 31) · ×1
  • validateConnectionTypes.validateConnectionTypes (cyclomatic 31) invokeai/frontend/webv1/src/features/nodes/store/util/validateConnectionTypes.ts:10 — validateConnectionTypes.validateConnectionTypes has cyclomatic complexity 31 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · validation.validateConnection (cyclomatic 31) · ×1
  • validation.validateConnection (cyclomatic 31) invokeai/frontend/webv2/src/features/workflow/core/validation.ts:511 — validation.validateConnection has cyclomatic complexity 31 (threshold 15). Of this number, 28 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · layerTreeDrop.projectLayerDrop (cyclomatic 31) · ×1
  • layerTreeDrop.projectLayerDrop (cyclomatic 31) invokeai/frontend/webv2/src/workbench/widgets/layers/layerTreeDrop.ts:52 — layerTreeDrop.projectLayerDrop has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PsdExportController.export (cyclomatic 31) · ×1
  • PsdExportController.export (cyclomatic 31) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/psdExportController.ts:81 — PsdExportController.export has cyclomatic complexity 31 (threshold 15). Of this number, 22 points are the body's own statements and 9 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · LayerFilterControls.FilterParamField (cyclomatic 31) · ×1
  • LayerFilterControls.FilterParamField (cyclomatic 31) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerFilterControls.tsx:143 — LayerFilterControls.FilterParamField has cyclomatic complexity 31 (threshold 15). Of this number, 24 points are the body's own statements and 7 belong to 5 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ModelInstallService._enqueue_remote_download (cyclomatic 30) · ×1
  • ModelInstallService._enqueue_remote_download (cyclomatic 30) invokeai/app/services/model_install/model_install_default.py:2184 — ModelInstallService._enqueue_remote_download has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · promptAttention.groupTerminals (cyclomatic 30) · ×1
  • promptAttention.groupTerminals (cyclomatic 30) invokeai/frontend/webv1/src/common/util/promptAttention.ts:463 — promptAttention.groupTerminals has cyclomatic complexity 30 (threshold 15). Of this number, 27 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CanvasToolModule.onKeyDown (cyclomatic 30) · ×1
  • CanvasToolModule.onKeyDown (cyclomatic 30) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasToolModule.ts:796 — CanvasToolModule.onKeyDown has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · run-project-file-journey.executeProjectFileJourney (cyclomatic 30) · ×1
  • run-project-file-journey.executeProjectFileJourney (cyclomatic 30) REDACTED:1158 — run-project-file-journey.executeProjectFileJourney has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 5 of the 30 points are its own statements and the rest belongs to 9 function items inside it that branch (stopPreview, a function literal at line 1295, a function literal at line 1363, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · dependencyPolicy.checkDependency (cyclomatic 30) · ×1
  • dependencyPolicy.checkDependency (cyclomatic 30) invokeai/frontend/webv2/src/architecture/dependencyPolicy.ts:199 — dependencyPolicy.checkDependency has cyclomatic complexity 30 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · queries.ensureLifecycle (cyclomatic 30) · ×1
  • queries.ensureLifecycle (cyclomatic 30) invokeai/frontend/webv2/src/features/gallery/data/queries.ts:396 — queries.ensureLifecycle has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 9 of the 30 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 463, a function literal at line 418, pruneListing, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · GalleryBoardRow.GalleryBoardRow (cyclomatic 30) · ×1
  • GalleryBoardRow.GalleryBoardRow (cyclomatic 30) invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardRow.tsx:42 — GalleryBoardRow.GalleryBoardRow has cyclomatic complexity 30 (threshold 15). Of this number, 17 points are the body's own statements and 13 belong to 8 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · useGalleryGridHotkeys.useGalleryGridHotkeys (cyclomatic 30) · ×1
  • useGalleryGridHotkeys.useGalleryGridHotkeys (cyclomatic 30) invokeai/frontend/webv2/src/features/gallery/ui/useGalleryGridHotkeys.ts:73 — useGalleryGridHotkeys.useGalleryGridHotkeys has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 1 of the 30 points is its own statement and the rest belongs to 6 function items inside it that branch (a function literal at line 205, a function literal at line 137, getRangeAnchorKey, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · graph.buildMiniMaxH3VideoGraph (cyclomatic 30) · ×1
  • graph.buildMiniMaxH3VideoGraph (cyclomatic 30) invokeai/frontend/webv2/src/features/video/core/graph.ts:438 — graph.buildMiniMaxH3VideoGraph has cyclomatic complexity 30 (threshold 15). Of this number, 29 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · validation.validateConnectionTypes (cyclomatic 30) · ×1
  • validation.validateConnectionTypes (cyclomatic 30) invokeai/frontend/webv2/src/features/workflow/core/validation.ts:40 — validation.validateConnectionTypes has cyclomatic complexity 30 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · callSavedWorkflow.syncCallSavedWorkflowFields (cyclomatic 30) · ×1
  • callSavedWorkflow.syncCallSavedWorkflowFields (cyclomatic 30) invokeai/frontend/webv2/src/features/workflow/core/callSavedWorkflow.ts:220 — callSavedWorkflow.syncCallSavedWorkflowFields has cyclomatic complexity 30 (threshold 15). Of this number, 27 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · buildGraph.getProjectGraphReadiness (cyclomatic 30) · ×1
  • buildGraph.getProjectGraphReadiness (cyclomatic 30) invokeai/frontend/webv2/src/features/workflow/core/buildGraph.ts:125 — buildGraph.getProjectGraphReadiness has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ProjectWorkflowsView.ProjectWorkflowDetailPanel (cyclomatic 30) · ×1
  • ProjectWorkflowsView.ProjectWorkflowDetailPanel (cyclomatic 30) invokeai/frontend/webv2/src/features/workflow/ui/library/ProjectWorkflowsView.tsx:225 — ProjectWorkflowsView.ProjectWorkflowDetailPanel has cyclomatic complexity 30 (threshold 15). Of this number, 17 points are the body's own statements and 13 belong to 12 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · draftStore.isProjectDraftWriterClaim (cyclomatic 30) · ×1
  • draftStore.isProjectDraftWriterClaim (cyclomatic 30) invokeai/frontend/webv2/src/workbench/projects/draftStore.ts:559 — draftStore.isProjectDraftWriterClaim has cyclomatic complexity 30 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · indexedDbDraftStore.createIndexedDbProjectDraftStore.deleteCorrupt (cyclomatic 30) · ×1
  • indexedDbDraftStore.createIndexedDbProjectDraftStore.deleteCorrupt (cyclomatic 30) invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:557 — indexedDbDraftStore.createIndexedDbProjectDraftStore.deleteCorrupt has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 1 of the 30 points is its own statement and the rest belongs to one function literal inside it that branches (line 559). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · invocation.resolveInvocationRouteInput (cyclomatic 30) · ×1
  • invocation.resolveInvocationRouteInput (cyclomatic 30) invokeai/frontend/webv2/src/workbench/invocation.ts:373 — invocation.resolveInvocationRouteInput has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PixelEditController.begin (cyclomatic 30) · ×1
  • PixelEditController.begin (cyclomatic 30) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/controlPixelController.ts:130 — PixelEditController.begin has cyclomatic complexity 30 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · shapeTool.createShapeTool.commitPixels (cyclomatic 30) · ×1
  • shapeTool.createShapeTool.commitPixels (cyclomatic 30) invokeai/frontend/webv2/src/workbench/canvas-engine/tools/shapeTool.ts:154 — shapeTool.createShapeTool.commitPixels has cyclomatic complexity 30 (threshold 15). Of this number, 27 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · controlPanelModel.deriveModel (cyclomatic 30) · ×1
  • controlPanelModel.deriveModel (cyclomatic 30) invokeai/frontend/webv2/src/workbench/widgets/layers/controlPanelModel.ts:233 — controlPanelModel.deriveModel has cyclomatic complexity 30 (threshold 15). Of this number, 29 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ModelInstallService._install_path_with_info_claimed (cyclomatic 29) · ×1
  • ModelInstallService._install_path_with_info_claimed (cyclomatic 29) invokeai/app/services/model_install/model_install_default.py:1008 — ModelInstallService._install_path_with_info_claimed has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _ExecutionNodeBuilder._create_nested_iterate_body_iteration (cyclomatic 29) · ×1
  • _ExecutionNodeBuilder._create_nested_iterate_body_iteration (cyclomatic 29) invokeai/app/services/shared/graph_materializer.py:1017 — _ExecutionNodeBuilder._create_nested_iterate_body_iteration has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Graph._is_for_connection_valid (cyclomatic 29) · ×1
  • Graph._is_for_connection_valid (cyclomatic 29) invokeai/app/services/shared/graph_validation.py:1384 — Graph._is_for_connection_valid has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TextToolOptions.FontSelect (cyclomatic 29) · ×1
  • TextToolOptions.FontSelect (cyclomatic 29) invokeai/frontend/webv1/src/features/controlLayers/components/Text/TextToolOptions.tsx:97 — TextToolOptions.FontSelect has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 1 of the 29 points is its own statement and the rest belongs to 14 function literals inside it that branch (lines 123, 265, 137, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · buildGraph.compileProjectGraph (cyclomatic 29) · ×1
  • buildGraph.compileProjectGraph (cyclomatic 29) invokeai/frontend/webv2/src/features/workflow/core/buildGraph.ts:303 — buildGraph.compileProjectGraph has cyclomatic complexity 29 (threshold 15). Of this number, 28 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WorkflowFieldInput.SavedWorkflowInput (cyclomatic 29) · ×1
  • WorkflowFieldInput.SavedWorkflowInput (cyclomatic 29) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:1766 — WorkflowFieldInput.SavedWorkflowInput has cyclomatic complexity 29 (threshold 15). Of this number, 19 points are the body's own statements and 10 belong to 5 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CropLayerController.crop (cyclomatic 29) · ×1
  • CropLayerController.crop (cyclomatic 29) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/cropLayerController.ts:175 — CropLayerController.crop has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · TransformEditingController.apply (cyclomatic 29) · ×1
  • TransformEditingController.apply (cyclomatic 29) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/transformEditingController.ts:267 — TransformEditingController.apply has cyclomatic complexity 29 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · ImageStorageSettings.ImageStorageEditor (cyclomatic 29) · ×1
  • ImageStorageSettings.ImageStorageEditor (cyclomatic 29) invokeai/frontend/webv2/src/workbench/settings/ImageStorageSettings.tsx:106 — ImageStorageSettings.ImageStorageEditor has cyclomatic complexity 29 (threshold 15). Of this number, 16 points are the body's own statements and 13 belong to 7 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · LTX2DenoiseInvocation.invoke (cyclomatic 28) · ×1
  • LTX2DenoiseInvocation.invoke (cyclomatic 28) invokeai/app/invocations/ltx2/ltx2_denoise.py:398 — LTX2DenoiseInvocation.invoke has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MiniMaxH3DenoiseInvocation.invoke (cyclomatic 28) · ×1
  • MiniMaxH3DenoiseInvocation.invoke (cyclomatic 28) invokeai/app/invocations/minimax_h3/minimax_h3_denoise.py:319 — MiniMaxH3DenoiseInvocation.invoke has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ExtractVideoRangeInvocation.invoke (cyclomatic 28) · ×1
  • ExtractVideoRangeInvocation.invoke (cyclomatic 28) invokeai/app/invocations/video_frame_extract_range.py:187 — ExtractVideoRangeInvocation.invoke has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · GraphExecutionState._record_effect_streams (cyclomatic 28) · ×1
  • GraphExecutionState._record_effect_streams (cyclomatic 28) invokeai/app/services/shared/graph.py:1698 — GraphExecutionState._record_effect_streams has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GraphExecutionState.apply (cyclomatic 28) · ×1
  • GraphExecutionState.apply (cyclomatic 28) invokeai/app/services/shared/graph.py:3153 — GraphExecutionState.apply has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · graph_if_dependencies._can_use_fresh_mixed_if_iterate_collect (cyclomatic 28) · ×1
  • graph_if_dependencies._can_use_fresh_mixed_if_iterate_collect (cyclomatic 28) invokeai/app/services/shared/graph_if_dependencies.py:30 — graph_if_dependencies._can_use_fresh_mixed_if_iterate_collect has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Flux2CheckpointModel._load_from_singlefile (cyclomatic 28) · ×1
  • Flux2CheckpointModel._load_from_singlefile (cyclomatic 28) invokeai/backend/model_manager/load/model_loaders/flux.py:1261 — Flux2CheckpointModel._load_from_singlefile has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Qwen3EncoderGGUFLoader._load_from_gguf (cyclomatic 28) · ×1
  • Qwen3EncoderGGUFLoader._load_from_gguf (cyclomatic 28) invokeai/backend/model_manager/load/model_loaders/z_image.py:1419 — Qwen3EncoderGGUFLoader._load_from_gguf has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ControlNetModel.forward (cyclomatic 28) · ×1
  • ControlNetModel.forward (cyclomatic 28) invokeai/backend/util/hotfixes.py:570 — ControlNetModel.forward has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DeleteBoardModal.DeleteBoardModal (cyclomatic 28) · ×1
  • DeleteBoardModal.DeleteBoardModal (cyclomatic 28) invokeai/frontend/webv1/src/features/gallery/components/Boards/DeleteBoardModal.tsx:43 — DeleteBoardModal.DeleteBoardModal has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 9 of the 28 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 105, 123, 154, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · buildQwenImageGraph.buildQwenImageGraph (cyclomatic 28) · ×1
  • buildQwenImageGraph.buildQwenImageGraph (cyclomatic 28) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildQwenImageGraph.ts:87 — buildQwenImageGraph.buildQwenImageGraph has cyclomatic complexity 28 (threshold 15). Of this number, 25 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GalleryPickerGrid.GalleryPickerGrid (cyclomatic 28) · ×1
  • GalleryPickerGrid.GalleryPickerGrid (cyclomatic 28) invokeai/frontend/webv2/src/features/gallery/ui/picker/GalleryPickerGrid.tsx:192 — GalleryPickerGrid.GalleryPickerGrid has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 9 of the 28 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 386, 281, 322, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · controlValidation.getControlValidationReason (cyclomatic 28) · ×1
  • controlValidation.getControlValidationReason (cyclomatic 28) invokeai/frontend/webv2/src/features/generation/core/canvas/controlValidation.ts:113 — controlValidation.getControlValidationReason has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · GeneratePresetsPopover.GeneratePresetsPopover (cyclomatic 28) · ×1
  • GeneratePresetsPopover.GeneratePresetsPopover (cyclomatic 28) invokeai/frontend/webv2/src/features/generation/ui/GeneratePresetsPopover.tsx:174 — GeneratePresetsPopover.GeneratePresetsPopover has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 13 of the 28 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 303, 242, 204, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · holdLease.startIntermediatesHoldLease (cyclomatic 28) · ×1
  • holdLease.startIntermediatesHoldLease (cyclomatic 28) invokeai/frontend/webv2/src/features/intermediates/holdLease.ts:32 — holdLease.startIntermediatesHoldLease has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 1 of the 28 points is its own statement and the rest belongs to 9 function items inside it that branch (sendOnce, bodyFor, send, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · modelSettingsIO.validateImportData (cyclomatic 28) · ×1
  • modelSettingsIO.validateImportData (cyclomatic 28) invokeai/frontend/webv2/src/features/models/core/modelSettingsIO.ts:78 — modelSettingsIO.validateImportData has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · workingMemory.deriveCalibrationProgress (cyclomatic 28) · ×1
  • workingMemory.deriveCalibrationProgress (cyclomatic 28) invokeai/frontend/webv2/src/features/models/core/workingMemory.ts:300 — workingMemory.deriveCalibrationProgress has cyclomatic complexity 28 (threshold 15). Of this number, 27 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · ModelEditForm.ModelEditForm (cyclomatic 28) · ×1
  • ModelEditForm.ModelEditForm (cyclomatic 28) invokeai/frontend/webv2/src/features/models/ui/detail/ModelEditForm.tsx:72 — ModelEditForm.ModelEditForm has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 9 of the 28 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 157, 134, 103, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · runtime.createQueueRuntime.handleUnadoptedRerunSettled (cyclomatic 28) · ×1
  • runtime.createQueueRuntime.handleUnadoptedRerunSettled (cyclomatic 28) invokeai/frontend/webv2/src/features/queue/runtime.ts:1733 — runtime.createQueueRuntime.handleUnadoptedRerunSettled has cyclomatic complexity 28 (threshold 15). Of this number, 16 points are the body's own statements and 12 belong to 4 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · coordinator.createQueueCoordinator.reconcile (cyclomatic 28) · ×1
  • coordinator.createQueueCoordinator.reconcile (cyclomatic 28) invokeai/frontend/webv2/src/features/queue/runtime/coordinator.ts:1080 — coordinator.createQueueCoordinator.reconcile has cyclomatic complexity 28 (threshold 15). Of this number, 16 points are the body's own statements and 12 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · QueueItemRow.QueueItemRow (cyclomatic 28) · ×1
  • QueueItemRow.QueueItemRow (cyclomatic 28) invokeai/frontend/webv2/src/features/queue/ui/QueueItemRow.tsx:30 — QueueItemRow.QueueItemRow has cyclomatic complexity 28 (threshold 15). Of this number, 24 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · settings.syncUpscaleWidgetValuesWithModels (cyclomatic 28) · ×1
  • settings.syncUpscaleWidgetValuesWithModels (cyclomatic 28) invokeai/frontend/webv2/src/features/upscale/core/settings.ts:861 — settings.syncUpscaleWidgetValuesWithModels has cyclomatic complexity 28 (threshold 15). Of this number, 24 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · graphToDocument.previewGraphToDocument (cyclomatic 28) · ×1
  • graphToDocument.previewGraphToDocument (cyclomatic 28) invokeai/frontend/webv2/src/features/workflow/core/graphToDocument.ts:36 — graphToDocument.previewGraphToDocument has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CropLayerController.cropAll (cyclomatic 28) · ×1
  • CropLayerController.cropAll (cyclomatic 28) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/cropLayerController.ts:282 — CropLayerController.cropAll has cyclomatic complexity 28 (threshold 15). Of this number, 27 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · documentIndex.deriveIndexForValueEdit (cyclomatic 28) · ×1
  • documentIndex.deriveIndexForValueEdit (cyclomatic 28) invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentIndex.ts:292 — documentIndex.deriveIndexForValueEdit has cyclomatic complexity 28 (threshold 15). Of this number, 21 points are the body's own statements and 7 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · rasterComposite.renderRasterComposite (cyclomatic 28) · ×1
  • rasterComposite.renderRasterComposite (cyclomatic 28) invokeai/frontend/webv2/src/workbench/canvas-engine/render/rasterComposite.ts:457 — rasterComposite.renderRasterComposite has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 1 of the 28 points is its own statement and the rest belongs to 6 function items inside it that branch (drawLayer, renderRange, drawSpatialScope, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · paletteQueryModel.derivePaletteQueryModel (cyclomatic 28) · ×1
  • paletteQueryModel.derivePaletteQueryModel (cyclomatic 28) invokeai/frontend/webv2/src/workbench/palette/paletteQueryModel.ts:31 — paletteQueryModel.derivePaletteQueryModel has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · StatusBar.CompactBottomWidget (cyclomatic 28) · ×1
  • StatusBar.CompactBottomWidget (cyclomatic 28) invokeai/frontend/webv2/src/workbench/shell/StatusBar.tsx:271 — StatusBar.CompactBottomWidget has cyclomatic complexity 28 (threshold 15). Of this number, 19 points are the body's own statements and 9 belong to 5 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Flux3DenoiseInvocation._run_diffusion (cyclomatic 27) · ×1
  • Flux3DenoiseInvocation._run_diffusion (cyclomatic 27) invokeai/app/invocations/flux3/flux3_denoise.py:115 — Flux3DenoiseInvocation._run_diffusion has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChildDependencyRecord._validate_relationship (cyclomatic 27) · ×1
  • ChildDependencyRecord._validate_relationship (cyclomatic 27) invokeai/app/services/shared/execution_engine/child.py:479 — ChildDependencyRecord._validate_relationship has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · graph_loop_topology._recognize_nested_iterate_sequence (cyclomatic 27) · ×1
  • graph_loop_topology._recognize_nested_iterate_sequence (cyclomatic 27) invokeai/app/services/shared/graph_loop_topology.py:370 — graph_loop_topology._recognize_nested_iterate_sequence has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _ExecutionNodeBuilder._create_nested_for_body_iteration (cyclomatic 27) · ×1
  • _ExecutionNodeBuilder._create_nested_for_body_iteration (cyclomatic 27) invokeai/app/services/shared/graph_materializer.py:894 — _ExecutionNodeBuilder._create_nested_for_body_iteration has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · color.restore_lightness (cyclomatic 27) · ×1
  • color.restore_lightness (cyclomatic 27) invokeai/backend/image_util/color.py:70 — color.restore_lightness has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ModelCache.put (cyclomatic 27) · ×1
  • ModelCache.put (cyclomatic 27) invokeai/backend/model_manager/load/model_cache/model_cache.py:902 — ModelCache.put has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · loaders.sdnq_sd_loader (cyclomatic 27) · ×1
  • loaders.sdnq_sd_loader (cyclomatic 27) invokeai/backend/quantization/sdnq/loaders.py:195 — loaders.sdnq_sd_loader has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · setDefaultSettings.addSetDefaultSettingsListener (cyclomatic 27) · ×1
  • setDefaultSettings.addSetDefaultSettingsListener (cyclomatic 27) invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/setDefaultSettings.ts:34 — setDefaultSettings.addSetDefaultSettingsListener has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 1 of the 27 points is its own statement and the rest belongs to one function literal inside it that branches (line 37). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · CurrentImagePreview.CurrentImagePreview (cyclomatic 27) · ×1
  • CurrentImagePreview.CurrentImagePreview (cyclomatic 27) invokeai/frontend/webv1/src/features/gallery/components/ImageViewer/CurrentImagePreview.tsx:30 — CurrentImagePreview.CurrentImagePreview has cyclomatic complexity 27 (threshold 15). Of this number, 15 points are the body's own statements and 12 belong to 3 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · connectorTopology.getConnectorDeletionSpliceConnections (cyclomatic 27) · ×1
  • connectorTopology.getConnectorDeletionSpliceConnections (cyclomatic 27) invokeai/frontend/webv1/src/features/nodes/store/util/connectorTopology.ts:108 — connectorTopology.getConnectorDeletionSpliceConnections has cyclomatic complexity 27 (threshold 15). Of this number, 18 points are the body's own statements and 9 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · buildSDXLGraph.buildSDXLGraph (cyclomatic 27) · ×1
  • buildSDXLGraph.buildSDXLGraph (cyclomatic 27) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildSDXLGraph.ts:41 — buildSDXLGraph.buildSDXLGraph has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · buildZImageGraph.buildZImageGraph (cyclomatic 27) · ×1
  • buildZImageGraph.buildZImageGraph (cyclomatic 27) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildZImageGraph.ts:49 — buildZImageGraph.buildZImageGraph has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · InstallJobRow.InstallJobRow (cyclomatic 27) · ×1
  • InstallJobRow.InstallJobRow (cyclomatic 27) invokeai/frontend/webv2/src/features/models/ui/install-queue/InstallJobRow.tsx:61 — InstallJobRow.InstallJobRow has cyclomatic complexity 27 (threshold 15). Of this number, 22 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · runtime.createQueueRuntime.initialize (cyclomatic 27) · ×1
  • runtime.createQueueRuntime.initialize (cyclomatic 27) invokeai/frontend/webv2/src/features/queue/runtime.ts:2439 — runtime.createQueueRuntime.initialize has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 5 of the 27 points are its own statements and the rest belongs to 3 function items inside it that branch (initializeProjects, a function literal at line 2485, a function literal at line 2504). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · templates.parseFieldType (cyclomatic 27) · ×1
  • templates.parseFieldType (cyclomatic 27) invokeai/frontend/webv2/src/features/workflow/data/templates.ts:71 — templates.parseFieldType has cyclomatic complexity 27 (threshold 15). Of this number, 26 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · NodeFieldControl.NodeFieldControl (cyclomatic 27) · ×1
  • NodeFieldControl.NodeFieldControl (cyclomatic 27) invokeai/frontend/webv2/src/features/workflow/ui/linear/NodeFieldControl.tsx:57 — NodeFieldControl.NodeFieldControl has cyclomatic complexity 27 (threshold 15). Of this number, 24 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · GeneratorFieldInput.GeneratorFieldInput (cyclomatic 27) · ×1
  • GeneratorFieldInput.GeneratorFieldInput (cyclomatic 27) invokeai/frontend/webv2/src/features/workflow/ui/fields/GeneratorFieldInput.tsx:396 — GeneratorFieldInput.GeneratorFieldInput has cyclomatic complexity 27 (threshold 15). Of this number, 20 points are the body's own statements and 7 belong to 5 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · draftStore.createMemoryProjectDraftStore.retargetAcknowledgedCopy (cyclomatic 27) · ×1
  • draftStore.createMemoryProjectDraftStore.retargetAcknowledgedCopy (cyclomatic 27) invokeai/frontend/webv2/src/workbench/projects/draftStore.ts:1355 — draftStore.createMemoryProjectDraftStore.retargetAcknowledgedCopy has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · restoreProjectMedia.restoreProjectMedia (cyclomatic 27) · ×1
  • restoreProjectMedia.restoreProjectMedia (cyclomatic 27) invokeai/frontend/webv2/src/workbench/projects/invk/restoreProjectMedia.ts:204 — restoreProjectMedia.restoreProjectMedia has cyclomatic complexity 27 (threshold 15). Of this number, 19 points are the body's own statements and 8 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ToolStripFlyout.ToolFamilyButton (cyclomatic 27) · ×1
  • ToolStripFlyout.ToolFamilyButton (cyclomatic 27) invokeai/frontend/webv2/src/workbench/widgets/canvas/ToolStripFlyout.tsx:49 — ToolStripFlyout.ToolFamilyButton has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 4 of the 27 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 118, 148, 96, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · StagedResultController.commit (cyclomatic 27) · ×1
  • StagedResultController.commit (cyclomatic 27) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/stagedResultController.ts:78 — StagedResultController.commit has cyclomatic complexity 27 (threshold 15). Of this number, 14 points are the body's own statements and 13 belong to 6 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · pointerPipeline.createPointerPipeline.onKeyDown (cyclomatic 27) · ×1
  • pointerPipeline.createPointerPipeline.onKeyDown (cyclomatic 27) invokeai/frontend/webv2/src/workbench/canvas-engine/input/pointerPipeline.ts:413 — pointerPipeline.createPointerPipeline.onKeyDown has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · groupSurfaceCache.createGroupSurfaceCache.damagedRegion (cyclomatic 27) · ×1
  • groupSurfaceCache.createGroupSurfaceCache.damagedRegion (cyclomatic 27) invokeai/frontend/webv2/src/workbench/canvas-engine/render/groupSurfaceCache.ts:566 — groupSurfaceCache.createGroupSurfaceCache.damagedRegion has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PreferencesPage.PreferencesPage (cyclomatic 27) · ×1
  • PreferencesPage.PreferencesPage (cyclomatic 27) invokeai/frontend/webv2/src/workbench/settings/PreferencesPage.tsx:30 — PreferencesPage.PreferencesPage has cyclomatic complexity 27 (threshold 15). Of this number, 19 points are the body's own statements and 8 belong to 6 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · recall_parameters.update_recall_parameters (cyclomatic 26) · ×1
  • recall_parameters.update_recall_parameters (cyclomatic 26) invokeai/app/api/routers/recall_parameters.py:380 — recall_parameters.update_recall_parameters has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ModelInstallService._restore_incomplete_installs (cyclomatic 26) · ×1
  • ModelInstallService._restore_incomplete_installs (cyclomatic 26) invokeai/app/services/model_install/model_install_default.py:337 — ModelInstallService._restore_incomplete_installs has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · graph_iterate_planner._get_body_iterate_collect_fan_in (cyclomatic 26) · ×1
  • graph_iterate_planner._get_body_iterate_collect_fan_in (cyclomatic 26) invokeai/app/services/shared/graph_iterate_planner.py:80 — graph_iterate_planner._get_body_iterate_collect_fan_in has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · graph_loop_topology._recognize_nested_iterate_chain (cyclomatic 26) · ×1
  • graph_loop_topology._recognize_nested_iterate_chain (cyclomatic 26) invokeai/app/services/shared/graph_loop_topology.py:263 — graph_loop_topology._recognize_nested_iterate_chain has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _ExecutionNodeBuilder.create_nested_for_return (cyclomatic 26) · ×1
  • _ExecutionNodeBuilder.create_nested_for_return (cyclomatic 26) invokeai/app/services/shared/graph_materializer.py:543 — _ExecutionNodeBuilder.create_nested_for_return has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · calibrate_flux_vae_working_memory.main (cyclomatic 26) · ×1
  • calibrate_flux_vae_working_memory.main (cyclomatic 26) scripts/calibrate_flux_vae_working_memory.py:150 — calibrate_flux_vae_working_memory.main has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GalleryImageGridPaged.GalleryImageGridPaged (cyclomatic 26) · ×1
  • GalleryImageGridPaged.GalleryImageGridPaged (cyclomatic 26) invokeai/frontend/webv1/src/features/gallery/components/GalleryImageGridPaged.tsx:13 — GalleryImageGridPaged.GalleryImageGridPaged has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 3 of the 26 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 36, 84, 67, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · RelatedModels.RelatedModels (cyclomatic 26) · ×1
  • RelatedModels.RelatedModels (cyclomatic 26) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/RelatedModels.tsx:108 — RelatedModels.RelatedModels has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 5 of the 26 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 162, 220, 246, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · QueueItemComponent.QueueItemComponent (cyclomatic 26) · ×1
  • QueueItemComponent.QueueItemComponent (cyclomatic 26) invokeai/frontend/webv1/src/features/queue/components/QueueList/QueueItemComponent.tsx:34 — QueueItemComponent.QueueItemComponent has cyclomatic complexity 26 (threshold 15). Of this number, 15 points are the body's own statements and 11 belong to 5 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · HotkeyListItem.HotkeyItem (cyclomatic 26) · ×1
  • HotkeyListItem.HotkeyItem (cyclomatic 26) invokeai/frontend/webv1/src/features/system/components/HotkeysModal/HotkeyListItem.tsx:92 — HotkeyListItem.HotkeyItem has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 3 of the 26 points are its own statements and the rest belongs to 8 function items inside it that branch (a function literal at line 151, renderHotkeyKeys, a function literal at line 116, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · mock-backend.filterGalleryItems (cyclomatic 26) · ×1
  • mock-backend.filterGalleryItems (cyclomatic 26) invokeai/frontend/webv2/scripts/mock-backend.mjs:793 — mock-backend.filterGalleryItems has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 1 of the 26 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 805, 848). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · react.createDeferredFontRuntime (cyclomatic 26) · ×1
  • react.createDeferredFontRuntime (cyclomatic 26) invokeai/frontend/webv2/src/features/fonts/react.tsx:32 — react.createDeferredFontRuntime has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 1 of the 26 points is its own statement and the rest belongs to 13 function items inside it that branch (a function literal at line 107, a function literal at line 132, a function literal at line 156, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · semanticImageQuery.parseGallerySemanticReference (cyclomatic 26) · ×1
  • semanticImageQuery.parseGallerySemanticReference (cyclomatic 26) invokeai/frontend/webv2/src/features/gallery/core/semanticImageQuery.ts:232 — semanticImageQuery.parseGallerySemanticReference has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · baseGenerationPolicies.getBaseComponentSectionPolicy (cyclomatic 26) · ×1
  • baseGenerationPolicies.getBaseComponentSectionPolicy (cyclomatic 26) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:1041 — baseGenerationPolicies.getBaseComponentSectionPolicy has cyclomatic complexity 26 (threshold 15). Of this number, 23 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SystemPromptsField.SystemPromptsField (cyclomatic 26) · ×1
  • SystemPromptsField.SystemPromptsField (cyclomatic 26) invokeai/frontend/webv2/src/features/generation/ui/promptFields/SystemPromptsField.tsx:101 — SystemPromptsField.SystemPromptsField has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 12 of the 26 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 141, 204, 130, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · ClearDialog.ClearDialog (cyclomatic 26) · ×1
  • ClearDialog.ClearDialog (cyclomatic 26) invokeai/frontend/webv2/src/features/intermediates/ui/ClearDialog.tsx:151 — ClearDialog.ClearDialog has cyclomatic complexity 26 (threshold 15). Of this number, 23 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · templates.buildInputTemplate (cyclomatic 26) · ×1
  • templates.buildInputTemplate (cyclomatic 26) invokeai/frontend/webv2/src/features/workflow/data/templates.ts:237 — templates.buildInputTemplate has cyclomatic complexity 26 (threshold 15). Of this number, 25 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · WorkflowFieldInput.VideoFrameIndexInput (cyclomatic 26) · ×1
  • WorkflowFieldInput.VideoFrameIndexInput (cyclomatic 26) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:1230 — WorkflowFieldInput.VideoFrameIndexInput has cyclomatic complexity 26 (threshold 15). Of this number, 19 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WorkflowFieldInput.WorkflowFieldInput (cyclomatic 26) · ×1
  • WorkflowFieldInput.WorkflowFieldInput (cyclomatic 26) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:1906 — WorkflowFieldInput.WorkflowFieldInput has cyclomatic complexity 26 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · layerPanelState.reconcileLayerPanelState (cyclomatic 26) · ×1
  • layerPanelState.reconcileLayerPanelState (cyclomatic 26) invokeai/frontend/webv2/src/workbench/layerPanelState.ts:204 — layerPanelState.reconcileLayerPanelState has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CanvasHeaderActions.CanvasHeaderActionsInner (cyclomatic 26) · ×1
  • CanvasHeaderActions.CanvasHeaderActionsInner (cyclomatic 26) invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasHeaderActions.tsx:104 — CanvasHeaderActions.CanvasHeaderActionsInner has cyclomatic complexity 26 (threshold 15). Of this number, 18 points are the body's own statements and 8 belong to 5 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · canvasToolCommands.executeCanvasToolCommand (cyclomatic 26) · ×1
  • canvasToolCommands.executeCanvasToolCommand (cyclomatic 26) invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasToolCommands.ts:77 — canvasToolCommands.executeCanvasToolCommand has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MissingFontsDialog.RecoveryRow (cyclomatic 26) · ×1
  • MissingFontsDialog.RecoveryRow (cyclomatic 26) invokeai/frontend/webv2/src/workbench/widgets/canvas/MissingFontsDialog.tsx:139 — MissingFontsDialog.RecoveryRow has cyclomatic complexity 26 (threshold 15). Of this number, 13 points are the body's own statements and 13 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · LayerMutationController.convertToControl (cyclomatic 26) · ×1
  • LayerMutationController.convertToControl (cyclomatic 26) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/layerMutationController.ts:484 — LayerMutationController.convertToControl has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · InvokeImageBlendInvocation.image_convert_with_xform (cyclomatic 25) · ×1
  • InvokeImageBlendInvocation.image_convert_with_xform (cyclomatic 25) invokeai/app/invocations/composition-nodes.py:449 — InvokeImageBlendInvocation.image_convert_with_xform has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · InvokeImageCompositorInvocation.invoke (cyclomatic 25) · ×1
  • InvokeImageCompositorInvocation.invoke (cyclomatic 25) invokeai/app/invocations/composition-nodes.py:1312 — InvokeImageCompositorInvocation.invoke has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · fonts_parsing.parse_font_bytes (cyclomatic 25) · ×1
  • fonts_parsing.parse_font_bytes (cyclomatic 25) invokeai/app/services/fonts/fonts_parsing.py:91 — fonts_parsing.parse_font_bytes has cyclomatic complexity 25 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · InstallStagingLedger._sweep_stale_claims_locked (cyclomatic 25) · ×1
  • InstallStagingLedger._sweep_stale_claims_locked (cyclomatic 25) invokeai/app/services/model_install/install_staging_ledger.py:689 — InstallStagingLedger._sweep_stale_claims_locked has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ModelInstallService._clear_pending_jobs (cyclomatic 25) · ×1
  • ModelInstallService._clear_pending_jobs (cyclomatic 25) invokeai/app/services/model_install/model_install_default.py:808 — ModelInstallService._clear_pending_jobs has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GraphExecutionState._build_execution_tokens (cyclomatic 25) · ×1
  • GraphExecutionState._build_execution_tokens (cyclomatic 25) invokeai/app/services/shared/graph.py:3027 — GraphExecutionState._build_execution_tokens has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _ExecutionNodeBuilder._get_sibling_iterate_if_collect_branches (cyclomatic 25) · ×1
  • _ExecutionNodeBuilder._get_sibling_iterate_if_collect_branches (cyclomatic 25) invokeai/app/services/shared/graph_materializer.py:1844 — _ExecutionNodeBuilder._get_sibling_iterate_if_collect_branches has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MistralEncoderCheckpointLoader._load_text_encoder (cyclomatic 25) · ×1
  • MistralEncoderCheckpointLoader._load_text_encoder (cyclomatic 25) REDACTED:1149 — MistralEncoderCheckpointLoader._load_text_encoder has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Qwen3EncoderSDNQLoader._load_from_sdnq (cyclomatic 25) · ×1
  • Qwen3EncoderSDNQLoader._load_from_sdnq (cyclomatic 25) invokeai/backend/model_manager/load/model_loaders/z_image.py:1624 — Qwen3EncoderSDNQLoader._load_from_sdnq has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · loaders._infer_quantization_type (cyclomatic 25) · ×1
  • loaders._infer_quantization_type (cyclomatic 25) invokeai/backend/quantization/sdnq/loaders.py:70 — loaders._infer_quantization_type has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SyncModelsDialog.SyncModelsDialog (cyclomatic 25) · ×1
  • SyncModelsDialog.SyncModelsDialog (cyclomatic 25) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelManagerPanel/SyncModelsDialog.tsx:36 — SyncModelsDialog.SyncModelsDialog has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 6 of the 25 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 56, 80, 111, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · useConnection.useConnection (cyclomatic 25) · ×1
  • useConnection.useConnection (cyclomatic 25) invokeai/frontend/webv1/src/features/nodes/hooks/useConnection.ts:27 — useConnection.useConnection has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 1 of the 25 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 33, 108). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · addOutpaint.addOutpaint (cyclomatic 25) · ×1
  • addOutpaint.addOutpaint (cyclomatic 25) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/addOutpaint.ts:39 — addOutpaint.addOutpaint has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · parseSchema.parseSchema.invocations (cyclomatic 25) · ×1
  • parseSchema.parseSchema.invocations (cyclomatic 25) invokeai/frontend/webv1/src/features/nodes/util/schema/parseSchema.ts:108 — parseSchema.parseSchema.invocations has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 4 of the 25 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 120, 200). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · run-graph._runGraph (cyclomatic 25) · ×1
  • run-graph._runGraph (cyclomatic 25) invokeai/frontend/webv1/src/services/api/run-graph.ts:152 — run-graph._runGraph has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 6 of the 25 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 327, onQueueItemStatusChanged, a function literal at line 216, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · mock-working-memory.createWorkingMemoryMock.linesOf (cyclomatic 25) · ×1
  • mock-working-memory.createWorkingMemoryMock.linesOf (cyclomatic 25) invokeai/frontend/webv2/scripts/mock-working-memory.mjs:470 — mock-working-memory.createWorkingMemoryMock.linesOf has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 1 of the 25 points is its own statement and the rest belongs to 5 function items inside it that branch (a function literal at line 483, a function literal at line 499, judged, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · tsSourceAnalysis.collectModuleReferences · ×1
  • tsSourceAnalysis.collectModuleReferences::visit (cyclomatic 25) invokeai/frontend/webv2/src/architecture/tsSourceAnalysis.ts:224 — tsSourceAnalysis.collectModuleReferences::visit has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · selection.getGalleryNavigationStep (cyclomatic 25) · ×1
  • selection.getGalleryNavigationStep (cyclomatic 25) invokeai/frontend/webv2/src/features/gallery/core/selection.ts:311 — selection.getGalleryNavigationStep has cyclomatic complexity 25 (threshold 15). Of this number, 18 points are the body's own statements and 7 belong to 2 function items inside it that branch. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · compileCanvasGraph.compileCanvasGraph (cyclomatic 25) · ×1
  • compileCanvasGraph.compileCanvasGraph (cyclomatic 25) invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.ts:1039 — compileCanvasGraph.compileCanvasGraph has cyclomatic complexity 25 (threshold 15). Of this number, 24 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PromptTextarea.PromptTextarea (cyclomatic 25) · ×1
  • PromptTextarea.PromptTextarea (cyclomatic 25) invokeai/frontend/webv2/src/features/generation/ui/promptFields/PromptTextarea.tsx:64 — PromptTextarea.PromptTextarea has cyclomatic complexity 25 (threshold 15). Of this number, 14 points are the body's own statements and 11 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · installsStore.refreshInstalls (cyclomatic 25) · ×1
  • installsStore.refreshInstalls (cyclomatic 25) invokeai/frontend/webv2/src/features/models/data/installsStore.ts:146 — installsStore.refreshInstalls has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 1 of the 25 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 152, 158, 231, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · runtime.createQueueRuntime.synchronizeRunPersistence (cyclomatic 25) · ×1
  • runtime.createQueueRuntime.synchronizeRunPersistence (cyclomatic 25) invokeai/frontend/webv2/src/features/queue/runtime.ts:1987 — runtime.createQueueRuntime.synchronizeRunPersistence has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · graph.buildWanVideoGraph (cyclomatic 25) · ×1
  • graph.buildWanVideoGraph (cyclomatic 25) invokeai/frontend/webv2/src/features/video/core/graph.ts:280 — graph.buildWanVideoGraph has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · GraphPreviewDialog.GraphPreviewDialog (cyclomatic 25) · ×1
  • GraphPreviewDialog.GraphPreviewDialog (cyclomatic 25) invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/GraphPreviewDialog.tsx:88 — GraphPreviewDialog.GraphPreviewDialog has cyclomatic complexity 25 (threshold 15). Of this number, 18 points are the body's own statements and 7 belong to 6 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · normalize.normalizeValue (cyclomatic 25) · ×1
  • normalize.normalizeValue (cyclomatic 25) invokeai/frontend/webv2/src/platform/logging/normalize.ts:123 — normalize.normalizeValue has cyclomatic complexity 25 (threshold 15). Of this number, 23 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · HsvBoxPicker.HsvBoxPicker (cyclomatic 25) · ×1
  • HsvBoxPicker.HsvBoxPicker (cyclomatic 25) invokeai/frontend/webv2/src/platform/ui/HsvBoxPicker.tsx:27 — HsvBoxPicker.HsvBoxPicker has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 8 of the 25 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 106, 127, 48, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · shortcutHints.getCanvasShortcutHints (cyclomatic 25) · ×1
  • shortcutHints.getCanvasShortcutHints (cyclomatic 25) invokeai/frontend/webv2/src/workbench/widgets/canvas/shortcutHints.ts:22 — shortcutHints.getCanvasShortcutHints has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ImageMapWidgetView.ImageMapWidgetView (cyclomatic 25) · ×1
  • ImageMapWidgetView.ImageMapWidgetView (cyclomatic 25) invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapWidgetView.tsx:73 — ImageMapWidgetView.ImageMapWidgetView has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PreviewDetailsPanel.PreviewDetailsPanel (cyclomatic 25) · ×1
  • PreviewDetailsPanel.PreviewDetailsPanel (cyclomatic 25) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewDetailsPanel.tsx:87 — PreviewDetailsPanel.PreviewDetailsPanel has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 12 of the 25 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 143, 112, 132, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · CopyLayerController.copy (cyclomatic 25) · ×1
  • CopyLayerController.copy (cyclomatic 25) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/copyLayerController.ts:85 — CopyLayerController.copy has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · workbenchStore.createCommands (cyclomatic 25) · ×1
  • workbenchStore.createCommands (cyclomatic 25) invokeai/frontend/webv2/src/workbench/workbenchStore.ts:87 — workbenchStore.createCommands has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 1 of the 25 points is its own statement and the rest belongs to 15 function literals inside it that branch (lines 428, 374, 460, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · SelectionPixelController.edit (cyclomatic 25) · ×1
  • SelectionPixelController.edit (cyclomatic 25) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/selectionPixelController.ts:133 — SelectionPixelController.edit has cyclomatic complexity 25 (threshold 15). Of this number, 22 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · widgetDnd.resolveWidgetDragEnd (cyclomatic 25) · ×1
  • widgetDnd.resolveWidgetDragEnd (cyclomatic 25) invokeai/frontend/webv2/src/workbench/widgetDnd.ts:224 — widgetDnd.resolveWidgetDragEnd has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ClusterStrengthField.ClusterStrengthField (cyclomatic 25) · ×1
  • ClusterStrengthField.ClusterStrengthField (cyclomatic 25) invokeai/frontend/webv2/src/workbench/widgets/image-map/ClusterStrengthField.tsx:40 — ClusterStrengthField.ClusterStrengthField has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 10 of the 25 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 144, 72, 115, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · ControlDetectionRow.ControlDetectionRow (cyclomatic 25) · ×1
  • ControlDetectionRow.ControlDetectionRow (cyclomatic 25) invokeai/frontend/webv2/src/workbench/widgets/layers/ControlDetectionRow.tsx:40 — ControlDetectionRow.ControlDetectionRow has cyclomatic complexity 25 (threshold 15). Of this number, 16 points are the body's own statements and 9 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ReferenceImageSettings.ReferenceImageEditor (cyclomatic 25) · ×1
  • ReferenceImageSettings.ReferenceImageEditor (cyclomatic 25) invokeai/frontend/webv2/src/workbench/widgets/layers/ReferenceImageSettings.tsx:225 — ReferenceImageSettings.ReferenceImageEditor has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 11 of the 25 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 278, 328, 291, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · video_recall.resolve_video_recall_parameters (cyclomatic 24) · ×1
  • video_recall.resolve_video_recall_parameters (cyclomatic 24) invokeai/app/api/routers/video_recall.py:295 — video_recall.resolve_video_recall_parameters has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · fields.InputField (cyclomatic 24) · ×1
  • fields.InputField (cyclomatic 24) invokeai/app/invocations/fields.py:934 — fields.InputField has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: fields.migrate_model_ui_type (cyclomatic 27) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · GraphExecutionState._coerce_execution_ref (cyclomatic 24) · ×1
  • GraphExecutionState._coerce_execution_ref (cyclomatic 24) invokeai/app/services/shared/graph.py:2310 — GraphExecutionState._coerce_execution_ref has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · graph_if_dependencies._can_use_fresh_literal_if_iterate_collect (cyclomatic 24) · ×1
  • graph_if_dependencies._can_use_fresh_literal_if_iterate_collect (cyclomatic 24) invokeai/app/services/shared/graph_if_dependencies.py:107 — graph_if_dependencies._can_use_fresh_literal_if_iterate_collect has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · user_management._modify_user_interactive (cyclomatic 24) · ×1
  • user_management._modify_user_interactive (cyclomatic 24) invokeai/app/util/user_management.py:449 — user_management._modify_user_interactive has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · calibrate_flux3_denoise_working_memory._summarize_fit (cyclomatic 24) · ×1
  • calibrate_flux3_denoise_working_memory._summarize_fit (cyclomatic 24) scripts/calibrate_flux3_denoise_working_memory.py:597 — calibrate_flux3_denoise_working_memory._summarize_fit has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Flow.Flow (cyclomatic 24) · ×1
  • Flow.Flow (cyclomatic 24) invokeai/frontend/webv1/src/features/nodes/components/flow/Flow.tsx:89 — Flow.Flow has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 3 of the 24 points are its own statements and the rest belongs to 13 function literals inside it that branch (lines 284, 342, 111, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · addInpaint.addInpaint (cyclomatic 24) · ×1
  • addInpaint.addInpaint (cyclomatic 24) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/addInpaint.ts:47 — addInpaint.addInpaint has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · buildKrea2Graph.buildKrea2Graph (cyclomatic 24) · ×1
  • buildKrea2Graph.buildKrea2Graph (cyclomatic 24) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildKrea2Graph.ts:29 — buildKrea2Graph.buildKrea2Graph has cyclomatic complexity 24 (threshold 15). Of this number, 17 points are the body's own statements and 7 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SettingsImageStorageMaintenance.SettingsImageStorageMaintenance (cyclomatic 24) · ×1
  • SettingsImageStorageMaintenance.SettingsImageStorageMaintenance (cyclomatic 24) invokeai/frontend/webv1/src/features/system/components/SettingsModal/SettingsImageStorageMaintenance.tsx:48 — SettingsImageStorageMaintenance.SettingsImageStorageMaintenance has cyclomatic complexity 24 (threshold 15). Of this number, 12 points are the body's own statements and 12 belong to 5 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · galleryStateView.getGallerySelectedImageQuery (cyclomatic 24) · ×1
  • galleryStateView.getGallerySelectedImageQuery (cyclomatic 24) invokeai/frontend/webv2/src/features/gallery/ui/galleryStateView.ts:336 — galleryStateView.getGallerySelectedImageQuery has cyclomatic complexity 24 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · PositivePromptActions.ExpandPromptButton (cyclomatic 24) · ×1
  • PositivePromptActions.ExpandPromptButton (cyclomatic 24) invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx:652 — PositivePromptActions.ExpandPromptButton has cyclomatic complexity 24 (threshold 15). Of this number, 19 points are the body's own statements and 5 belong to 4 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · settings.syncGenerateWidgetValuesWithModels (cyclomatic 24) · ×1
  • settings.syncGenerateWidgetValuesWithModels (cyclomatic 24) invokeai/frontend/webv2/src/features/generation/core/settings.ts:735 — settings.syncGenerateWidgetValuesWithModels has cyclomatic complexity 24 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · baseGenerationPolicies.getReferenceImageValidationIssues (cyclomatic 24) · ×1
  • baseGenerationPolicies.getReferenceImageValidationIssues (cyclomatic 24) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:2371 — baseGenerationPolicies.getReferenceImageValidationIssues has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 9 of the 24 points are its own statements and the rest belongs to one function literal inside it that branches (line 2397). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · dynamicPromptSyntax.scanDynamicPromptSyntax (cyclomatic 24) · ×1
  • dynamicPromptSyntax.scanDynamicPromptSyntax (cyclomatic 24) invokeai/frontend/webv2/src/features/generation/core/prompt/dynamicPromptSyntax.ts:57 — dynamicPromptSyntax.scanDynamicPromptSyntax has cyclomatic complexity 24 (threshold 15). Of this number, 22 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExternalProviderKeyCards.ExternalProviderKeyCard (cyclomatic 24) · ×1
  • ExternalProviderKeyCards.ExternalProviderKeyCard (cyclomatic 24) invokeai/frontend/webv2/src/features/models/ui/credentials/ExternalProviderKeyCards.tsx:103 — ExternalProviderKeyCards.ExternalProviderKeyCard has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 10 of the 24 points are its own statements and the rest belongs to 6 function items inside it that branch (handleSave, a function literal at line 127, a function literal at line 186, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · settings.sanitizeVideoReferences (cyclomatic 24) · ×1
  • settings.sanitizeVideoReferences (cyclomatic 24) invokeai/frontend/webv2/src/features/video/core/settings.ts:190 — settings.sanitizeVideoReferences has cyclomatic complexity 24 (threshold 15). Of this number, 21 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · workflowJson.parseWorkflowJson (cyclomatic 24) · ×1
  • workflowJson.parseWorkflowJson (cyclomatic 24) invokeai/frontend/webv2/src/features/workflow/core/workflowJson.ts:283 — workflowJson.parseWorkflowJson has cyclomatic complexity 24 (threshold 15). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · flowAdapters.toFlowNodes (cyclomatic 24) · ×1
  • flowAdapters.toFlowNodes (cyclomatic 24) invokeai/frontend/webv2/src/features/workflow/ui/editor/flowAdapters.ts:204 — flowAdapters.toFlowNodes has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 1 of the 24 points is its own statement and the rest belongs to one function literal inside it that branches (line 219). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · WorkflowSelectionRequestRuntime.WorkflowSelectionRequestRuntime (cyclomatic 24) · ×1
  • WorkflowSelectionRequestRuntime.WorkflowSelectionRequestRuntime (cyclomatic 24) invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowSelectionRequestRuntime.tsx:97 — WorkflowSelectionRequestRuntime.WorkflowSelectionRequestRuntime has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 1 of the 24 points is its own statement and the rest belongs to 6 function items inside it that branch (a function literal at line 171, a function literal at line 149, getRequestTargets, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · canvasProjectMutations.applyMoves (cyclomatic 24) · ×1
  • canvasProjectMutations.applyMoves (cyclomatic 24) invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts:368 — canvasProjectMutations.applyMoves has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 10 of the 24 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 409, survivingGroup, a function literal at line 434, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · RasterizeLayerController.rasterize (cyclomatic 24) · ×1
  • RasterizeLayerController.rasterize (cyclomatic 24) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/rasterizeLayerController.ts:72 — RasterizeLayerController.rasterize has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · psdExport.planPsdExport (cyclomatic 24) · ×1
  • psdExport.planPsdExport (cyclomatic 24) invokeai/frontend/webv2/src/workbench/canvas-engine/export/psdExport.ts:195 — psdExport.planPsdExport has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 11 of the 24 points are its own statements and the rest belongs to 2 function items inside it that branch (buildTree, walk). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · imageRecall.getMetadataModelTuning (cyclomatic 24) · ×1
  • imageRecall.getMetadataModelTuning (cyclomatic 24) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:539 — imageRecall.getMetadataModelTuning has cyclomatic complexity 24 (threshold 15). Of this number, 21 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: imageRecall.getImageRecallCapabilities (cyclomatic 38) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · imageRecall.getRefinerRecall (cyclomatic 24) · ×1
  • imageRecall.getRefinerRecall (cyclomatic 24) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:889 — imageRecall.getRefinerRecall has cyclomatic complexity 24 (threshold 15). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: imageRecall.getImageRecallCapabilities (cyclomatic 38) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · imageMapStore.refreshImageIndexStatus (cyclomatic 24) · ×1
  • imageMapStore.refreshImageIndexStatus (cyclomatic 24) invokeai/frontend/webv2/src/workbench/image-map/imageMapStore.ts:424 — imageMapStore.refreshImageIndexStatus has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 2 of the 24 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 437, 496). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · exportProject.executeInvkExport (cyclomatic 24) · ×1
  • exportProject.executeInvkExport (cyclomatic 24) invokeai/frontend/webv2/src/workbench/projects/invk/exportProject.ts:148 — exportProject.executeInvkExport has cyclomatic complexity 24 (threshold 15). Of this number, 15 points are the body's own statements and 9 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · controlPanelModel.deriveDetection (cyclomatic 24) · ×1
  • controlPanelModel.deriveDetection (cyclomatic 24) invokeai/frontend/webv2/src/workbench/widgets/layers/controlPanelModel.ts:148 — controlPanelModel.deriveDetection has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Krea2LoRACollectionLoader.invoke (cyclomatic 23) · ×1
  • Krea2LoRACollectionLoader.invoke (cyclomatic 23) invokeai/app/invocations/krea2/krea2_lora_loader.py:132 — Krea2LoRACollectionLoader.invoke has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · graph_loop_topology._recognize_nested_iterate_body (cyclomatic 23) · ×1
  • graph_loop_topology._recognize_nested_iterate_body (cyclomatic 23) invokeai/app/services/shared/graph_loop_topology.py:187 — graph_loop_topology._recognize_nested_iterate_body has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · quantized_loading.load_bnb4bit_state_dict (cyclomatic 23) · ×1
  • quantized_loading.load_bnb4bit_state_dict (cyclomatic 23) invokeai/backend/ideogram4/quantized_loading.py:67 — quantized_loading.load_bnb4bit_state_dict has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · flux2_state_dict_utils._convert_flux2_double_block_key (cyclomatic 23) · ×1
  • flux2_state_dict_utils._convert_flux2_double_block_key (cyclomatic 23) invokeai/backend/model_manager/load/model_loaders/flux2_state_dict_utils.py:61 — flux2_state_dict_utils._convert_flux2_double_block_key has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Krea2CheckpointModel._load_from_singlefile (cyclomatic 23) · ×1
  • Krea2CheckpointModel._load_from_singlefile (cyclomatic 23) invokeai/backend/model_manager/load/model_loaders/krea2.py:541 — Krea2CheckpointModel._load_from_singlefile has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · model_util.calc_model_size_by_fs (cyclomatic 23) · ×1
  • model_util.calc_model_size_by_fs (cyclomatic 23) invokeai/backend/model_manager/load/model_util.py:118 — model_util.calc_model_size_by_fs has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PidDistillModel.generate_samples_from_batch (cyclomatic 23) · ×1
  • PidDistillModel.generate_samples_from_batch (cyclomatic 23) invokeai/backend/pid/_src/models/pid_distill_model.py:168 — PidDistillModel.generate_samples_from_batch has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · nvfp4.find_nvfp4_layers (cyclomatic 23) · ×1
  • nvfp4.find_nvfp4_layers (cyclomatic 23) invokeai/backend/quantization/nvfp4.py:196 — nvfp4.find_nvfp4_layers has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · sage_attention._ineligible (cyclomatic 23) · ×1
  • sage_attention._ineligible (cyclomatic 23) invokeai/backend/util/sage_attention.py:186 — sage_attention._ineligible has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · build_shipped.main (cyclomatic 23) · ×1
  • build_shipped.main (cyclomatic 23) scripts/working_memory/build_shipped.py:776 — build_shipped.main has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChangeBoardModal.ChangeBoardModal (cyclomatic 23) · ×1
  • ChangeBoardModal.ChangeBoardModal (cyclomatic 23) invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:40 — ChangeBoardModal.ChangeBoardModal has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 2 of the 23 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 87, 59, 182, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · GalleryImageGrid.useKeyboardNavigation (cyclomatic 23) · ×1
  • GalleryImageGrid.useKeyboardNavigation (cyclomatic 23) invokeai/frontend/webv1/src/features/gallery/components/GalleryImageGrid.tsx:135 — GalleryImageGrid.useKeyboardNavigation has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 1 of the 23 points is its own statement and the rest belongs to one function literal inside it that branches (line 144). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · LoRASelect.LoRASelect (cyclomatic 23) · ×1
  • LoRASelect.LoRASelect (cyclomatic 23) invokeai/frontend/webv1/src/features/lora/components/LoRASelect.tsx:19 — LoRASelect.LoRASelect has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 2 of the 23 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 33, 88, 29, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · buildAnimaGraph.buildAnimaGraph (cyclomatic 23) · ×1
  • buildAnimaGraph.buildAnimaGraph (cyclomatic 23) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildAnimaGraph.ts:32 — buildAnimaGraph.buildAnimaGraph has cyclomatic complexity 23 (threshold 15). Of this number, 22 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ModelPicker.ModelPicker (cyclomatic 23) · ×1
  • ModelPicker.ModelPicker (cyclomatic 23) invokeai/frontend/webv1/src/features/parameters/components/ModelPicker.tsx:166 — ModelPicker.ModelPicker has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 1 of the 23 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 202, 287, 211, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · QueueItemDetail.QueueItemComponent (cyclomatic 23) · ×1
  • QueueItemDetail.QueueItemComponent (cyclomatic 23) invokeai/frontend/webv1/src/features/queue/components/QueueList/QueueItemDetail.tsx:24 — QueueItemDetail.QueueItemComponent has cyclomatic complexity 23 (threshold 15). Of this number, 15 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · QueueRuntimeAdapter.QueueRuntimeAdapter (cyclomatic 23) · ×1
  • QueueRuntimeAdapter.QueueRuntimeAdapter (cyclomatic 23) invokeai/frontend/webv2/src/app/QueueRuntimeAdapter.tsx:25 — QueueRuntimeAdapter.QueueRuntimeAdapter has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 1 of the 23 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 40, 163, 74, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · settings.normalizeReferenceImageConfig (cyclomatic 23) · ×1
  • settings.normalizeReferenceImageConfig (cyclomatic 23) invokeai/frontend/webv2/src/features/generation/core/settings.ts:413 — settings.normalizeReferenceImageConfig has cyclomatic complexity 23 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · ReferenceImageCard.ReferenceImageCardBase (cyclomatic 23) · ×1
  • ReferenceImageCard.ReferenceImageCardBase (cyclomatic 23) invokeai/frontend/webv2/src/features/generation/ui/reference-images/ReferenceImageCard.tsx:84 — ReferenceImageCard.ReferenceImageCardBase has cyclomatic complexity 23 (threshold 15). Of this number, 21 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GenerateProviderOptionsSection.GenerateProviderOptionsSection (cyclomatic 23) · ×1
  • GenerateProviderOptionsSection.GenerateProviderOptionsSection (cyclomatic 23) invokeai/frontend/webv2/src/features/generation/ui/GenerateProviderOptionsSection.tsx:50 — GenerateProviderOptionsSection.GenerateProviderOptionsSection has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 11 of the 23 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 99, 165, 213, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · UserFormDialog.UserForm (cyclomatic 23) · ×1
  • UserFormDialog.UserForm (cyclomatic 23) invokeai/frontend/webv2/src/features/identity/ui/UserFormDialog.tsx:76 — UserFormDialog.UserForm has cyclomatic complexity 23 (threshold 15). Of this number, 12 points are the body's own statements and 11 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · useCleanupDialog.useCleanupDialog.confirm (cyclomatic 23) · ×1
  • useCleanupDialog.useCleanupDialog.confirm (cyclomatic 23) invokeai/frontend/webv2/src/features/intermediates/ui/useCleanupDialog.ts:85 — useCleanupDialog.useCleanupDialog.confirm has cyclomatic complexity 23 (threshold 15). Of this number, 14 points are the body's own statements and 9 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · batch.readProperty (cyclomatic 23) · ×1
  • batch.readProperty (cyclomatic 23) invokeai/frontend/webv2/src/features/workflow/core/batch.ts:301 — batch.readProperty has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SettingControl.SettingControl (cyclomatic 23) · ×1
  • SettingControl.SettingControl (cyclomatic 23) invokeai/frontend/webv2/src/platform/ui/settings/SettingControl.tsx:25 — SettingControl.SettingControl has cyclomatic complexity 23 (threshold 15). Of this number, 19 points are the body's own statements and 4 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · useLayerStackActions.useLayerStackActions (cyclomatic 23) · ×1
  • useLayerStackActions.useLayerStackActions (cyclomatic 23) invokeai/frontend/webv2/src/workbench/widgets/layers/useLayerStackActions.ts:47 — useLayerStackActions.useLayerStackActions has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 2 of the 23 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 78, 117, 70, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · TransformPane.ConnectedTransform (cyclomatic 23) · ×1
  • TransformPane.ConnectedTransform (cyclomatic 23) invokeai/frontend/webv2/src/workbench/widgets/layers/panes/TransformPane.tsx:56 — TransformPane.ConnectedTransform has cyclomatic complexity 23 (threshold 15). Of this number, 14 points are the body's own statements and 9 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · workbenchState.assembleWorkbenchProject (cyclomatic 23) · ×1
  • workbenchState.assembleWorkbenchProject (cyclomatic 23) invokeai/frontend/webv2/src/workbench/workbenchState.ts:2076 — workbenchState.assembleWorkbenchProject has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · focusRegions.createWorkbenchFocusController.focusAdjacentRegion (cyclomatic 23) · ×1
  • focusRegions.createWorkbenchFocusController.focusAdjacentRegion (cyclomatic 23) invokeai/frontend/webv2/src/workbench/focusRegions.tsx:220 — focusRegions.createWorkbenchFocusController.focusAdjacentRegion has cyclomatic complexity 23 (threshold 15). Of this number, 15 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · alphaFill.propagateNearestVisibleLabels (cyclomatic 23) · ×1
  • alphaFill.propagateNearestVisibleLabels (cyclomatic 23) invokeai/frontend/webv2/src/workbench/canvas-engine/render/spatial/alphaFill.ts:28 — alphaFill.propagateNearestVisibleLabels has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ControlModelRow.ControlModelRow (cyclomatic 23) · ×1
  • ControlModelRow.ControlModelRow (cyclomatic 23) invokeai/frontend/webv2/src/workbench/widgets/layers/ControlModelRow.tsx:65 — ControlModelRow.ControlModelRow has cyclomatic complexity 23 (threshold 15). Of this number, 12 points are the body's own statements and 11 belong to 6 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · VideoConcatInvocation._build_audio_track (cyclomatic 22) · ×1
  • VideoConcatInvocation._build_audio_track (cyclomatic 22) invokeai/app/invocations/video_concat.py:699 — VideoConcatInvocation._build_audio_track has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExternalGenerationService._validate_request (cyclomatic 22) · ×1
  • ExternalGenerationService._validate_request (cyclomatic 22) invokeai/app/services/external_generation/external_generation_default.py:96 — ExternalGenerationService._validate_request has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _ExecutionNodeBuilder._create_serial_nested_iterate_body_iteration (cyclomatic 22) · ×1
  • _ExecutionNodeBuilder._create_serial_nested_iterate_body_iteration (cyclomatic 22) invokeai/app/services/shared/graph_materializer.py:771 — _ExecutionNodeBuilder._create_serial_nested_iterate_body_iteration has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Graph._validate_type_dependents_after_edge (cyclomatic 22) · ×1
  • Graph._validate_type_dependents_after_edge (cyclomatic 22) invokeai/app/services/shared/graph_validation.py:792 — Graph._validate_type_dependents_after_edge has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · sampling.build_ref2va_denoise_state (cyclomatic 22) · ×1
  • sampling.build_ref2va_denoise_state (cyclomatic 22) invokeai/backend/minimax_h3/sampling.py:290 — sampling.build_ref2va_denoise_state has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ZImageDiffusersModel._load_sdnq_text_encoder (cyclomatic 22) · ×1
  • ZImageDiffusersModel._load_sdnq_text_encoder (cyclomatic 22) invokeai/backend/model_manager/load/model_loaders/z_image.py:297 — ZImageDiffusersModel._load_sdnq_text_encoder has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · useImageUploadButton.useImageUploadButton (cyclomatic 22) · ×1
  • useImageUploadButton.useImageUploadButton (cyclomatic 22) invokeai/frontend/webv1/src/common/hooks/useImageUploadButton.tsx:68 — useImageUploadButton.useImageUploadButton has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 3 of the 22 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 89, 140, 83, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · LoginPage.LoginPage (cyclomatic 22) · ×1
  • LoginPage.LoginPage (cyclomatic 22) invokeai/frontend/webv1/src/features/auth/components/LoginPage.tsx:25 — LoginPage.LoginPage has cyclomatic complexity 22 (threshold 15). Of this number, 13 points are the body's own statements and 9 belong to 3 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · WorkflowFormPreview.WorkflowFormPreview (cyclomatic 22) · ×1
  • WorkflowFormPreview.WorkflowFormPreview (cyclomatic 22) invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:81 — WorkflowFormPreview.WorkflowFormPreview has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 7 of the 22 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 112, 93, 102). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · CanvasTextToolModule.commitSession (cyclomatic 22) · ×1
  • CanvasTextToolModule.commitSession (cyclomatic 22) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasTextToolModule.ts:361 — CanvasTextToolModule.commitSession has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CanvasToolModule.syncCursorStyle (cyclomatic 22) · ×1
  • CanvasToolModule.syncCursorStyle (cyclomatic 22) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasToolModule.ts:299 — CanvasToolModule.syncCursorStyle has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ModelSettingsImportButton.ModelSettingsImportButton (cyclomatic 22) · ×1
  • ModelSettingsImportButton.ModelSettingsImportButton (cyclomatic 22) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/ModelSettingsImportButton.tsx:16 — ModelSettingsImportButton.ModelSettingsImportButton has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 23, 129, 122). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · PromptTemplateEditor.PromptTemplateEditor (cyclomatic 22) · ×1
  • PromptTemplateEditor.PromptTemplateEditor (cyclomatic 22) invokeai/frontend/webv2/src/features/generation/ui/promptFields/PromptTemplateEditor.tsx:58 — PromptTemplateEditor.PromptTemplateEditor has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 8 of the 22 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 103, 81, 216, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · graphInputMedia.collectSubmissionInputMediaNames (cyclomatic 22) · ×1
  • graphInputMedia.collectSubmissionInputMediaNames (cyclomatic 22) invokeai/frontend/webv2/src/features/queue/core/graphInputMedia.ts:19 — graphInputMedia.collectSubmissionInputMediaNames has cyclomatic complexity 22 (threshold 15). Of this number, 15 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · videoPolicies.getVideoComponentSectionPolicy (cyclomatic 22) · ×1
  • videoPolicies.getVideoComponentSectionPolicy (cyclomatic 22) invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:1510 — videoPolicies.getVideoComponentSectionPolicy has cyclomatic complexity 22 (threshold 15). Of this number, 14 points are the body's own statements and 8 belong to 7 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · batch.resolveWorkflowGeneratorValue (cyclomatic 22) · ×1
  • batch.resolveWorkflowGeneratorValue (cyclomatic 22) invokeai/frontend/webv2/src/features/workflow/core/batch.ts:556 — batch.resolveWorkflowGeneratorValue has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · layerWorkflow.buildLayerWorkflowGraph (cyclomatic 22) · ×1
  • layerWorkflow.buildLayerWorkflowGraph (cyclomatic 22) invokeai/frontend/webv2/src/features/workflow/core/layerWorkflow.ts:204 — layerWorkflow.buildLayerWorkflowGraph has cyclomatic complexity 22 (threshold 15). Of this number, 20 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · WorkflowFieldInput.useMediaUpload.onFileChange (cyclomatic 22) · ×1
  • WorkflowFieldInput.useMediaUpload.onFileChange (cyclomatic 22) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:685 — WorkflowFieldInput.useMediaUpload.onFileChange has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 6 of the 22 points are its own statements and the rest belongs to one function literal inside it that branches (line 710). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · WorkflowFieldInput.MediaInput (cyclomatic 22) · ×1
  • WorkflowFieldInput.MediaInput (cyclomatic 22) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:1044 — WorkflowFieldInput.MediaInput has cyclomatic complexity 22 (threshold 15). Of this number, 20 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · controlModelResolution.resolveControlModel (cyclomatic 22) · ×1
  • controlModelResolution.resolveControlModel (cyclomatic 22) invokeai/frontend/webv2/src/workbench/controlModelResolution.ts:100 — controlModelResolution.resolveControlModel has cyclomatic complexity 22 (threshold 15). Of this number, 15 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · StagingBar.StagingBar (cyclomatic 22) · ×1
  • StagingBar.StagingBar (cyclomatic 22) invokeai/frontend/webv2/src/workbench/widgets/canvas/StagingBar.tsx:121 — StagingBar.StagingBar has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (StagingBar.StagingBar::handleKeyDown) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · workbenchState.removeGalleryItemsFromAllProjects (cyclomatic 22) · ×1
  • workbenchState.removeGalleryItemsFromAllProjects (cyclomatic 22) invokeai/frontend/webv2/src/workbench/workbenchState.ts:3432 — workbenchState.removeGalleryItemsFromAllProjects has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 3 of the 22 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 3456, 3494, 3441, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · StructuralLayerController.beginPreview (cyclomatic 22) · ×1
  • StructuralLayerController.beginPreview (cyclomatic 22) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/structuralLayerController.ts:191 — StructuralLayerController.beginPreview has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 2 of the 22 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 225, a function literal at line 257, flushPending, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · fontLoader.createFontLoader.track (cyclomatic 22) · ×1
  • fontLoader.createFontLoader.track (cyclomatic 22) invokeai/frontend/webv2/src/workbench/canvas-engine/render/fontLoader.ts:265 — fontLoader.createFontLoader.track has cyclomatic complexity 22 (threshold 15). Of this number, 12 points are the body's own statements and 10 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · videoRecallRuntime.createVideoRecallRuntime · ×1
  • videoRecallRuntime.createVideoRecallRuntime::apply (cyclomatic 22) invokeai/frontend/webv2/src/workbench/image-actions/videoRecallRuntime.ts:145 — videoRecallRuntime.createVideoRecallRuntime::apply has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CommandPaletteDialog.CommandPaletteContent (cyclomatic 22) · ×1
  • CommandPaletteDialog.CommandPaletteContent (cyclomatic 22) invokeai/frontend/webv2/src/workbench/palette/CommandPaletteDialog.tsx:98 — CommandPaletteDialog.CommandPaletteContent has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · queueRunJournal.createIndexedDbQueueRunJournal.record (cyclomatic 22) · ×1
  • queueRunJournal.createIndexedDbQueueRunJournal.record (cyclomatic 22) invokeai/frontend/webv2/src/workbench/queue-integration/queueRunJournal.ts:381 — queueRunJournal.createIndexedDbQueueRunJournal.record has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · GenerationDevicesSettings.GenerationDevicesSettings (cyclomatic 22) · ×1
  • GenerationDevicesSettings.GenerationDevicesSettings (cyclomatic 22) invokeai/frontend/webv2/src/workbench/settings/GenerationDevicesSettings.tsx:24 — GenerationDevicesSettings.GenerationDevicesSettings has cyclomatic complexity 22 (threshold 15). Of this number, 15 points are the body's own statements and 7 belong to 5 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AdjustmentSettings.CurvesEditor (cyclomatic 22) · ×1
  • AdjustmentSettings.CurvesEditor (cyclomatic 22) invokeai/frontend/webv2/src/workbench/widgets/layers/AdjustmentSettings.tsx:710 — AdjustmentSettings.CurvesEditor has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 8 function literals inside it that branch (lines 810, 784, 840, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · MiniMaxH3ReferenceConditioningInvocation.invoke (cyclomatic 21) · ×1
  • MiniMaxH3ReferenceConditioningInvocation.invoke (cyclomatic 21) invokeai/app/invocations/minimax_h3/minimax_h3_reference.py:348 — MiniMaxH3ReferenceConditioningInvocation.invoke has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WanLatentsToVideoInvocation.invoke (cyclomatic 21) · ×1
  • WanLatentsToVideoInvocation.invoke (cyclomatic 21) invokeai/app/invocations/vae/wan_latents_to_video.py:98 — WanLatentsToVideoInvocation.invoke has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ExecutionPlan.from_snapshot (cyclomatic 21) · ×1
  • ExecutionPlan.from_snapshot (cyclomatic 21) invokeai/app/services/shared/execution_engine/scheduler.py:151 — ExecutionPlan.from_snapshot has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GraphExecutionState._record_continuation_effects (cyclomatic 21) · ×1
  • GraphExecutionState._record_continuation_effects (cyclomatic 21) invokeai/app/services/shared/graph.py:1841 — GraphExecutionState._record_continuation_effects has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · graph_if_runtime._get_effective_iteration_paths_for_edge (cyclomatic 21) · ×1
  • graph_if_runtime._get_effective_iteration_paths_for_edge (cyclomatic 21) invokeai/app/services/shared/graph_if_runtime.py:300 — graph_if_runtime._get_effective_iteration_paths_for_edge has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · denoise.denoise (cyclomatic 21) · ×1
  • denoise.denoise (cyclomatic 21) invokeai/backend/ltx2/denoise.py:621 — denoise.denoise has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · loaders.gguf_sd_loader (cyclomatic 21) · ×1
  • loaders.gguf_sd_loader (cyclomatic 21) invokeai/backend/quantization/gguf/loaders.py:290 — loaders.gguf_sd_loader has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TextLLMPipeline.run (cyclomatic 21) · ×1
  • TextLLMPipeline.run (cyclomatic 21) invokeai/backend/text_llm_pipeline.py:156 — TextLLMPipeline.run has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · addArchivedOrDeletedBoardListener.addArchivedOrDeletedBoardListener (cyclomatic 21) · ×1
  • addArchivedOrDeletedBoardListener.addArchivedOrDeletedBoardListener (cyclomatic 21) invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/addArchivedOrDeletedBoardListener.ts:19 — addArchivedOrDeletedBoardListener.addArchivedOrDeletedBoardListener has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 64, 26, 47, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · Picker.useKeyboardNavigation (cyclomatic 21) · ×1
  • Picker.useKeyboardNavigation (cyclomatic 21) invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx:386 — Picker.useKeyboardNavigation has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 407, 438, 470, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · RasterLayerCurvesAdjustmentsGraph.RasterLayerCurvesAdjustmentsGraph (cyclomatic 21) · ×1
  • RasterLayerCurvesAdjustmentsGraph.RasterLayerCurvesAdjustmentsGraph (cyclomatic 21) invokeai/frontend/webv1/src/features/controlLayers/components/RasterLayer/RasterLayerCurvesAdjustmentsGraph.tsx:240 — RasterLayerCurvesAdjustmentsGraph.RasterLayerCurvesAdjustmentsGraph has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to 9 function literals inside it that branch (lines 260, 306, 369, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · needsPixelBbox.objectStateNeedsPixelBbox (cyclomatic 21) · ×1
  • needsPixelBbox.objectStateNeedsPixelBbox (cyclomatic 21) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasObject/needsPixelBbox.ts:3 — needsPixelBbox.objectStateNeedsPixelBbox has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · PromptTriggerSelect.PromptTriggerSelect (cyclomatic 21) · ×1
  • PromptTriggerSelect.PromptTriggerSelect (cyclomatic 21) invokeai/frontend/webv1/src/features/prompt/PromptTriggerSelect.tsx:23 — PromptTriggerSelect.PromptTriggerSelect has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to 8 function literals inside it that branch (lines 67, 100, 140, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · GalleryUiAdapter.GalleryUiAdapterProvider (cyclomatic 21) · ×1
  • GalleryUiAdapter.GalleryUiAdapterProvider (cyclomatic 21) invokeai/frontend/webv2/src/app/GalleryUiAdapter.tsx:65 — GalleryUiAdapter.GalleryUiAdapterProvider has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to 8 function literals inside it that branch (lines 129, 161, 112, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · tsSourceAnalysis.collectTypographyLiterals · ×1
  • tsSourceAnalysis.collectTypographyLiterals::collectValue (cyclomatic 21) invokeai/frontend/webv2/src/architecture/tsSourceAnalysis.ts:329 — tsSourceAnalysis.collectTypographyLiterals::collectValue has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · galleryStateView.getGalleryStateView (cyclomatic 21) · ×1
  • galleryStateView.getGalleryStateView (cyclomatic 21) invokeai/frontend/webv2/src/features/gallery/ui/galleryStateView.ts:478 — galleryStateView.getGalleryStateView has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · graph.buildFlux2Graph (cyclomatic 21) · ×1
  • graph.buildFlux2Graph (cyclomatic 21) invokeai/frontend/webv2/src/features/generation/core/graph.ts:755 — graph.buildFlux2Graph has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ExternalSizeSelect.ExternalSizeSelect (cyclomatic 21) · ×1
  • ExternalSizeSelect.ExternalSizeSelect (cyclomatic 21) invokeai/frontend/webv2/src/features/generation/ui/shared/ExternalSizeSelect.tsx:44 — ExternalSizeSelect.ExternalSizeSelect has cyclomatic complexity 21 (threshold 15). Of this number, 16 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · GenerateModelCard.GenerateModelCard (cyclomatic 21) · ×1
  • GenerateModelCard.GenerateModelCard (cyclomatic 21) invokeai/frontend/webv2/src/features/generation/ui/GenerateModelCard.tsx:51 — GenerateModelCard.GenerateModelCard has cyclomatic complexity 21 (threshold 15). Of this number, 13 points are the body's own statements and 8 belong to 6 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · connectors.resolveLoopLinkagePath (cyclomatic 21) · ×1
  • connectors.resolveLoopLinkagePath (cyclomatic 21) invokeai/frontend/webv2/src/features/workflow/core/connectors.ts:56 — connectors.resolveLoopLinkagePath has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · fields.getWorkflowFieldInvalidReason (cyclomatic 21) · ×1
  • fields.getWorkflowFieldInvalidReason (cyclomatic 21) invokeai/frontend/webv2/src/features/workflow/core/fields.ts:465 — fields.getWorkflowFieldInvalidReason has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · modelRequirements.extractWorkflowModelRequirements (cyclomatic 21) · ×1
  • modelRequirements.extractWorkflowModelRequirements (cyclomatic 21) invokeai/frontend/webv2/src/features/workflow/core/modelRequirements.ts:193 — modelRequirements.extractWorkflowModelRequirements has cyclomatic complexity 21 (threshold 15). Of this number, 15 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WorkflowLibraryCard.WorkflowLibraryCard (cyclomatic 21) · ×1
  • WorkflowLibraryCard.WorkflowLibraryCard (cyclomatic 21) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryCard.tsx:86 — WorkflowLibraryCard.WorkflowLibraryCard has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ColorPicker.ColorPicker (cyclomatic 21) · ×1
  • ColorPicker.ColorPicker (cyclomatic 21) invokeai/frontend/webv2/src/platform/ui/ColorPicker.tsx:151 — ColorPicker.ColorPicker has cyclomatic complexity 21 (threshold 15). Of this number, 15 points are the body's own statements and 6 belong to 4 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · indexedDbDraftStore.createIndexedDbProjectDraftStore.readRetargetedCopy (cyclomatic 21) · ×1
  • indexedDbDraftStore.createIndexedDbProjectDraftStore.readRetargetedCopy (cyclomatic 21) invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:196 — indexedDbDraftStore.createIndexedDbProjectDraftStore.readRetargetedCopy has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to one function literal inside it that branches (line 200). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · indexedDbDraftStore.createIndexedDbProjectDraftStore.adopt (cyclomatic 21) · ×1
  • indexedDbDraftStore.createIndexedDbProjectDraftStore.adopt (cyclomatic 21) invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:364 — indexedDbDraftStore.createIndexedDbProjectDraftStore.adopt has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 4 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 370). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · projectHalves.joinProjectDocument (cyclomatic 21) · ×1
  • projectHalves.joinProjectDocument (cyclomatic 21) invokeai/frontend/webv2/src/workbench/projects/projectHalves.ts:157 — projectHalves.joinProjectDocument has cyclomatic complexity 21 (threshold 15). Of this number, 16 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ColorPane.ColorPane (cyclomatic 21) · ×1
  • ColorPane.ColorPane (cyclomatic 21) invokeai/frontend/webv2/src/workbench/widgets/layers/panes/ColorPane.tsx:44 — ColorPane.ColorPane has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 8 of the 21 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 54, 127, 89, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · PreviewFilmstrip.FilmstripLiveThumb (cyclomatic 21) · ×1
  • PreviewFilmstrip.FilmstripLiveThumb (cyclomatic 21) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFilmstrip.tsx:126 — PreviewFilmstrip.FilmstripLiveThumb has cyclomatic complexity 21 (threshold 15). Of this number, 15 points are the body's own statements and 6 belong to 4 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · workbenchState.isWidgetRegionState (cyclomatic 21) · ×1
  • workbenchState.isWidgetRegionState (cyclomatic 21) invokeai/frontend/webv2/src/workbench/workbenchState.ts:2570 — workbenchState.isWidgetRegionState has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: workbenchState.isLayoutPresetSnapshot (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · workbenchState.compileInvocationSnapshot (cyclomatic 21) · ×1
  • workbenchState.compileInvocationSnapshot (cyclomatic 21) invokeai/frontend/webv2/src/workbench/workbenchState.ts:3128 — workbenchState.compileInvocationSnapshot has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: workbenchState.isLayoutPresetSnapshot (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · workbenchStore.recordDiagnosticForAction (cyclomatic 21) · ×1
  • workbenchStore.recordDiagnosticForAction (cyclomatic 21) invokeai/frontend/webv2/src/workbench/workbenchStore.ts:786 — workbenchStore.recordDiagnosticForAction has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PixelEditController.beginMaterialized (cyclomatic 21) · ×1
  • PixelEditController.beginMaterialized (cyclomatic 21) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/controlPixelController.ts:351 — PixelEditController.beginMaterialized has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 10 of the 21 points are its own statements and the rest belongs to 4 function items inside it that branch (commit, a function literal at line 430, a function literal at line 454, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · selectObjectBridge.createSelectObjectBridge (cyclomatic 21) · ×1
  • selectObjectBridge.createSelectObjectBridge (cyclomatic 21) invokeai/frontend/webv2/src/workbench/canvas-engine/selectObjectBridge.ts:37 — selectObjectBridge.createSelectObjectBridge has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 73, 39, 38). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · selectionState.createSelectionState.commit (cyclomatic 21) · ×1
  • selectionState.createSelectionState.commit (cyclomatic 21) invokeai/frontend/webv2/src/workbench/canvas-engine/selection/selectionState.ts:264 — selectionState.createSelectionState.commit has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · firstPartyCommands.useRegisterFirstPartyCommands (cyclomatic 21) · ×1
  • firstPartyCommands.useRegisterFirstPartyCommands (cyclomatic 21) invokeai/frontend/webv2/src/workbench/hotkeys/firstPartyCommands.ts:103 — firstPartyCommands.useRegisterFirstPartyCommands has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to 9 function items inside it that branch (a function literal at line 252, recallSelectedImage, loadSelectedItemWorkflow, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · executeImageRecall.executeLoadMediaWorkflow (cyclomatic 21) · ×1
  • executeImageRecall.executeLoadMediaWorkflow (cyclomatic 21) invokeai/frontend/webv2/src/workbench/image-actions/executeImageRecall.ts:96 — executeImageRecall.executeLoadMediaWorkflow has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LayoutPresetStrip.PresetTab (cyclomatic 21) · ×1
  • LayoutPresetStrip.PresetTab (cyclomatic 21) invokeai/frontend/webv2/src/workbench/shell/topbar/LayoutPresetStrip.tsx:349 — LayoutPresetStrip.PresetTab has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 8 of the 21 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 429, 406, 372, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · session_queue.strip_missing_image_results (cyclomatic 20) · ×1
  • session_queue.strip_missing_image_results (cyclomatic 20) invokeai/app/api/routers/session_queue.py:81 — session_queue.strip_missing_image_results has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · baseinvocation.validate_fields (cyclomatic 20) · ×1
  • baseinvocation.validate_fields (cyclomatic 20) invokeai/app/invocations/baseinvocation.py:604 — baseinvocation.validate_fields has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · InvokeImageBlendInvocation.prepare_tensors_from_images (cyclomatic 20) · ×1
  • InvokeImageBlendInvocation.prepare_tensors_from_images (cyclomatic 20) invokeai/app/invocations/composition-nodes.py:515 — InvokeImageBlendInvocation.prepare_tensors_from_images has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ImageIndexService._worker_loop (cyclomatic 20) · ×1
  • ImageIndexService._worker_loop (cyclomatic 20) invokeai/app/services/image_index/image_index_default.py:1161 — ImageIndexService._worker_loop has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DefaultSessionRunner.run_node (cyclomatic 20) · ×1
  • DefaultSessionRunner.run_node (cyclomatic 20) invokeai/app/services/session_processor/session_processor_default.py:451 — DefaultSessionRunner.run_node has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · workflow_call_batch.build_batch_child_workflow_session_results (cyclomatic 20) · ×1
  • workflow_call_batch.build_batch_child_workflow_session_results (cyclomatic 20) invokeai/app/services/session_processor/workflow_call_batch.py:517 — workflow_call_batch.build_batch_child_workflow_session_results has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _ExecutionNodeBuilder._materialize_root_if_for_completed_collect_branch (cyclomatic 20) · ×1
  • _ExecutionNodeBuilder._materialize_root_if_for_completed_collect_branch (cyclomatic 20) invokeai/app/services/shared/graph_materializer.py:2247 — _ExecutionNodeBuilder._materialize_root_if_for_completed_collect_branch has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · graph_scheduler._prepare_deferred_nested_for_body (cyclomatic 20) · ×1
  • graph_scheduler._prepare_deferred_nested_for_body (cyclomatic 20) invokeai/app/services/shared/graph_scheduler.py:28 — graph_scheduler._prepare_deferred_nested_for_body has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · aac_splice.splice_soundtrack (cyclomatic 20) · ×1
  • aac_splice.splice_soundtrack (cyclomatic 20) invokeai/app/util/aac_splice.py:364 — aac_splice.splice_soundtrack has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Main_Diffusers_LTX2_Config.from_model_on_disk (cyclomatic 20) · ×1
  • Main_Diffusers_LTX2_Config.from_model_on_disk (cyclomatic 20) invokeai/backend/model_manager/configs/main.py:2079 — Main_Diffusers_LTX2_Config.from_model_on_disk has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · loaders.parse_gguf_convrot_markers (cyclomatic 20) · ×1
  • loaders.parse_gguf_convrot_markers (cyclomatic 20) invokeai/backend/quantization/gguf/loaders.py:165 — loaders.parse_gguf_convrot_markers has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · coefficients.resolve_coefficients (cyclomatic 20) · ×1
  • coefficients.resolve_coefficients (cyclomatic 20) invokeai/backend/working_memory/coefficients.py:221 — coefficients.resolve_coefficients has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · fit.fit_points (cyclomatic 20) · ×1
  • fit.fit_points (cyclomatic 20) invokeai/backend/working_memory/fit.py:544 — fit.fit_points has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · fit._lowest_rounded (cyclomatic 20) · ×1
  • fit._lowest_rounded (cyclomatic 20) invokeai/backend/working_memory/fit.py:843 — fit._lowest_rounded has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RefImageImage.RefImageImage (cyclomatic 20) · ×1
  • RefImageImage.RefImageImage (cyclomatic 20) invokeai/frontend/webv1/src/features/controlLayers/components/RefImage/RefImageImage.tsx:35 — RefImageImage.RefImageImage has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 7 of the 20 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 82, 59, 106, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · MainModelDefaultSettings.MainModelDefaultSettings (cyclomatic 20) · ×1
  • MainModelDefaultSettings.MainModelDefaultSettings (cyclomatic 20) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/MainModelDefaultSettings.tsx:50 — MainModelDefaultSettings.MainModelDefaultSettings has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 8 of the 20 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 84, 115). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · SettingsGenerationDevices.SettingsGenerationDevices (cyclomatic 20) · ×1
  • SettingsGenerationDevices.SettingsGenerationDevices (cyclomatic 20) invokeai/frontend/webv1/src/features/system/components/SettingsModal/SettingsGenerationDevices.tsx:39 — SettingsGenerationDevices.SettingsGenerationDevices has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 6 of the 20 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 79, 114, 128, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · tsSourceAnalysis.collectPublicExports (cyclomatic 20) · ×1
  • tsSourceAnalysis.collectPublicExports (cyclomatic 20) invokeai/frontend/webv2/src/architecture/tsSourceAnalysis.ts:164 — tsSourceAnalysis.collectPublicExports has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · useGalleryGridSelection.useGalleryGridSelection.selectItemRange (cyclomatic 20) · ×1
  • useGalleryGridSelection.useGalleryGridSelection.selectItemRange (cyclomatic 20) invokeai/frontend/webv2/src/features/gallery/ui/useGalleryGridSelection.ts:98 — useGalleryGridSelection.useGalleryGridSelection.selectItemRange has cyclomatic complexity 20 (threshold 15). Of this number, 12 points are the body's own statements and 8 belong to 4 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · addRegionalGuidance.addRegionalGuidance (cyclomatic 20) · ×1
  • addRegionalGuidance.addRegionalGuidance (cyclomatic 20) invokeai/frontend/webv2/src/features/generation/core/canvas/addRegionalGuidance.ts:386 — addRegionalGuidance.addRegionalGuidance has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ReferenceImageControls.IPAdapterControls (cyclomatic 20) · ×1
  • ReferenceImageControls.IPAdapterControls (cyclomatic 20) invokeai/frontend/webv2/src/features/generation/ui/reference-images/ReferenceImageControls.tsx:116 — ReferenceImageControls.IPAdapterControls has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 7 of the 20 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 167, 153, 183, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · baseGenerationPolicies.getReferenceImageConfigSupported (cyclomatic 20) · ×1
  • baseGenerationPolicies.getReferenceImageConfigSupported (cyclomatic 20) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:1637 — baseGenerationPolicies.getReferenceImageConfigSupported has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · ConditioningRebalanceBars.ConditioningRebalanceBars (cyclomatic 20) · ×1
  • ConditioningRebalanceBars.ConditioningRebalanceBars (cyclomatic 20) invokeai/frontend/webv2/src/features/generation/ui/shared/ConditioningRebalanceBars.tsx:100 — ConditioningRebalanceBars.ConditioningRebalanceBars has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 1 of the 20 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 162, 219, 115, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · GenerateRenderSection.GenerateRenderSection · ×1
  • GenerateRenderSection.GenerateRenderSection::renderFields (cyclomatic 20) invokeai/frontend/webv2/src/features/generation/ui/GenerateRenderSection.tsx:637 — GenerateRenderSection.GenerateRenderSection::renderFields has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · InstallProgressCell.useInstallProgressCaption (cyclomatic 20) · ×1
  • InstallProgressCell.useInstallProgressCaption (cyclomatic 20) invokeai/frontend/webv2/src/features/models/ui/install-queue/InstallProgressCell.tsx:38 — InstallProgressCell.useInstallProgressCaption has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · runtime.createQueueRuntime.handleItemsRetried (cyclomatic 20) · ×1
  • runtime.createQueueRuntime.handleItemsRetried (cyclomatic 20) invokeai/frontend/webv2/src/features/queue/runtime.ts:1613 — runtime.createQueueRuntime.handleItemsRetried has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · QueueHeaderActions.InvocationCacheSection (cyclomatic 20) · ×1
  • QueueHeaderActions.InvocationCacheSection (cyclomatic 20) invokeai/frontend/webv2/src/features/queue/ui/QueueHeaderActions.tsx:181 — QueueHeaderActions.InvocationCacheSection has cyclomatic complexity 20 (threshold 15). Of this number, 17 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · formFieldSettings.applyNodeFieldFormSettings (cyclomatic 20) · ×1
  • formFieldSettings.applyNodeFieldFormSettings (cyclomatic 20) invokeai/frontend/webv2/src/features/workflow/core/formFieldSettings.ts:224 — formFieldSettings.applyNodeFieldFormSettings has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · normalize.serializeErrorAtDepth (cyclomatic 20) · ×1
  • normalize.serializeErrorAtDepth (cyclomatic 20) invokeai/frontend/webv2/src/platform/logging/normalize.ts:296 — normalize.serializeErrorAtDepth has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · canvasProjectMutations.applyLayerStackMutation (cyclomatic 20) · ×1
  • canvasProjectMutations.applyLayerStackMutation (cyclomatic 20) invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts:457 — canvasProjectMutations.applyLayerStackMutation has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CanvasColorFeed.ColorSampleRouting (cyclomatic 20) · ×1
  • CanvasColorFeed.ColorSampleRouting (cyclomatic 20) invokeai/frontend/webv2/src/workbench/widgets/canvas/color-system/CanvasColorFeed.tsx:110 — CanvasColorFeed.ColorSampleRouting has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 1 of the 20 points is its own statement and the rest belongs to 4 function items inside it that branch (a function literal at line 143, a function literal at line 122, commitSourceColor, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · StagingBar.StagingBar · ×1
  • StagingBar.StagingBar::handleKeyDown (cyclomatic 20) invokeai/frontend/webv2/src/workbench/widgets/canvas/StagingBar.tsx:219 — StagingBar.StagingBar::handleKeyDown has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (StagingBar.StagingBar) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · ThumbnailController.draw (cyclomatic 20) · ×1
  • ThumbnailController.draw (cyclomatic 20) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/thumbnailController.ts:74 — ThumbnailController.draw has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · filterOperationSession.createFilterOperationSession.commit (cyclomatic 20) · ×1
  • filterOperationSession.createFilterOperationSession.commit (cyclomatic 20) invokeai/frontend/webv2/src/workbench/canvas-operations/filterOperationSession.ts:254 — filterOperationSession.createFilterOperationSession.commit has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · controlSourceActions.sendGalleryImageAsControl (cyclomatic 20) · ×1
  • controlSourceActions.sendGalleryImageAsControl (cyclomatic 20) invokeai/frontend/webv2/src/workbench/canvas-operations/controlSourceActions.ts:319 — controlSourceActions.sendGalleryImageAsControl has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · DiagnosticsPanel.DiagnosticsPanel (cyclomatic 20) · ×1
  • DiagnosticsPanel.DiagnosticsPanel (cyclomatic 20) invokeai/frontend/webv2/src/workbench/diagnostics/DiagnosticsPanel.tsx:128 — DiagnosticsPanel.DiagnosticsPanel has cyclomatic complexity 20 (threshold 15). Of this number, 10 points are the body's own statements and 10 belong to 8 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · unloadJournal.scenarios.createUnloadJournalServer (cyclomatic 20) · ×1
  • unloadJournal.scenarios.createUnloadJournalServer (cyclomatic 20) invokeai/frontend/webv2/src/workbench/projects/unloadJournal.scenarios.ts:25 — unloadJournal.scenarios.createUnloadJournalServer has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 1 of the 20 points is its own statement and the rest belongs to 6 function items inside it that branch (a function literal at line 124, a function literal at line 50, a function literal at line 97, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · QueueCluster.QueueCluster (cyclomatic 20) · ×1
  • QueueCluster.QueueCluster (cyclomatic 20) invokeai/frontend/webv2/src/workbench/shell/topbar/QueueCluster.tsx:54 — QueueCluster.QueueCluster has cyclomatic complexity 20 (threshold 15). Of this number, 17 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · QueueCluster.QueueTooltip (cyclomatic 20) · ×1
  • QueueCluster.QueueTooltip (cyclomatic 20) invokeai/frontend/webv2/src/workbench/shell/topbar/QueueCluster.tsx:307 — QueueCluster.QueueTooltip has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · board_images.remove_images_from_board (cyclomatic 19) · ×1
  • board_images.remove_images_from_board (cyclomatic 19) invokeai/app/api/routers/board_images.py:303 — board_images.remove_images_from_board has cyclomatic complexity 19 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · model_manager.get_is_installed (cyclomatic 19) · ×1
  • model_manager.get_is_installed (cyclomatic 19) invokeai/app/api/routers/model_manager.py:1484 — model_manager.get_is_installed has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ImageIndexService._process_projection (cyclomatic 19) · ×1
  • ImageIndexService._process_projection (cyclomatic 19) invokeai/app/services/image_index/image_index_default.py:1611 — ImageIndexService._process_projection has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ImageMoveService._complete_partial_filesystem_move (cyclomatic 19) · ×1
  • ImageMoveService._complete_partial_filesystem_move (cyclomatic 19) invokeai/app/services/image_moves/image_moves_default.py:463 — ImageMoveService._complete_partial_filesystem_move has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · DefaultSessionProcessor._process (cyclomatic 19) · ×1
  • DefaultSessionProcessor._process (cyclomatic 19) invokeai/app/services/session_processor/session_processor_default.py:1386 — DefaultSessionProcessor._process has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExecutionRef._accept_token_fields (cyclomatic 19) · ×1
  • ExecutionRef._accept_token_fields (cyclomatic 19) invokeai/app/services/shared/execution_effects.py:146 — ExecutionRef._accept_token_fields has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · execution_effects.normalize_persisted_execution_effects (cyclomatic 19) · ×1
  • execution_effects.normalize_persisted_execution_effects (cyclomatic 19) invokeai/app/services/shared/execution_effects.py:414 — execution_effects.normalize_persisted_execution_effects has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StreamBuffer._coerce_event (cyclomatic 19) · ×1
  • StreamBuffer._coerce_event (cyclomatic 19) invokeai/app/services/shared/execution_engine/primitives.py:322 — StreamBuffer._coerce_event has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · graph_iterate_planner._get_direct_iterate_collect_fan_in (cyclomatic 19) · ×1
  • graph_iterate_planner._get_direct_iterate_collect_fan_in (cyclomatic 19) invokeai/app/services/shared/graph_iterate_planner.py:26 — graph_iterate_planner._get_direct_iterate_collect_fan_in has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _ExecutionNodeBuilder._attach_pending_if_inputs (cyclomatic 19) · ×1
  • _ExecutionNodeBuilder._attach_pending_if_inputs (cyclomatic 19) invokeai/app/services/shared/graph_materializer.py:1934 — _ExecutionNodeBuilder._attach_pending_if_inputs has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · aac_splice._set_audio_edit (cyclomatic 19) · ×1
  • aac_splice._set_audio_edit (cyclomatic 19) invokeai/app/util/aac_splice.py:280 — aac_splice._set_audio_edit has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · h264_splice._sample_locations (cyclomatic 19) · ×1
  • h264_splice._sample_locations (cyclomatic 19) invokeai/app/util/h264_splice.py:273 — h264_splice._sample_locations has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · checkpoint_layout.classify_roles (cyclomatic 19) · ×1
  • checkpoint_layout.classify_roles (cyclomatic 19) invokeai/backend/ltx2/checkpoint_layout.py:96 — checkpoint_layout.classify_roles has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · StableDiffusionGeneratorPipeline._adjust_memory_efficient_attention (cyclomatic 19) · ×1
  • StableDiffusionGeneratorPipeline._adjust_memory_efficient_attention (cyclomatic 19) invokeai/backend/stable_diffusion/diffusers_pipeline.py:170 — StableDiffusionGeneratorPipeline._adjust_memory_efficient_attention has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · StableDiffusionGeneratorPipeline.step (cyclomatic 19) · ×1
  • StableDiffusionGeneratorPipeline.step (cyclomatic 19) invokeai/backend/stable_diffusion/diffusers_pipeline.py:438 — StableDiffusionGeneratorPipeline.step has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · calibrate_vae_tiling_working_memory._summarize (cyclomatic 19) · ×1
  • calibrate_vae_tiling_working_memory._summarize (cyclomatic 19) scripts/calibrate_vae_tiling_working_memory.py:561 — calibrate_vae_tiling_working_memory._summarize has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CanvasEntityGroupList.CanvasEntityGroupList (cyclomatic 19) · ×1
  • CanvasEntityGroupList.CanvasEntityGroupList (cyclomatic 19) invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/CanvasEntityGroupList.tsx:31 — CanvasEntityGroupList.CanvasEntityGroupList has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 7 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 37). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · RasterLayerCurvesAdjustmentsGraph.drawHistogram (cyclomatic 19) · ×1
  • RasterLayerCurvesAdjustmentsGraph.drawHistogram (cyclomatic 19) invokeai/frontend/webv1/src/features/controlLayers/components/RasterLayer/RasterLayerCurvesAdjustmentsGraph.tsx:63 — RasterLayerCurvesAdjustmentsGraph.drawHistogram has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RefImageSettings.RefImageSettingsContent (cyclomatic 19) · ×1
  • RefImageSettings.RefImageSettingsContent (cyclomatic 19) invokeai/frontend/webv1/src/features/controlLayers/components/RefImage/RefImageSettings.tsx:68 — RefImageSettings.RefImageSettingsContent has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · validators.getGlobalReferenceImageWarnings (cyclomatic 19) · ×1
  • validators.getGlobalReferenceImageWarnings (cyclomatic 19) invokeai/frontend/webv1/src/features/controlLayers/store/validators.ts:176 — validators.getGlobalReferenceImageWarnings has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ModelIdentifierFieldInputComponent.ModelIdentifierFieldInputComponent (cyclomatic 19) · ×1
  • ModelIdentifierFieldInputComponent.ModelIdentifierFieldInputComponent (cyclomatic 19) invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/ModelIdentifierFieldInputComponent.tsx:14 — ModelIdentifierFieldInputComponent.ModelIdentifierFieldInputComponent has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 43, 34, 19). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · dnd-hooks.useBuilderDndMonitor (cyclomatic 19) · ×1
  • dnd-hooks.useBuilderDndMonitor (cyclomatic 19) invokeai/frontend/webv1/src/features/nodes/components/sidePanel/builder/dnd-hooks.ts:203 — dnd-hooks.useBuilderDndMonitor has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 224, 223). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · WorkflowListItem.WorkflowListItem (cyclomatic 19) · ×1
  • WorkflowListItem.WorkflowListItem (cyclomatic 19) invokeai/frontend/webv1/src/features/nodes/components/sidePanel/workflow/WorkflowLibrary/WorkflowListItem.tsx:36 — WorkflowListItem.WorkflowListItem has cyclomatic complexity 19 (threshold 15). Of this number, 15 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · useNodeCopyPaste._pasteSelection (cyclomatic 19) · ×1
  • useNodeCopyPaste._pasteSelection (cyclomatic 19) invokeai/frontend/webv1/src/features/nodes/hooks/useNodeCopyPaste.ts:37 — useNodeCopyPaste._pasteSelection has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 6 of the 19 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 122, 59, 87, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · fieldValidators.validateNumberFieldCollectionValue (cyclomatic 19) · ×1
  • fieldValidators.validateNumberFieldCollectionValue (cyclomatic 19) invokeai/frontend/webv1/src/features/nodes/store/util/fieldValidators.ts:116 — fieldValidators.validateNumberFieldCollectionValue has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · fieldValidators.getFieldErrors (cyclomatic 19) · ×1
  • fieldValidators.getFieldErrors (cyclomatic 19) invokeai/frontend/webv1/src/features/nodes/store/util/fieldValidators.ts:214 — fieldValidators.getFieldErrors has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · settings.getGallerySettings (cyclomatic 19) · ×1
  • settings.getGallerySettings (cyclomatic 19) invokeai/frontend/webv2/src/features/gallery/core/settings.ts:205 — settings.getGallerySettings has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · GalleryProgressSection.GalleryProgressTile (cyclomatic 19) · ×1
  • GalleryProgressSection.GalleryProgressTile (cyclomatic 19) invokeai/frontend/webv2/src/features/gallery/ui/GalleryProgressSection.tsx:193 — GalleryProgressSection.GalleryProgressTile has cyclomatic complexity 19 (threshold 15). Of this number, 16 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ConceptRow.ConceptRowContent (cyclomatic 19) · ×1
  • ConceptRow.ConceptRowContent (cyclomatic 19) invokeai/frontend/webv2/src/features/generation/ui/shared/ConceptRow.tsx:170 — ConceptRow.ConceptRowContent has cyclomatic complexity 19 (threshold 15). Of this number, 16 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · referenceImage.resolveRatioDrag (cyclomatic 19) · ×1
  • referenceImage.resolveRatioDrag (cyclomatic 19) invokeai/frontend/webv2/src/features/generation/core/referenceImage.ts:361 — referenceImage.resolveRatioDrag has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · graph.buildSDGraph (cyclomatic 19) · ×1
  • graph.buildSDGraph (cyclomatic 19) invokeai/frontend/webv2/src/features/generation/core/graph.ts:323 — graph.buildSDGraph has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PromptParser.parseQuotedPromptFunction (cyclomatic 19) · ×1
  • PromptParser.parseQuotedPromptFunction (cyclomatic 19) invokeai/frontend/webv2/src/features/generation/core/prompt/ast.ts:410 — PromptParser.parseQuotedPromptFunction has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · attention.adjustNodes (cyclomatic 19) · ×1
  • attention.adjustNodes (cyclomatic 19) invokeai/frontend/webv2/src/features/generation/core/prompt/attention.ts:263 — attention.adjustNodes has cyclomatic complexity 19 (threshold 15). Of this number, 17 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GenerateConditioningRebalanceField.GenerateConditioningRebalanceField (cyclomatic 19) · ×1
  • GenerateConditioningRebalanceField.GenerateConditioningRebalanceField (cyclomatic 19) invokeai/frontend/webv2/src/features/generation/ui/GenerateConditioningRebalanceField.tsx:61 — GenerateConditioningRebalanceField.GenerateConditioningRebalanceField has cyclomatic complexity 19 (threshold 15). Of this number, 13 points are the body's own statements and 6 belong to 6 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PromptTemplatesPanel.PromptTemplatesPanel (cyclomatic 19) · ×1
  • PromptTemplatesPanel.PromptTemplatesPanel (cyclomatic 19) invokeai/frontend/webv2/src/features/generation/ui/promptFields/PromptTemplatesPanel.tsx:65 — PromptTemplatesPanel.PromptTemplatesPanel has cyclomatic complexity 19 (threshold 15). Of this number, 16 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WildcardTransferActions.WildcardTransferActions (cyclomatic 19) · ×1
  • WildcardTransferActions.WildcardTransferActions (cyclomatic 19) invokeai/frontend/webv2/src/features/generation/ui/promptFields/WildcardTransferActions.tsx:39 — WildcardTransferActions.WildcardTransferActions has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 3 of the 19 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 102, 62, 140, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · WorkingMemorySection.OutcomePanel (cyclomatic 19) · ×1
  • WorkingMemorySection.OutcomePanel (cyclomatic 19) invokeai/frontend/webv2/src/features/models/ui/detail/WorkingMemorySection.tsx:644 — WorkingMemorySection.OutcomePanel has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · utilityGraph.reconcileUtilityCompletedOutput (cyclomatic 19) · ×1
  • utilityGraph.reconcileUtilityCompletedOutput (cyclomatic 19) invokeai/frontend/webv2/src/features/queue/runtime/utilityGraph.ts:174 — utilityGraph.reconcileUtilityCompletedOutput has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · settings.clearDeletedVideoMedia (cyclomatic 19) · ×1
  • settings.clearDeletedVideoMedia (cyclomatic 19) invokeai/frontend/webv2/src/features/video/core/settings.ts:1107 — settings.clearDeletedVideoMedia has cyclomatic complexity 19 (threshold 15). Of this number, 17 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · connectors.resolveConnectorDeletionSource (cyclomatic 19) · ×1
  • connectors.resolveConnectorDeletionSource (cyclomatic 19) invokeai/frontend/webv2/src/features/workflow/core/connectors.ts:153 — connectors.resolveConnectorDeletionSource has cyclomatic complexity 19 (threshold 15). Of this number, 16 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · WorkflowFieldInput.BoardInput (cyclomatic 19) · ×1
  • WorkflowFieldInput.BoardInput (cyclomatic 19) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:517 — WorkflowFieldInput.BoardInput has cyclomatic complexity 19 (threshold 15). Of this number, 11 points are the body's own statements and 8 belong to 6 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · indexedDbDraftStore.createIndexedDbProjectDraftStore.settleAcknowledgement (cyclomatic 19) · ×1
  • indexedDbDraftStore.createIndexedDbProjectDraftStore.settleAcknowledgement (cyclomatic 19) invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:1125 — indexedDbDraftStore.createIndexedDbProjectDraftStore.settleAcknowledgement has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 6 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 1135). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · persistenceRuntime.createWorkbenchPersistenceRuntime.load (cyclomatic 19) · ×1
  • persistenceRuntime.createWorkbenchPersistenceRuntime.load (cyclomatic 19) invokeai/frontend/webv2/src/workbench/persistenceRuntime.ts:562 — persistenceRuntime.createWorkbenchPersistenceRuntime.load has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · runLayerWorkflow.runLayerWorkflow (cyclomatic 19) · ×1
  • runLayerWorkflow.runLayerWorkflow (cyclomatic 19) invokeai/frontend/webv2/src/workbench/widgets/layers/runLayerWorkflow.ts:119 — runLayerWorkflow.runLayerWorkflow has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · LayerMutationController.duplicate (cyclomatic 19) · ×1
  • LayerMutationController.duplicate (cyclomatic 19) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/layerMutationController.ts:147 — LayerMutationController.duplicate has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · documentIndex.updateNodeValues (cyclomatic 19) · ×1
  • documentIndex.updateNodeValues (cyclomatic 19) invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentIndex.ts:435 — documentIndex.updateNodeValues has cyclomatic complexity 19 (threshold 15). Of this number, 12 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SelectionImageController.replace (cyclomatic 19) · ×1
  • SelectionImageController.replace (cyclomatic 19) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/selectionImageController.ts:30 — SelectionImageController.replace has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MaskLayerController.clear (cyclomatic 19) · ×1
  • MaskLayerController.clear (cyclomatic 19) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/maskLayerController.ts:41 — MaskLayerController.clear has cyclomatic complexity 19 (threshold 15). Of this number, 16 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MaskLayerController.invert (cyclomatic 19) · ×1
  • MaskLayerController.invert (cyclomatic 19) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/maskLayerController.ts:98 — MaskLayerController.invert has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · bitmapStore.createBitmapStore.flushPendingUploads (cyclomatic 19) · ×1
  • bitmapStore.createBitmapStore.flushPendingUploads (cyclomatic 19) invokeai/frontend/webv2/src/workbench/canvas-engine/document/bitmapStore.ts:699 — bitmapStore.createBitmapStore.flushPendingUploads has cyclomatic complexity 19 (threshold 15). Of this number, 16 points are the body's own statements and 3 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · documentMirror.diffValueEdit (cyclomatic 19) · ×1
  • documentMirror.diffValueEdit (cyclomatic 19) invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentMirror.ts:168 — documentMirror.diffValueEdit has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · engine.createCanvasEngine · ×1
  • engine.createCanvasEngine::getDuplicateRasterPlan (cyclomatic 19) invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts:2325 — engine.createCanvasEngine::getDuplicateRasterPlan has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · paintTool.createPaintTool.onPointerDown (cyclomatic 19) · ×1
  • paintTool.createPaintTool.onPointerDown (cyclomatic 19) invokeai/frontend/webv2/src/workbench/canvas-engine/tools/paintTool.ts:322 — paintTool.createPaintTool.onPointerDown has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · selectObjectSession.createSelectObjectSession.update (cyclomatic 19) · ×1
  • selectObjectSession.createSelectObjectSession.update (cyclomatic 19) invokeai/frontend/webv2/src/workbench/canvas-operations/selectObjectSession.ts:535 — selectObjectSession.createSelectObjectSession.update has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · executeImageRecall.executeImageRecall (cyclomatic 19) · ×1
  • executeImageRecall.executeImageRecall (cyclomatic 19) invokeai/frontend/webv2/src/workbench/image-actions/executeImageRecall.ts:273 — executeImageRecall.executeImageRecall has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · queueRecallCache.createIndexedDbQueueRecallCache.put (cyclomatic 19) · ×1
  • queueRecallCache.createIndexedDbQueueRecallCache.put (cyclomatic 19) invokeai/frontend/webv2/src/workbench/queue-integration/queueRecallCache.ts:210 — queueRecallCache.createIndexedDbQueueRecallCache.put has cyclomatic complexity 19 (threshold 15). Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MaxQueueHistorySettings.MaxQueueHistorySettings (cyclomatic 19) · ×1
  • MaxQueueHistorySettings.MaxQueueHistorySettings (cyclomatic 19) invokeai/frontend/webv2/src/workbench/settings/MaxQueueHistorySettings.tsx:31 — MaxQueueHistorySettings.MaxQueueHistorySettings has cyclomatic complexity 19 (threshold 15). Of this number, 13 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CustomSettingsEditors.CustomSettingField (cyclomatic 19) · ×1
  • CustomSettingsEditors.CustomSettingField (cyclomatic 19) invokeai/frontend/webv2/src/workbench/settings/CustomSettingsEditors.tsx:224 — CustomSettingsEditors.CustomSettingField has cyclomatic complexity 19 (threshold 15). Of this number, 15 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · SettingsEntryView.SettingsEntryView (cyclomatic 19) · ×1
  • SettingsEntryView.SettingsEntryView (cyclomatic 19) invokeai/frontend/webv2/src/workbench/settings/SettingsEntryView.tsx:96 — SettingsEntryView.SettingsEntryView has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · videos.ingest_uploaded_video (cyclomatic 18) · ×1
  • videos.ingest_uploaded_video (cyclomatic 18) invokeai/app/api/routers/videos.py:431 — videos.ingest_uploaded_video has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · SocketIO._handle_queue_event (cyclomatic 18) · ×1
  • SocketIO._handle_queue_event (cyclomatic 18) invokeai/app/api/sockets.py:972 — SocketIO._handle_queue_event has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Flux2KleinLoRACollectionLoader.invoke (cyclomatic 18) · ×1
  • Flux2KleinLoRACollectionLoader.invoke (cyclomatic 18) invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:163 — Flux2KleinLoRACollectionLoader.invoke has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Krea2LoRALoaderInvocation.invoke (cyclomatic 18) · ×1
  • Krea2LoRALoaderInvocation.invoke (cyclomatic 18) invokeai/app/invocations/krea2/krea2_lora_loader.py:57 — Krea2LoRALoaderInvocation.invoke has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · VideoConcatInvocation.invoke (cyclomatic 18) · ×1
  • VideoConcatInvocation.invoke (cyclomatic 18) invokeai/app/invocations/video_concat.py:205 — VideoConcatInvocation.invoke has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · VideoConcatInvocation._execute_smart_render (cyclomatic 18) · ×1
  • VideoConcatInvocation._execute_smart_render (cyclomatic 18) invokeai/app/invocations/video_concat.py:378 — VideoConcatInvocation._execute_smart_render has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _ExpertSwapper.get (cyclomatic 18) · ×1
  • _ExpertSwapper.get (cyclomatic 18) invokeai/app/invocations/wan/wan_denoise.py:214 — _ExpertSwapper.get has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ZImageLoRACollectionLoader.invoke (cyclomatic 18) · ×1
  • ZImageLoRACollectionLoader.invoke (cyclomatic 18) invokeai/app/invocations/z_image/z_image_lora_loader.py:135 — ZImageLoRACollectionLoader.invoke has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GalleryMaintenanceService._archive_snapshot_files (cyclomatic 18) · ×1
  • GalleryMaintenanceService._archive_snapshot_files (cyclomatic 18) invokeai/app/services/gallery_maintenance/gallery_maintenance_default.py:735 — GalleryMaintenanceService._archive_snapshot_files has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ModelInstallService._restart_remote_download (cyclomatic 18) · ×1
  • ModelInstallService._restart_remote_download (cyclomatic 18) invokeai/app/services/model_install/model_install_default.py:1364 — ModelInstallService._restart_remote_download has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · WorkflowCallQueueLifecycle.apply_execution_effects (cyclomatic 18) · ×1
  • WorkflowCallQueueLifecycle.apply_execution_effects (cyclomatic 18) invokeai/app/services/session_processor/workflow_call_runtime.py:150 — WorkflowCallQueueLifecycle.apply_execution_effects has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChildDependencyRecord._record_completion (cyclomatic 18) · ×1
  • ChildDependencyRecord._record_completion (cyclomatic 18) invokeai/app/services/shared/execution_engine/child.py:638 — ChildDependencyRecord._record_completion has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GraphExecutionState._record_iterate_stream (cyclomatic 18) · ×1
  • GraphExecutionState._record_iterate_stream (cyclomatic 18) invokeai/app/services/shared/graph.py:1625 — GraphExecutionState._record_iterate_stream has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _IfActivationController._branch_sources (cyclomatic 18) · ×1
  • _IfActivationController._branch_sources (cyclomatic 18) invokeai/app/services/shared/graph_if_activation.py:26 — _IfActivationController._branch_sources has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · graph_if_runtime._validate_frame_axes (cyclomatic 18) · ×1
  • graph_if_runtime._validate_frame_axes (cyclomatic 18) invokeai/app/services/shared/graph_if_runtime.py:78 — graph_if_runtime._validate_frame_axes has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _ExecutionNodeBuilder._get_known_iteration_path (cyclomatic 18) · ×1
  • _ExecutionNodeBuilder._get_known_iteration_path (cyclomatic 18) invokeai/app/services/shared/graph_materializer.py:118 — _ExecutionNodeBuilder._get_known_iteration_path has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LLLiteModuleDiT.forward (cyclomatic 18) · ×1
  • LLLiteModuleDiT.forward (cyclomatic 18) invokeai/backend/anima/control_net_lllite.py:287 — LLLiteModuleDiT.forward has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Krea2MemoryEfficientAttnProcessor.__call__ (cyclomatic 18) · ×1
  • Krea2MemoryEfficientAttnProcessor.__call__ (cyclomatic 18) invokeai/backend/krea2/attention.py:127 — Krea2MemoryEfficientAttnProcessor.__call__ has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · denoise.build_denoise_state (cyclomatic 18) · ×1
  • denoise.build_denoise_state (cyclomatic 18) invokeai/backend/ltx2/denoise.py:278 — denoise.build_denoise_state has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · main._detect_wan_expert (cyclomatic 18) · ×1
  • main._detect_wan_expert (cyclomatic 18) invokeai/backend/model_manager/configs/main.py:2987 — main._detect_wan_expert has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · pid_decoder._int8_sidecar_keys (cyclomatic 18) · ×1
  • pid_decoder._int8_sidecar_keys (cyclomatic 18) invokeai/backend/model_manager/configs/pid_decoder.py:253 — pid_decoder._int8_sidecar_keys has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CachedModelWithPartialLoad.partial_load_to_vram_chunk (cyclomatic 18) · ×1
  • CachedModelWithPartialLoad.partial_load_to_vram_chunk (cyclomatic 18) invokeai/backend/model_manager/load/model_cache/cached_model/cached_model_with_partial_load.py:398 — CachedModelWithPartialLoad.partial_load_to_vram_chunk has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Flux2GGUFCheckpointModel._load_from_singlefile (cyclomatic 18) · ×1
  • Flux2GGUFCheckpointModel._load_from_singlefile (cyclomatic 18) invokeai/backend/model_manager/load/model_loaders/flux.py:1815 — Flux2GGUFCheckpointModel._load_from_singlefile has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · krea2._convert_krea2_native_to_diffusers (cyclomatic 18) · ×1
  • krea2._convert_krea2_native_to_diffusers (cyclomatic 18) invokeai/backend/model_manager/load/model_loaders/krea2.py:185 — krea2._convert_krea2_native_to_diffusers has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ZImageCheckpointModel._load_from_singlefile (cyclomatic 18) · ×1
  • ZImageCheckpointModel._load_from_singlefile (cyclomatic 18) invokeai/backend/model_manager/load/model_loaders/z_image.py:482 — ZImageCheckpointModel._load_from_singlefile has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · layout._compile_draft_item (cyclomatic 18) · ×1
  • layout._compile_draft_item (cyclomatic 18) invokeai/backend/moss_image/layout.py:233 — layout._compile_draft_item has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · int8_convrot.reject_unmarked_int8_weights (cyclomatic 18) · ×1
  • int8_convrot.reject_unmarked_int8_weights (cyclomatic 18) invokeai/backend/quantization/int8_convrot.py:736 — int8_convrot.reject_unmarked_int8_weights has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · calibrate_z_image_working_memory._summarize_fit (cyclomatic 18) · ×1
  • calibrate_z_image_working_memory._summarize_fit (cyclomatic 18) scripts/calibrate_z_image_working_memory.py:405 — calibrate_z_image_working_memory._summarize_fit has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RefImagePreview.RefImagePreview (cyclomatic 18) · ×1
  • RefImagePreview.RefImagePreview (cyclomatic 18) invokeai/frontend/webv1/src/features/controlLayers/components/RefImage/RefImagePreview.tsx:79 — RefImagePreview.RefImagePreview has cyclomatic complexity 18 (threshold 15). Of this number, 14 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CanvasEntityAdapterInpaintMask.sync (cyclomatic 18) · ×1
  • CanvasEntityAdapterInpaintMask.sync (cyclomatic 18) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityAdapterInpaintMask.ts:31 — CanvasEntityAdapterInpaintMask.sync has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CanvasEntityAdapterRasterLayer.sync (cyclomatic 18) · ×1
  • CanvasEntityAdapterRasterLayer.sync (cyclomatic 18) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityAdapterRasterLayer.ts:56 — CanvasEntityAdapterRasterLayer.sync has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CanvasEntityAdapterRegionalGuidance.sync (cyclomatic 18) · ×1
  • CanvasEntityAdapterRegionalGuidance.sync (cyclomatic 18) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityAdapterRegionalGuidance.ts:31 — CanvasEntityAdapterRegionalGuidance.sync has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · validators.getControlLayerWarnings (cyclomatic 18) · ×1
  • validators.getControlLayerWarnings (cyclomatic 18) invokeai/frontend/webv1/src/features/controlLayers/store/validators.ts:266 — validators.getControlLayerWarnings has cyclomatic complexity 18 (threshold 15). Of this number, 15 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · modelSettingsIO.buildExportData (cyclomatic 18) · ×1
  • modelSettingsIO.buildExportData (cyclomatic 18) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/modelSettingsIO.ts:37 — modelSettingsIO.buildExportData has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · graphBuilderUtils.getDenoisingStartAndEnd (cyclomatic 18) · ×1
  • graphBuilderUtils.getDenoisingStartAndEnd (cyclomatic 18) invokeai/frontend/webv1/src/features/nodes/util/graph/graphBuilderUtils.ts:228 — graphBuilderUtils.getDenoisingStartAndEnd has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · buildFLUXGraph.buildFLUXGraph · ×1
  • buildFLUXGraph.buildFLUXGraph::addFlux2Features (cyclomatic 18) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildFLUXGraph.ts:388 — buildFLUXGraph.buildFLUXGraph::addFlux2Features has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (buildFLUXGraph.buildFLUXGraph) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · ParamPositivePrompt.ParamPositivePrompt (cyclomatic 18) · ×1
  • ParamPositivePrompt.ParamPositivePrompt (cyclomatic 18) invokeai/frontend/webv1/src/features/parameters/components/Core/ParamPositivePrompt.tsx:147 — ParamPositivePrompt.ParamPositivePrompt has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 5 of the 18 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 199, 291, 163, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · SettingsGenerationDevices.DeviceTag (cyclomatic 18) · ×1
  • SettingsGenerationDevices.DeviceTag (cyclomatic 18) invokeai/frontend/webv1/src/features/system/components/SettingsModal/SettingsGenerationDevices.tsx:208 — SettingsGenerationDevices.DeviceTag has cyclomatic complexity 18 (threshold 15). Of this number, 13 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · use-collapsible-gridview-panel.useCollapsibleGridviewPanel (cyclomatic 18) · ×1
  • use-collapsible-gridview-panel.useCollapsibleGridviewPanel (cyclomatic 18) invokeai/frontend/webv1/src/features/ui/layouts/use-collapsible-gridview-panel.ts:19 — use-collapsible-gridview-panel.useCollapsibleGridviewPanel has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 49, 29, 72, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · onInvocationComplete.buildOnInvocationComplete · ×1
  • onInvocationComplete.buildOnInvocationComplete::addImagesToGallery (cyclomatic 18) invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:117 — onInvocationComplete.buildOnInvocationComplete::addImagesToGallery has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · backend.moveGalleryVideoItemsToBoard (cyclomatic 18) · ×1
  • backend.moveGalleryVideoItemsToBoard (cyclomatic 18) REDACTED:1415 — backend.moveGalleryVideoItemsToBoard has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to 2 function items inside it that branch (worker, claimNextVideo). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · sdxlRefiner.getRefinerValidationReasons (cyclomatic 18) · ×1
  • sdxlRefiner.getRefinerValidationReasons (cyclomatic 18) invokeai/frontend/webv2/src/features/generation/core/sdxlRefiner.ts:75 — sdxlRefiner.getRefinerValidationReasons has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · settings.cloneGenerateWidgetValues (cyclomatic 18) · ×1
  • settings.cloneGenerateWidgetValues (cyclomatic 18) invokeai/frontend/webv2/src/features/generation/core/settings.ts:654 — settings.cloneGenerateWidgetValues has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · graph.buildQwenImageGraph (cyclomatic 18) · ×1
  • graph.buildQwenImageGraph (cyclomatic 18) invokeai/frontend/webv2/src/features/generation/core/graph.ts:973 — graph.buildQwenImageGraph has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PromptParser.parseNodes (cyclomatic 18) · ×1
  • PromptParser.parseNodes (cyclomatic 18) invokeai/frontend/webv2/src/features/generation/core/prompt/ast.ts:606 — PromptParser.parseNodes has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GenerateDimensionFields.GenerateDimensionFields · ×1
  • GenerateDimensionFields.GenerateDimensionFields::renderSection (cyclomatic 18) invokeai/frontend/webv2/src/features/generation/ui/GenerateDimensionFields.tsx:621 — GenerateDimensionFields.GenerateDimensionFields::renderSection has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · installsStore.handleModelInstallSocketEvent (cyclomatic 18) · ×1
  • installsStore.handleModelInstallSocketEvent (cyclomatic 18) invokeai/frontend/webv2/src/features/models/data/installsStore.ts:455 — installsStore.handleModelInstallSocketEvent has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ModelSettingsMenuItems.ModelSettingsMenuItems (cyclomatic 18) · ×1
  • ModelSettingsMenuItems.ModelSettingsMenuItems (cyclomatic 18) invokeai/frontend/webv2/src/features/models/ui/detail/ModelSettingsMenuItems.tsx:21 — ModelSettingsMenuItems.ModelSettingsMenuItems has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to 3 function items inside it that branch (a function literal at line 59, handleExport, handleFileChange). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · InstallQueueBar.InstallQueueBar (cyclomatic 18) · ×1
  • InstallQueueBar.InstallQueueBar (cyclomatic 18) invokeai/frontend/webv2/src/features/models/ui/install-queue/InstallQueueBar.tsx:59 — InstallQueueBar.InstallQueueBar has cyclomatic complexity 18 (threshold 15). Of this number, 11 points are the body's own statements and 7 belong to 5 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · generationMeta.extractGenerationMeta (cyclomatic 18) · ×1
  • generationMeta.extractGenerationMeta (cyclomatic 18) invokeai/frontend/webv2/src/features/queue/core/generationMeta.ts:19 — generationMeta.extractGenerationMeta has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · runtime.createQueueRuntime (cyclomatic 18) · ×1
  • runtime.createQueueRuntime (cyclomatic 18) invokeai/frontend/webv2/src/features/queue/runtime.ts:439 — runtime.createQueueRuntime has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 1383, 469, 1366, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · runtime.createQueueRuntime.deliverResultVideos (cyclomatic 18) · ×1
  • runtime.createQueueRuntime.deliverResultVideos (cyclomatic 18) invokeai/frontend/webv2/src/features/queue/runtime.ts:1013 — runtime.createQueueRuntime.deliverResultVideos has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · runtime.createQueueRuntime.prepareActiveRuns (cyclomatic 18) · ×1
  • runtime.createQueueRuntime.prepareActiveRuns (cyclomatic 18) invokeai/frontend/webv2/src/features/queue/runtime.ts:2058 — runtime.createQueueRuntime.prepareActiveRuns has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 5 of the 18 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 2081, 2064, 2108). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · VideoModelField.VideoModelField (cyclomatic 18) · ×1
  • VideoModelField.VideoModelField (cyclomatic 18) invokeai/frontend/webv2/src/features/video/ui/VideoModelField.tsx:68 — VideoModelField.VideoModelField has cyclomatic complexity 18 (threshold 15). Of this number, 10 points are the body's own statements and 8 belong to 4 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · clipboard.getBridgingConnectorIds (cyclomatic 18) · ×1
  • clipboard.getBridgingConnectorIds (cyclomatic 18) invokeai/frontend/webv2/src/features/workflow/ui/editor/clipboard.ts:57 — clipboard.getBridgingConnectorIds has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 6 of the 18 points are its own statements and the rest belongs to 3 function items inside it that branch (reachesCopiedNode, startsAtCopiedNode, isConnectorId). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · WorkflowFieldInput.WorkflowFieldSnapshot (cyclomatic 18) · ×1
  • WorkflowFieldInput.WorkflowFieldSnapshot (cyclomatic 18) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:2112 — WorkflowFieldInput.WorkflowFieldSnapshot has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · useCanvasGallerySave.useCanvasGallerySave.save (cyclomatic 18) · ×1
  • useCanvasGallerySave.useCanvasGallerySave.save (cyclomatic 18) invokeai/frontend/webv2/src/workbench/widgets/canvas/useCanvasGallerySave.ts:52 — useCanvasGallerySave.useCanvasGallerySave.save has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 2 of the 18 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 59, 84). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · layerChildRows.projectLayerChildRows (cyclomatic 18) · ×1
  • layerChildRows.projectLayerChildRows (cyclomatic 18) invokeai/frontend/webv2/src/workbench/widgets/layers/layerChildRows.ts:233 — layerChildRows.projectLayerChildRows has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · exportRasterComposite.exportRasterComposite (cyclomatic 18) · ×1
  • exportRasterComposite.exportRasterComposite (cyclomatic 18) invokeai/frontend/webv2/src/workbench/canvas-engine/exportRasterComposite.ts:47 — exportRasterComposite.exportRasterComposite has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · adjustments.buildCurveLut (cyclomatic 18) · ×1
  • adjustments.buildCurveLut (cyclomatic 18) invokeai/frontend/webv2/src/workbench/canvas-engine/render/adjustments.ts:33 — adjustments.buildCurveLut has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: adjustments.isIdentityAdjustmentEntry (cyclomatic 19) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · prepareCanvasInvocation.runCanvasInvocation (cyclomatic 18) · ×1
  • prepareCanvasInvocation.runCanvasInvocation (cyclomatic 18) invokeai/frontend/webv2/src/workbench/widgets/canvas/invoke/prepareCanvasInvocation.ts:323 — prepareCanvasInvocation.runCanvasInvocation has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SelectionPixelController.run (cyclomatic 18) · ×1
  • SelectionPixelController.run (cyclomatic 18) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/selectionPixelController.ts:79 — SelectionPixelController.run has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · documentMirror.diffForests (cyclomatic 18) · ×1
  • documentMirror.diffForests (cyclomatic 18) invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentMirror.ts:99 — documentMirror.diffForests has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · compositeFrame.createCompositeFrame.draw (cyclomatic 18) · ×1
  • compositeFrame.createCompositeFrame.draw (cyclomatic 18) invokeai/frontend/webv2/src/workbench/canvas-engine/render/compositeFrame.ts:211 — compositeFrame.createCompositeFrame.draw has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · fontLoader.createFontLoader.ensureSource (cyclomatic 18) · ×1
  • fontLoader.createFontLoader.ensureSource (cyclomatic 18) invokeai/frontend/webv2/src/workbench/canvas-engine/render/fontLoader.ts:350 — fontLoader.createFontLoader.ensureSource has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SelectObjectCoordinator.createSelectObjectOperationCoordinator.save (cyclomatic 18) · ×1
  • SelectObjectCoordinator.createSelectObjectOperationCoordinator.save (cyclomatic 18) invokeai/frontend/webv2/src/workbench/canvas-operations/SelectObjectCoordinator.ts:320 — SelectObjectCoordinator.createSelectObjectOperationCoordinator.save has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · importGalleryImages.importGalleryImagesToCanvas (cyclomatic 18) · ×1
  • importGalleryImages.importGalleryImagesToCanvas (cyclomatic 18) invokeai/frontend/webv2/src/workbench/canvas-operations/importGalleryImages.ts:236 — importGalleryImages.importGalleryImagesToCanvas has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · executeVideoRecall.placeVideoImage (cyclomatic 18) · ×1
  • executeVideoRecall.placeVideoImage (cyclomatic 18) invokeai/frontend/webv2/src/workbench/image-actions/executeVideoRecall.ts:677 — executeVideoRecall.placeVideoImage has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · revealExternalGeneration.revealExternalGeneration (cyclomatic 18) · ×1
  • revealExternalGeneration.revealExternalGeneration (cyclomatic 18) invokeai/frontend/webv2/src/workbench/image-actions/revealExternalGeneration.ts:62 — revealExternalGeneration.revealExternalGeneration has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 6 of the 18 points are its own statements and the rest belongs to 3 function items inside it that branch (mayApplyWhenVisible, standDown, mayApply). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · useCommandPaletteController.useCommandPaletteController (cyclomatic 18) · ×1
  • useCommandPaletteController.useCommandPaletteController (cyclomatic 18) invokeai/frontend/webv2/src/workbench/palette/useCommandPaletteController.ts:61 — useCommandPaletteController.useCommandPaletteController has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ImageMapVocabularySettings.ImageMapVocabularySettings (cyclomatic 18) · ×1
  • ImageMapVocabularySettings.ImageMapVocabularySettings (cyclomatic 18) invokeai/frontend/webv2/src/workbench/settings/ImageMapVocabularySettings.tsx:46 — ImageMapVocabularySettings.ImageMapVocabularySettings has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to 6 function items inside it that branch (addTerms, a function literal at line 52, a function literal at line 62, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · WidgetInstanceContextMenu.WidgetInstanceContextMenu (cyclomatic 18) · ×1
  • WidgetInstanceContextMenu.WidgetInstanceContextMenu (cyclomatic 18) invokeai/frontend/webv2/src/workbench/widget-frame/WidgetInstanceContextMenu.tsx:34 — WidgetInstanceContextMenu.WidgetInstanceContextMenu has cyclomatic complexity 18 (threshold 15). Of this number, 11 points are the body's own statements and 7 belong to 5 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GenerateCanvasRenderSize.GenerateCanvasRenderSize (cyclomatic 18) · ×1
  • GenerateCanvasRenderSize.GenerateCanvasRenderSize (cyclomatic 18) invokeai/frontend/webv2/src/workbench/widgets/canvas/GenerateCanvasRenderSize.tsx:71 — GenerateCanvasRenderSize.GenerateCanvasRenderSize has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 7 of the 18 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 140, 114, 88, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · TextOptions.FontAxisSettings (cyclomatic 18) · ×1
  • TextOptions.FontAxisSettings (cyclomatic 18) invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/TextOptions.tsx:381 — TextOptions.FontAxisSettings has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 5 of the 18 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 422, 408, 394, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · AnimaLoRACollectionLoader.invoke (cyclomatic 17) · ×1
  • AnimaLoRACollectionLoader.invoke (cyclomatic 17) invokeai/app/invocations/anima/anima_lora_loader.py:124 — AnimaLoRACollectionLoader.invoke has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FLUXLoRACollectionLoader.invoke (cyclomatic 17) · ×1
  • FLUXLoRACollectionLoader.invoke (cyclomatic 17) invokeai/app/invocations/flux/flux_lora_loader.py:146 — FLUXLoRACollectionLoader.invoke has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExtractVideoRangeInvocation._write_spliced_range (cyclomatic 17) · ×1
  • ExtractVideoRangeInvocation._write_spliced_range (cyclomatic 17) invokeai/app/invocations/video_frame_extract_range.py:373 — ExtractVideoRangeInvocation._write_spliced_range has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FontService._rescan_directory (cyclomatic 17) · ×1
  • FontService._rescan_directory (cyclomatic 17) REDACTED:292 — FontService._rescan_directory has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ModelInstallService._install_next_item (cyclomatic 17) · ×1
  • ModelInstallService._install_next_item (cyclomatic 17) invokeai/app/services/model_install/model_install_default.py:1716 — ModelInstallService._install_next_item has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OrphanedModelsService.find_orphaned_models (cyclomatic 17) · ×1
  • OrphanedModelsService.find_orphaned_models (cyclomatic 17) invokeai/app/services/orphaned_models/orphaned_models_service.py:73 — OrphanedModelsService.find_orphaned_models has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GraphExecutionState._rehydrate_resolved_if_exec_branches (cyclomatic 17) · ×1
  • GraphExecutionState._rehydrate_resolved_if_exec_branches (cyclomatic 17) invokeai/app/services/shared/graph.py:3667 — GraphExecutionState._rehydrate_resolved_if_exec_branches has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · graph_nested_iterate_planner._prepare_serial_nested_iterate_chain_for_outer (cyclomatic 17) · ×1
  • graph_nested_iterate_planner._prepare_serial_nested_iterate_chain_for_outer (cyclomatic 17) invokeai/app/services/shared/graph_nested_iterate_planner.py:207 — graph_nested_iterate_planner._prepare_serial_nested_iterate_chain_for_outer has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _GenericGraphSchedulerAdapter.complete (cyclomatic 17) · ×1
  • _GenericGraphSchedulerAdapter.complete (cyclomatic 17) invokeai/app/services/shared/graph_scheduler.py:605 — _GenericGraphSchedulerAdapter.complete has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · workflow_graph_builder._resolve_for_connector_loop_linkage_path (cyclomatic 17) · ×1
  • workflow_graph_builder._resolve_for_connector_loop_linkage_path (cyclomatic 17) invokeai/app/services/shared/workflow_graph_builder.py:313 — workflow_graph_builder._resolve_for_connector_loop_linkage_path has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WorkingMemoryCalibrationService._canceled_runs (cyclomatic 17) · ×1
  • WorkingMemoryCalibrationService._canceled_runs (cyclomatic 17) invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py:1637 — WorkingMemoryCalibrationService._canceled_runs has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AnimaControlNetLLLite.from_state_dict (cyclomatic 17) · ×1
  • AnimaControlNetLLLite.from_state_dict (cyclomatic 17) invokeai/backend/anima/control_net_lllite.py:414 — AnimaControlNetLLLite.from_state_dict has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · denoise.denoise (cyclomatic 17) · ×1
  • denoise.denoise (cyclomatic 17) invokeai/backend/ernie_image/denoise.py:27 — denoise.denoise has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PromptFormatter.normalize_prompt (cyclomatic 17) · ×1
  • PromptFormatter.normalize_prompt (cyclomatic 17) invokeai/backend/image_util/pngwriter.py:87 — PromptFormatter.normalize_prompt has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · Config_Base.get_model_discriminator_value (cyclomatic 17) · ×1
  • Config_Base.get_model_discriminator_value (cyclomatic 17) invokeai/backend/model_manager/configs/base.py:159 — Config_Base.get_model_discriminator_value has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · counted_dtypes.return_to_counted_dtypes (cyclomatic 17) · ×1
  • counted_dtypes.return_to_counted_dtypes (cyclomatic 17) invokeai/backend/model_manager/load/model_cache/counted_dtypes.py:21 — counted_dtypes.return_to_counted_dtypes has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · select_hf_files.filter_files (cyclomatic 17) · ×1
  • select_hf_files.filter_files (cyclomatic 17) invokeai/backend/model_manager/util/select_hf_files.py:22 — select_hf_files.filter_files has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · attention._report_unpinned_call (cyclomatic 17) · ×1
  • attention._report_unpinned_call (cyclomatic 17) invokeai/backend/util/attention.py:764 — attention._report_unpinned_call has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · TorchDevice.get_generation_devices (cyclomatic 17) · ×1
  • TorchDevice.get_generation_devices (cyclomatic 17) invokeai/backend/util/devices.py:363 — TorchDevice.get_generation_devices has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · sage_attention.install_sage_attention (cyclomatic 17) · ×1
  • sage_attention.install_sage_attention (cyclomatic 17) invokeai/backend/util/sage_attention.py:280 — sage_attention.install_sage_attention has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ProbeScope.open_window (cyclomatic 17) · ×1
  • ProbeScope.open_window (cyclomatic 17) invokeai/backend/working_memory/probe.py:514 — ProbeScope.open_window has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MediaImportProcessor.import_image (cyclomatic 17) · ×1
  • MediaImportProcessor.import_image (cyclomatic 17) invokeai/frontend/install/import_images.py:569 — MediaImportProcessor.import_image has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · calibrate_flux2_denoise_working_memory._summarize_fit (cyclomatic 17) · ×1
  • calibrate_flux2_denoise_working_memory._summarize_fit (cyclomatic 17) scripts/calibrate_flux2_denoise_working_memory.py:424 — calibrate_flux2_denoise_working_memory._summarize_fit has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · check_platform_locks.check_torch (cyclomatic 17) · ×1
  • check_platform_locks.check_torch (cyclomatic 17) scripts/check_platform_locks.py:201 — check_platform_locks.check_torch has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · generate_docs_json._parse_docstring (cyclomatic 17) · ×1
  • generate_docs_json._parse_docstring (cyclomatic 17) scripts/generate_docs_json.py:242 — generate_docs_json._parse_docstring has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · build_shipped.build_points (cyclomatic 17) · ×1
  • build_shipped.build_points (cyclomatic 17) scripts/working_memory/build_shipped.py:223 — build_shipped.build_points has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · useMediaCookieRefresh.useMediaCookieRefresh (cyclomatic 17) · ×1
  • useMediaCookieRefresh.useMediaCookieRefresh (cyclomatic 17) invokeai/frontend/webv1/src/features/auth/hooks/useMediaCookieRefresh.ts:68 — useMediaCookieRefresh.useMediaCookieRefresh has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 7 function literals inside it that branch (lines 99, 136, 151, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · Filter.FilterContentAdvanced (cyclomatic 17) · ×1
  • Filter.FilterContentAdvanced (cyclomatic 17) invokeai/frontend/webv1/src/features/controlLayers/components/Filters/Filter.tsx:33 — Filter.FilterContentAdvanced has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · paramsSlice.applyParamsVersionMigrations (cyclomatic 17) · ×1
  • paramsSlice.applyParamsVersionMigrations (cyclomatic 17) invokeai/frontend/webv1/src/features/controlLayers/store/paramsSlice.ts:1080 — paramsSlice.applyParamsVersionMigrations has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Editor.createKonvaCropInteractionHandle (cyclomatic 17) · ×1
  • Editor.createKonvaCropInteractionHandle (cyclomatic 17) invokeai/frontend/webv1/src/features/cropper/lib/editor.ts:418 — Editor.createKonvaCropInteractionHandle has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 446, 434, 466, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · ModelList.ModelList (cyclomatic 17) · ×1
  • ModelList.ModelList (cyclomatic 17) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelManagerPanel/ModelList.tsx:40 — ModelList.ModelList has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 6 of the 17 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 63, 99, 153, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · AddNodeCmdk.filter (cyclomatic 17) · ×1
  • AddNodeCmdk.filter (cyclomatic 17) invokeai/frontend/webv1/src/features/nodes/components/flow/AddNodeCmdk/AddNodeCmdk.tsx:304 — AddNodeCmdk.filter has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SavedWorkflowFieldInputComponent.SavedWorkflowFieldInputComponent (cyclomatic 17) · ×1
  • SavedWorkflowFieldInputComponent.SavedWorkflowFieldInputComponent (cyclomatic 17) invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/SavedWorkflowFieldInputComponent.tsx:33 — SavedWorkflowFieldInputComponent.SavedWorkflowFieldInputComponent has cyclomatic complexity 17 (threshold 15). Of this number, 12 points are the body's own statements and 5 belong to 4 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · buildSD1Graph.buildSD1Graph (cyclomatic 17) · ×1
  • buildSD1Graph.buildSD1Graph (cyclomatic 17) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildSD1Graph.ts:30 — buildSD1Graph.buildSD1Graph has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · buildWanGraph.buildWanGraph (cyclomatic 17) · ×1
  • buildWanGraph.buildWanGraph (cyclomatic 17) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildWanGraph.ts:40 — buildWanGraph.buildWanGraph has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · UpscaleWarning.UpscaleWarning (cyclomatic 17) · ×1
  • UpscaleWarning.UpscaleWarning (cyclomatic 17) invokeai/frontend/webv1/src/features/settingsAccordions/components/UpscaleSettingsAccordion/UpscaleWarning.tsx:17 — UpscaleWarning.UpscaleWarning has cyclomatic complexity 17 (threshold 15). Of this number, 9 points are the body's own statements and 8 belong to 4 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · SettingsModal.SettingsModal (cyclomatic 17) · ×1
  • SettingsModal.SettingsModal (cyclomatic 17) invokeai/frontend/webv1/src/features/system/components/SettingsModal/SettingsModal.tsx:79 — SettingsModal.SettingsModal has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 6 of the 17 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 133, 126, 273). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · addRegionalGuidance.getDraftRejectionReason (cyclomatic 17) · ×1
  • addRegionalGuidance.getDraftRejectionReason (cyclomatic 17) invokeai/frontend/webv2/src/features/generation/core/canvas/addRegionalGuidance.ts:161 — addRegionalGuidance.getDraftRejectionReason has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · resolveGenerateWidgetValues.resolveGenerateWidgetValues (cyclomatic 17) · ×1
  • resolveGenerateWidgetValues.resolveGenerateWidgetValues (cyclomatic 17) invokeai/frontend/webv2/src/features/generation/core/resolveGenerateWidgetValues.ts:71 — resolveGenerateWidgetValues.resolveGenerateWidgetValues has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · GenerateSettingsForm.GenerateSettingsForm (cyclomatic 17) · ×1
  • GenerateSettingsForm.GenerateSettingsForm (cyclomatic 17) invokeai/frontend/webv2/src/features/generation/ui/GenerateSettingsForm.tsx:53 — GenerateSettingsForm.GenerateSettingsForm has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 10 function items inside it that branch (a function literal at line 264, a function literal at line 101, a function literal at line 205, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · WorkingMemorySection.WorkingMemorySection (cyclomatic 17) · ×1
  • WorkingMemorySection.WorkingMemorySection (cyclomatic 17) invokeai/frontend/webv2/src/features/models/ui/detail/WorkingMemorySection.tsx:70 — WorkingMemorySection.WorkingMemorySection has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · queueMenuActions.useQueueActions (cyclomatic 17) · ×1
  • queueMenuActions.useQueueActions (cyclomatic 17) invokeai/frontend/webv2/src/features/queue/ui/queueMenuActions.tsx:282 — queueMenuActions.useQueueActions has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 350, 425, 313, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · utilityGraph.submitUtilityGraph (cyclomatic 17) · ×1
  • utilityGraph.submitUtilityGraph (cyclomatic 17) invokeai/frontend/webv2/src/features/queue/runtime/utilityGraph.ts:427 — utilityGraph.submitUtilityGraph has cyclomatic complexity 17 (threshold 15). Of this number, 11 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · batch.getWorkflowGeneratorPropertyInvalidReason (cyclomatic 17) · ×1
  • batch.getWorkflowGeneratorPropertyInvalidReason (cyclomatic 17) invokeai/frontend/webv2/src/features/workflow/core/batch.ts:402 — batch.getWorkflowGeneratorPropertyInvalidReason has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · useEraser.useEraser (cyclomatic 17) · ×1
  • useEraser.useEraser (cyclomatic 17) invokeai/frontend/webv2/src/features/workflow/ui/editor/useEraser.tsx:103 — useEraser.useEraser has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 2 of the 17 points are its own statements and the rest belongs to 4 function items inside it that branch (eraseSegment, onPointerDownCapture, addPoint, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · NumericInput.NumericInput (cyclomatic 17) · ×1
  • NumericInput.NumericInput (cyclomatic 17) invokeai/frontend/webv2/src/features/workflow/ui/fields/NumericInput.tsx:79 — NumericInput.NumericInput has cyclomatic complexity 17 (threshold 15). Of this number, 12 points are the body's own statements and 5 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · selectorCore.shallowEqual (cyclomatic 17) · ×1
  • selectorCore.shallowEqual (cyclomatic 17) invokeai/frontend/webv2/src/platform/state/selectorCore.ts:11 — selectorCore.shallowEqual has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · FeatureHint.createHintSession.startCorridor (cyclomatic 17) · ×1
  • FeatureHint.createHintSession.startCorridor (cyclomatic 17) invokeai/frontend/webv2/src/platform/ui/hints/FeatureHint.tsx:150 — FeatureHint.createHintSession.startCorridor has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 5 of the 17 points are its own statements and the rest belongs to 3 function items inside it that branch (isOverCard, a function literal at line 180, a function literal at line 198). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · draftStore.decideUnloadJournalEntry (cyclomatic 17) · ×1
  • draftStore.decideUnloadJournalEntry (cyclomatic 17) invokeai/frontend/webv2/src/workbench/projects/draftStore.ts:802 — draftStore.decideUnloadJournalEntry has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: draftStore.isProjectUnloadJournalEntry (cyclomatic 24) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · useStagedResultGallerySave.useStagedResultGallerySave.save (cyclomatic 17) · ×1
  • useStagedResultGallerySave.useStagedResultGallerySave.save (cyclomatic 17) invokeai/frontend/webv2/src/workbench/widgets/canvas/useStagedResultGallerySave.ts:50 — useStagedResultGallerySave.useStagedResultGallerySave.save has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 2 function items inside it that branch (run, a function literal at line 62). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · layerRowSummary.layerRowSummary (cyclomatic 17) · ×1
  • layerRowSummary.layerRowSummary (cyclomatic 17) invokeai/frontend/webv2/src/workbench/widgets/layers/layerRowSummary.ts:6 — layerRowSummary.layerRowSummary has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LayerSurfaceHost.LayerSurfaceHost (cyclomatic 17) · ×1
  • LayerSurfaceHost.LayerSurfaceHost (cyclomatic 17) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerSurfaceHost.tsx:39 — LayerSurfaceHost.LayerSurfaceHost has cyclomatic complexity 17 (threshold 15). Of this number, 10 points are the body's own statements and 7 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · LayerSection.resolveChildEditor (cyclomatic 17) · ×1
  • LayerSection.resolveChildEditor (cyclomatic 17) invokeai/frontend/webv2/src/workbench/widgets/layers/panes/LayerSection.tsx:82 — LayerSection.resolveChildEditor has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · compositor.drawCachedLayer (cyclomatic 17) · ×1
  • compositor.drawCachedLayer (cyclomatic 17) invokeai/frontend/webv2/src/workbench/canvas-engine/render/compositor.ts:388 — compositor.drawCachedLayer has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ThumbnailController.request (cyclomatic 17) · ×1
  • ThumbnailController.request (cyclomatic 17) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/thumbnailController.ts:142 — ThumbnailController.request has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · groupSurfaceCache.createGroupSurfaceCache.showSpatial (cyclomatic 17) · ×1
  • groupSurfaceCache.createGroupSurfaceCache.showSpatial (cyclomatic 17) invokeai/frontend/webv2/src/workbench/canvas-engine/render/groupSurfaceCache.ts:642 — groupSurfaceCache.createGroupSurfaceCache.showSpatial has cyclomatic complexity 17 (threshold 15). Of this number, 12 points are the body's own statements and 5 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · filterOperationSession.createFilterOperationSession.process (cyclomatic 17) · ×1
  • filterOperationSession.createFilterOperationSession.process (cyclomatic 17) invokeai/frontend/webv2/src/workbench/canvas-operations/filterOperationSession.ts:167 — filterOperationSession.createFilterOperationSession.process has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 5 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 176). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · filterGraphs.buildFilterGraph (cyclomatic 17) · ×1
  • filterGraphs.buildFilterGraph (cyclomatic 17) invokeai/frontend/webv2/src/workbench/canvas-operations/filterGraphs.ts:332 — filterGraphs.buildFilterGraph has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · keys.eventToHotkeyString (cyclomatic 17) · ×1
  • keys.eventToHotkeyString (cyclomatic 17) invokeai/frontend/webv2/src/workbench/hotkeys/keys.ts:75 — keys.eventToHotkeyString has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · imageRecall.getMetadataConcepts (cyclomatic 17) · ×1
  • imageRecall.getMetadataConcepts (cyclomatic 17) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:982 — imageRecall.getMetadataConcepts has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: imageRecall.getImageRecallCapabilities (cyclomatic 38) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · usePaletteNavigation.usePaletteNavigation.onSearchKeyDown (cyclomatic 17) · ×1
  • usePaletteNavigation.usePaletteNavigation.onSearchKeyDown (cyclomatic 17) invokeai/frontend/webv2/src/workbench/palette/usePaletteNavigation.ts:157 — usePaletteNavigation.usePaletteNavigation.onSearchKeyDown has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · queueRecall.buildQueueRecallValues (cyclomatic 17) · ×1
  • queueRecall.buildQueueRecallValues (cyclomatic 17) invokeai/frontend/webv2/src/workbench/queue-integration/queueRecall.ts:52 — queueRecall.buildQueueRecallValues has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HotkeysSettingsSection.HotkeyListRow (cyclomatic 17) · ×1
  • HotkeysSettingsSection.HotkeyListRow (cyclomatic 17) invokeai/frontend/webv2/src/workbench/settings/HotkeysSettingsSection.tsx:299 — HotkeysSettingsSection.HotkeyListRow has cyclomatic complexity 17 (threshold 15). Of this number, 15 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SettingsDialog.SettingsDialog (cyclomatic 17) · ×1
  • SettingsDialog.SettingsDialog (cyclomatic 17) invokeai/frontend/webv2/src/workbench/settings/SettingsDialog.tsx:74 — SettingsDialog.SettingsDialog has cyclomatic complexity 17 (threshold 15). Of this number, 9 points are the body's own statements and 8 belong to 5 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CenterArea.CenterArea (cyclomatic 17) · ×1
  • CenterArea.CenterArea (cyclomatic 17) invokeai/frontend/webv2/src/workbench/shell/CenterArea.tsx:86 — CenterArea.CenterArea has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · invokeIssueActions.useInvokeIssueActions (cyclomatic 17) · ×1
  • invokeIssueActions.useInvokeIssueActions (cyclomatic 17) invokeai/frontend/webv2/src/workbench/shell/topbar/invokeIssueActions.ts:43 — invokeIssueActions.useInvokeIssueActions has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 53, 77, 98, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · LayoutPresetStrip.LayoutPresetStrip (cyclomatic 17) · ×1
  • LayoutPresetStrip.LayoutPresetStrip (cyclomatic 17) invokeai/frontend/webv2/src/workbench/shell/topbar/LayoutPresetStrip.tsx:86 — LayoutPresetStrip.LayoutPresetStrip has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 7 of the 17 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 207, 109, 146, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · WidgetFrames.WidgetPanelFrame (cyclomatic 17) · ×1
  • WidgetFrames.WidgetPanelFrame (cyclomatic 17) invokeai/frontend/webv2/src/workbench/widget-frame/WidgetFrames.tsx:34 — WidgetFrames.WidgetPanelFrame has cyclomatic complexity 17 (threshold 15). Of this number, 12 points are the body's own statements and 5 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MossImageDenoiseInvocation._run_diffusion (cyclomatic 16) · ×1
  • MossImageDenoiseInvocation._run_diffusion (cyclomatic 16) invokeai/app/invocations/moss_image/moss_image_denoise.py:95 — MossImageDenoiseInvocation._run_diffusion has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · run_app.run_app (cyclomatic 16) · ×1
  • run_app.run_app (cyclomatic 16) invokeai/app/run_app.py:111 — run_app.run_app has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · config_default.migrate_v3_config_dict (cyclomatic 16) · ×1
  • config_default.migrate_v3_config_dict (cyclomatic 16) invokeai/app/services/config/config_default.py:581 — config_default.migrate_v3_config_dict has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · image_index_common.blobs_to_embeddings (cyclomatic 16) · ×1
  • image_index_common.blobs_to_embeddings (cyclomatic 16) invokeai/app/services/image_index/image_index_common.py:94 — image_index_common.blobs_to_embeddings has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ImageIndexService._process_batch (cyclomatic 16) · ×1
  • ImageIndexService._process_batch (cyclomatic 16) invokeai/app/services/image_index/image_index_default.py:1388 — ImageIndexService._process_batch has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · gallery._conditions (cyclomatic 16) · ×1
  • gallery._conditions (cyclomatic 16) invokeai/app/services/shared/database/queries/gallery.py:153 — gallery._conditions has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · images._conditions (cyclomatic 16) · ×1
  • images._conditions (cyclomatic 16) invokeai/app/services/shared/database/queries/images.py:196 — images._conditions has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ContinuationRecord.transition (cyclomatic 16) · ×1
  • ContinuationRecord.transition (cyclomatic 16) invokeai/app/services/shared/execution_engine/primitives.py:470 — ContinuationRecord.transition has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GraphExecutionState._validate_for_continuation_output (cyclomatic 16) · ×1
  • GraphExecutionState._validate_for_continuation_output (cyclomatic 16) invokeai/app/services/shared/graph.py:2019 — GraphExecutionState._validate_for_continuation_output has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GraphExecutionState._validate_output_owner (cyclomatic 16) · ×1
  • GraphExecutionState._validate_output_owner (cyclomatic 16) invokeai/app/services/shared/graph.py:2531 — GraphExecutionState._validate_output_owner has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · _ExecutionNodeBuilder._expand_root_if_for_completed_collect_branch (cyclomatic 16) · ×1
  • _ExecutionNodeBuilder._expand_root_if_for_completed_collect_branch (cyclomatic 16) invokeai/app/services/shared/graph_materializer.py:2170 — _ExecutionNodeBuilder._expand_root_if_for_completed_collect_branch has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · graph_nested_iterate_planner._get_exact_nested_iterate_body (cyclomatic 16) · ×1
  • graph_nested_iterate_planner._get_exact_nested_iterate_body (cyclomatic 16) invokeai/app/services/shared/graph_nested_iterate_planner.py:21 — graph_nested_iterate_planner._get_exact_nested_iterate_body has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Graph._get_upstream_collector_ids (cyclomatic 16) · ×1
  • Graph._get_upstream_collector_ids (cyclomatic 16) invokeai/app/services/shared/graph_validation.py:737 — Graph._get_upstream_collector_ids has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · graph_validation.are_connection_types_compatible (cyclomatic 16) · ×1
  • graph_validation.are_connection_types_compatible (cyclomatic 16) invokeai/app/services/shared/graph_validation.py:245 — graph_validation.are_connection_types_compatible has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · workflow_call_compatibility._get_placeholder_for_annotation (cyclomatic 16) · ×1
  • workflow_call_compatibility._get_placeholder_for_annotation (cyclomatic 16) invokeai/app/services/shared/workflow_call_compatibility.py:56 — workflow_call_compatibility._get_placeholder_for_annotation has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WorkingMemoryCalibrationService._prepare_run (cyclomatic 16) · ×1
  • WorkingMemoryCalibrationService._prepare_run (cyclomatic 16) invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py:826 — WorkingMemoryCalibrationService._prepare_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.
D1 · Cyclomatic Complexity · WorkingMemoryCalibrationService._attempt_blocks (cyclomatic 16) · ×1
  • WorkingMemoryCalibrationService._attempt_blocks (cyclomatic 16) invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py:962 — WorkingMemoryCalibrationService._attempt_blocks has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WorkingMemoryCalibrationService._held_back (cyclomatic 16) · ×1
  • WorkingMemoryCalibrationService._held_back (cyclomatic 16) invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py:1568 — WorkingMemoryCalibrationService._held_back has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · video_thumbnails._iter_video_frames_unbounded (cyclomatic 16) · ×1
  • video_thumbnails._iter_video_frames_unbounded (cyclomatic 16) invokeai/app/util/video_thumbnails.py:211 — video_thumbnails._iter_video_frames_unbounded has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ModelConfigFactory.from_model_on_disk (cyclomatic 16) · ×1
  • ModelConfigFactory.from_model_on_disk (cyclomatic 16) invokeai/backend/model_manager/configs/factory.py:935 — ModelConfigFactory.from_model_on_disk has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · ModelLoader._load_and_cache (cyclomatic 16) · ×1
  • ModelLoader._load_and_cache (cyclomatic 16) invokeai/backend/model_manager/load/load_default.py:355 — ModelLoader._load_and_cache has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ModelCache._load_locked_model (cyclomatic 16) · ×1
  • ModelCache._load_locked_model (cyclomatic 16) invokeai/backend/model_manager/load/model_cache/model_cache.py:2118 — ModelCache._load_locked_model has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ModelCache._log_cache_state (cyclomatic 16) · ×1
  • ModelCache._log_cache_state (cyclomatic 16) invokeai/backend/model_manager/load/model_cache/model_cache.py:2694 — ModelCache._log_cache_state has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Flux2DiffusersModel._load_model (cyclomatic 16) · ×1
  • Flux2DiffusersModel._load_model (cyclomatic 16) invokeai/backend/model_manager/load/model_loaders/flux.py:1148 — Flux2DiffusersModel._load_model has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GenericDiffusersLoader.get_hf_load_class (cyclomatic 16) · ×1
  • GenericDiffusersLoader.get_hf_load_class (cyclomatic 16) invokeai/backend/model_manager/load/model_loaders/generic_diffusers.py:52 — GenericDiffusersLoader.get_hf_load_class has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Ideogram4CheckpointModel._load_model (cyclomatic 16) · ×1
  • Ideogram4CheckpointModel._load_model (cyclomatic 16) invokeai/backend/model_manager/load/model_loaders/ideogram4.py:357 — Ideogram4CheckpointModel._load_model has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ModelSearch._walk_directory (cyclomatic 16) · ×1
  • ModelSearch._walk_directory (cyclomatic 16) invokeai/backend/model_manager/search.py:107 — ModelSearch._walk_directory has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · model_util.lora_token_vector_length (cyclomatic 16) · ×1
  • model_util.lora_token_vector_length (cyclomatic 16) invokeai/backend/model_manager/util/model_util.py:87 — model_util.lora_token_vector_length has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ggml_tensor.dequantize_and_run (cyclomatic 16) · ×1
  • ggml_tensor.dequantize_and_run (cyclomatic 16) invokeai/backend/quantization/gguf/ggml_tensor.py:15 — ggml_tensor.dequantize_and_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.
D1 · Cyclomatic Complexity · fit.two_phase_envelope (cyclomatic 16) · ×1
  • fit.two_phase_envelope (cyclomatic 16) invokeai/backend/working_memory/fit.py:415 — fit.two_phase_envelope has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · _Window._close (cyclomatic 16) · ×1
  • _Window._close (cyclomatic 16) invokeai/backend/working_memory/probe.py:444 — _Window._close has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · calibrate_flux3_denoise_working_memory.main (cyclomatic 16) · ×1
  • calibrate_flux3_denoise_working_memory.main (cyclomatic 16) scripts/calibrate_flux3_denoise_working_memory.py:803 — calibrate_flux3_denoise_working_memory.main has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · build_shipped.describe_changes (cyclomatic 16) · ×1
  • build_shipped.describe_changes (cyclomatic 16) scripts/working_memory/build_shipped.py:707 — build_shipped.describe_changes has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · typegen.generateTypes (cyclomatic 16) · ×1
  • typegen.generateTypes (cyclomatic 16) invokeai/frontend/api/scripts/typegen.js:10 — typegen.generateTypes has cyclomatic complexity 16 (threshold 15). Of this number, 10 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CanvasEntityAdapterControlLayer.sync (cyclomatic 16) · ×1
  • CanvasEntityAdapterControlLayer.sync (cyclomatic 16) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityAdapterControlLayer.ts:35 — CanvasEntityAdapterControlLayer.sync has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CanvasEntityTransformer.syncInteractionState (cyclomatic 16) · ×1
  • CanvasEntityTransformer.syncInteractionState (cyclomatic 16) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityTransformer.ts:664 — CanvasEntityTransformer.syncInteractionState has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · GalleryImage.buildOnClick.<returned closure> (cyclomatic 16) · ×1
  • GalleryImage.buildOnClick.<returned closure> (cyclomatic 16) invokeai/frontend/webv1/src/features/gallery/components/ImageGrid/GalleryImage.tsx:42 — GalleryImage.buildOnClick.<returned closure> has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CurrentImageButtons.CurrentImageButtons (cyclomatic 16) · ×1
  • CurrentImageButtons.CurrentImageButtons (cyclomatic 16) invokeai/frontend/webv1/src/features/gallery/components/ImageViewer/CurrentImageButtons.tsx:35 — CurrentImageButtons.CurrentImageButtons has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · selectedItemReveal.createSelectedItemRevealMachine.sync (cyclomatic 16) · ×1
  • selectedItemReveal.createSelectedItemRevealMachine.sync (cyclomatic 16) invokeai/frontend/webv1/src/features/gallery/components/ImageViewer/selectedItemReveal.ts:131 — selectedItemReveal.createSelectedItemRevealMachine.sync has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ExternalProvidersForm.ProviderCard (cyclomatic 16) · ×1
  • ExternalProvidersForm.ProviderCard (cyclomatic 16) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/AddModelPanel/ExternalProviders/ExternalProvidersForm.tsx:162 — ExternalProvidersForm.ProviderCard has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 184, 205, 177, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · buildExternalGraph.buildExternalGraph (cyclomatic 16) · ×1
  • buildExternalGraph.buildExternalGraph (cyclomatic 16) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildExternalGraph.ts:33 — buildExternalGraph.buildExternalGraph has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · buildSD3Graph.buildSD3Graph (cyclomatic 16) · ×1
  • buildSD3Graph.buildSD3Graph (cyclomatic 16) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildSD3Graph.ts:32 — buildSD3Graph.buildSD3Graph has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · validateWorkflow.refreshCallSavedWorkflowDynamicInputs (cyclomatic 16) · ×1
  • validateWorkflow.refreshCallSavedWorkflowDynamicInputs (cyclomatic 16) invokeai/frontend/webv1/src/features/nodes/util/workflow/validateWorkflow.ts:57 — validateWorkflow.refreshCallSavedWorkflowDynamicInputs has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExpandPromptButton.ExpandPromptButton (cyclomatic 16) · ×1
  • ExpandPromptButton.ExpandPromptButton (cyclomatic 16) invokeai/frontend/webv1/src/features/prompt/ExpandPromptButton.tsx:48 — ExpandPromptButton.ExpandPromptButton has cyclomatic complexity 16 (threshold 15). Of this number, 8 points are the body's own statements and 8 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · readiness.pushWanReasons (cyclomatic 16) · ×1
  • readiness.pushWanReasons (cyclomatic 16) invokeai/frontend/webv1/src/features/queue/store/readiness.ts:308 — readiness.pushWanReasons has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · readiness.getReasonsWhyCannotEnqueueWorkflowsTab (cyclomatic 16) · ×1
  • readiness.getReasonsWhyCannotEnqueueWorkflowsTab (cyclomatic 16) invokeai/frontend/webv1/src/features/queue/store/readiness.ts:642 — readiness.getReasonsWhyCannotEnqueueWorkflowsTab has cyclomatic complexity 16 (threshold 15). Of this number, 13 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GalleryWidgetView.GalleryWidgetView (cyclomatic 16) · ×1
  • GalleryWidgetView.GalleryWidgetView (cyclomatic 16) invokeai/frontend/webv2/src/features/gallery/ui/GalleryWidgetView.tsx:93 — GalleryWidgetView.GalleryWidgetView has cyclomatic complexity 16 (threshold 15). Of this number, 9 points are the body's own statements and 7 belong to 4 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · promptFocus.getActiveTriggerQuery (cyclomatic 16) · ×1
  • promptFocus.getActiveTriggerQuery (cyclomatic 16) invokeai/frontend/webv2/src/features/generation/ui/promptFields/promptFocus.ts:170 — promptFocus.getActiveTriggerQuery has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PositivePromptField.PositivePromptField (cyclomatic 16) · ×1
  • PositivePromptField.PositivePromptField (cyclomatic 16) invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptField.tsx:75 — PositivePromptField.PositivePromptField has cyclomatic complexity 16 (threshold 15). Of this number, 9 points are the body's own statements and 7 belong to 4 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · GenerateFieldContextMenu.GenerateFieldContextMenu (cyclomatic 16) · ×1
  • GenerateFieldContextMenu.GenerateFieldContextMenu (cyclomatic 16) invokeai/frontend/webv2/src/features/generation/ui/shared/GenerateFieldContextMenu.tsx:46 — GenerateFieldContextMenu.GenerateFieldContextMenu has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 3 function items inside it that branch (handleContextMenu, a function literal at line 116, a function literal at line 119). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · baseGenerationPolicies.getGenerationModelAvailabilityIssues (cyclomatic 16) · ×1
  • baseGenerationPolicies.getGenerationModelAvailabilityIssues (cyclomatic 16) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:2157 — baseGenerationPolicies.getGenerationModelAvailabilityIssues has cyclomatic complexity 16 (threshold 15). Of this number, 12 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · baseGenerationPolicies.getDimensionValidationIssues (cyclomatic 16) · ×1
  • baseGenerationPolicies.getDimensionValidationIssues (cyclomatic 16) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:2260 — baseGenerationPolicies.getDimensionValidationIssues has cyclomatic complexity 16 (threshold 15). Of this number, 13 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · baseGenerationPolicies.getModelFamilyValidationIssues (cyclomatic 16) · ×1
  • baseGenerationPolicies.getModelFamilyValidationIssues (cyclomatic 16) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:2570 — baseGenerationPolicies.getModelFamilyValidationIssues has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · DefaultSettingsSection.FieldControl (cyclomatic 16) · ×1
  • DefaultSettingsSection.FieldControl (cyclomatic 16) invokeai/frontend/webv2/src/features/models/ui/detail/DefaultSettingsSection.tsx:62 — DefaultSettingsSection.FieldControl has cyclomatic complexity 16 (threshold 15). Of this number, 11 points are the body's own statements and 5 belong to 5 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RelatedModelsSection.RelatedModelsForModel (cyclomatic 16) · ×1
  • RelatedModelsSection.RelatedModelsForModel (cyclomatic 16) invokeai/frontend/webv2/src/features/models/ui/detail/RelatedModelsSection.tsx:35 — RelatedModelsSection.RelatedModelsForModel has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 4 function items inside it that branch (handleAdd, handleRemove, a function literal at line 45, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · runtime.createQueueRuntime.routeRunResults (cyclomatic 16) · ×1
  • runtime.createQueueRuntime.routeRunResults (cyclomatic 16) invokeai/frontend/webv2/src/features/queue/runtime.ts:1134 — runtime.createQueueRuntime.routeRunResults has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · coordinator.createQueueCoordinator.handleStatusChanged (cyclomatic 16) · ×1
  • coordinator.createQueueCoordinator.handleStatusChanged (cyclomatic 16) invokeai/frontend/webv2/src/features/queue/runtime/coordinator.ts:808 — coordinator.createQueueCoordinator.handleStatusChanged has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · queueMenuActions.getQueueActionDescriptors (cyclomatic 16) · ×1
  • queueMenuActions.getQueueActionDescriptors (cyclomatic 16) invokeai/frontend/webv2/src/features/queue/ui/queueMenuActions.tsx:108 — queueMenuActions.getQueueActionDescriptors has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · settings.cloneVideoWidgetValues (cyclomatic 16) · ×1
  • settings.cloneVideoWidgetValues (cyclomatic 16) invokeai/frontend/webv2/src/features/video/core/settings.ts:550 — settings.cloneVideoWidgetValues has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · document.updateInvocationNodeToTemplate (cyclomatic 16) · ×1
  • document.updateInvocationNodeToTemplate (cyclomatic 16) invokeai/frontend/webv2/src/features/workflow/core/document.ts:502 — document.updateInvocationNodeToTemplate has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: document.isFormElementLike (cyclomatic 17) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · WorkflowLibraryGrid.WorkflowLibraryGrid (cyclomatic 16) · ×1
  • WorkflowLibraryGrid.WorkflowLibraryGrid (cyclomatic 16) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryGrid.tsx:54 — WorkflowLibraryGrid.WorkflowLibraryGrid has cyclomatic complexity 16 (threshold 15). Of this number, 11 points are the body's own statements and 5 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Combobox.Combobox (cyclomatic 16) · ×1
  • Combobox.Combobox (cyclomatic 16) invokeai/frontend/webv2/src/platform/ui/Combobox.tsx:53 — Combobox.Combobox has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 78, 118, 127, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · ManagerLayout.ManagerLayout · ×1
  • ManagerLayout.ManagerLayout::watchFocus::tick (cyclomatic 16) invokeai/frontend/webv2/src/platform/ui/ManagerLayout.tsx:226 — ManagerLayout.ManagerLayout::watchFocus::tick has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · api.settleProjectCreate (cyclomatic 16) · ×1
  • api.settleProjectCreate (cyclomatic 16) invokeai/frontend/webv2/src/workbench/projects/api.ts:437 — api.settleProjectCreate has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to 3 function items inside it that branch (settleConflict, settleUnanswered, classify). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · assetTransport.createAssetResponseReader.<returned closure> (cyclomatic 16) · ×1
  • assetTransport.createAssetResponseReader.<returned closure> (cyclomatic 16) invokeai/frontend/webv2/src/workbench/projects/invk/assetTransport.ts:140 — assetTransport.createAssetResponseReader.<returned closure> has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · useCanvasRecovery.useStagingRecovery (cyclomatic 16) · ×1
  • useCanvasRecovery.useStagingRecovery (cyclomatic 16) invokeai/frontend/webv2/src/workbench/widgets/canvas/useCanvasRecovery.ts:139 — useCanvasRecovery.useStagingRecovery has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 205, 160, 183, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · useLayerSelectionCommands.useLayerSelectionCommands (cyclomatic 16) · ×1
  • useLayerSelectionCommands.useLayerSelectionCommands (cyclomatic 16) invokeai/frontend/webv2/src/workbench/widgets/layers/useLayerSelectionCommands.ts:23 — useLayerSelectionCommands.useLayerSelectionCommands has cyclomatic complexity 16 (threshold 15). Of this number, 9 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · floatingWindows.validateFloatingWidgets (cyclomatic 16) · ×1
  • floatingWindows.validateFloatingWidgets (cyclomatic 16) invokeai/frontend/webv2/src/workbench/floatingWindows.ts:267 — floatingWindows.validateFloatingWidgets has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · canvasDimsSync.reconcileCanvasDims (cyclomatic 16) · ×1
  • canvasDimsSync.reconcileCanvasDims (cyclomatic 16) invokeai/frontend/webv2/src/workbench/canvasDimsSync.ts:113 — canvasDimsSync.reconcileCanvasDims has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · canvasDimsSync.createCanvasDimsSync.syncFrame (cyclomatic 16) · ×1
  • canvasDimsSync.createCanvasDimsSync.syncFrame (cyclomatic 16) invokeai/frontend/webv2/src/workbench/canvasDimsSync.ts:221 — canvasDimsSync.createCanvasDimsSync.syncFrame has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · canvasDimsSync.createCanvasDimsSync.syncRenderSize (cyclomatic 16) · ×1
  • canvasDimsSync.createCanvasDimsSync.syncRenderSize (cyclomatic 16) invokeai/frontend/webv2/src/workbench/canvasDimsSync.ts:306 — canvasDimsSync.createCanvasDimsSync.syncRenderSize has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · invocationSubmit.submitResolvedInvocation (cyclomatic 16) · ×1
  • invocationSubmit.submitResolvedInvocation (cyclomatic 16) invokeai/frontend/webv2/src/workbench/invocationSubmit.ts:209 — invocationSubmit.submitResolvedInvocation has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ControlDerivationController.commitControlLayerPatch (cyclomatic 16) · ×1
  • ControlDerivationController.commitControlLayerPatch (cyclomatic 16) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/controlDerivationController.ts:110 — ControlDerivationController.commitControlLayerPatch has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · FloatingSelectionController.lift (cyclomatic 16) · ×1
  • FloatingSelectionController.lift (cyclomatic 16) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/floatingSelectionController.ts:116 — FloatingSelectionController.lift has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · filterGraphs.resolveSettings (cyclomatic 16) · ×1
  • filterGraphs.resolveSettings (cyclomatic 16) invokeai/frontend/webv2/src/workbench/canvas-operations/filterGraphs.ts:288 — filterGraphs.resolveSettings has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · entries.buildSettingsEntries (cyclomatic 16) · ×1
  • entries.buildSettingsEntries (cyclomatic 16) invokeai/frontend/webv2/src/workbench/palette/entries.ts:409 — entries.buildSettingsEntries has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 417, 509, 508). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · fonts.readEmbeddedFonts (cyclomatic 16) · ×1
  • fonts.readEmbeddedFonts (cyclomatic 16) invokeai/frontend/webv2/src/workbench/projects/invk/fonts.ts:109 — fonts.readEmbeddedFonts has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · importProject.readInvkArchive (cyclomatic 16) · ×1
  • importProject.readInvkArchive (cyclomatic 16) invokeai/frontend/webv2/src/workbench/projects/invk/importProject.ts:104 — importProject.readInvkArchive has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HotkeysSettingsSection.canScopesOverlap (cyclomatic 16) · ×1
  • HotkeysSettingsSection.canScopesOverlap (cyclomatic 16) invokeai/frontend/webv2/src/workbench/settings/HotkeysSettingsSection.tsx:99 — HotkeysSettingsSection.canScopesOverlap has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · IterationsField.IterationsField (cyclomatic 16) · ×1
  • IterationsField.IterationsField (cyclomatic 16) invokeai/frontend/webv2/src/workbench/shell/topbar/IterationsField.tsx:30 — IterationsField.IterationsField has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 51, 33, 45). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · ProjectSwitcher.ProjectSwitcher (cyclomatic 16) · ×1
  • ProjectSwitcher.ProjectSwitcher (cyclomatic 16) invokeai/frontend/webv2/src/workbench/shell/topbar/ProjectSwitcher.tsx:64 — ProjectSwitcher.ProjectSwitcher has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 116, 136, 87, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · ControlAdapterRows.ControlAdapterRows (cyclomatic 16) · ×1
  • ControlAdapterRows.ControlAdapterRows (cyclomatic 16) invokeai/frontend/webv2/src/workbench/widgets/layers/ControlAdapterRows.tsx:41 — ControlAdapterRows.ControlAdapterRows has cyclomatic complexity 16 (threshold 15). Of this number, 9 points are the body's own statements and 7 belong to 5 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · mock-backend.startMockBackend.server (cognitive 1107) · ×1
  • mock-backend.startMockBackend.server (cognitive 1107) invokeai/frontend/webv2/scripts/mock-backend.mjs:1169 — mock-backend.startMockBackend.server has cognitive complexity 1107 (threshold 15). Drivers by points: if/else 305 (629 pts), boolean chains 201, ternaries 82 (201 pts), loops 26 (73 pts), error handling 2 (3 pts) (nesting depth added 491). Of this number, 1071 points are the body's own statements and 36 belong to 17 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · modelSelected.addModelSelectedListener (cognitive 565) · ×1
  • modelSelected.addModelSelectedListener (cognitive 565) invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/modelSelected.ts:97 — modelSelected.addModelSelectedListener has cognitive complexity 565 (threshold 15). Drivers by points: if/else 145 (452 pts), ternaries 14 (57 pts), boolean chains 48, loops 3 (8 pts) (nesting depth added 355). None of this is in the body itself: all 565 points belong to 9 function literals inside it that branch (lines 100, 739, 118, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · workbenchState.reduceWorkbenchAction (cognitive 488) · ×1
  • workbenchState.reduceWorkbenchAction (cognitive 488) invokeai/frontend/webv2/src/workbench/workbenchState.ts:4424 — workbenchState.reduceWorkbenchAction has cognitive complexity 488 (threshold 15). Drivers by points: ternaries 114 (245 pts), if/else 79 (161 pts), boolean chains 70, loops 5 (11 pts), match/switch 1 (nesting depth added 219). Of this number, 172 points are the body's own statements and 316 belong to 72 function items inside it that branch. The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · GalleryImageGrid.GalleryImageGrid (cognitive 446) · ×1
  • GalleryImageGrid.GalleryImageGrid (cognitive 446) invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx:409 — GalleryImageGrid.GalleryImageGrid has cognitive complexity 446 (threshold 15). Drivers by points: ternaries 93 (203 pts), if/else 89 (144 pts), boolean chains 90, loops 5 (9 pts) (nesting depth added 169). Of this number, 137 points are the body's own statements and 309 belong to 47 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GraphExecutionState._validate_effects (cognitive 360) · ×1
  • GraphExecutionState._validate_effects (cognitive 360) invokeai/app/services/shared/graph.py:2565 — GraphExecutionState._validate_effects has cognitive complexity 360 (threshold 15). Drivers by points: if/else 90 (246 pts), ternaries 29 (85 pts), boolean chains 24, error handling 1 (3 pts), loops 2 (nesting depth added 214). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · readiness.getReasonsWhyCannotEnqueueCanvasTab (cognitive 300) · ×1
  • readiness.getReasonsWhyCannotEnqueueCanvasTab (cognitive 300) invokeai/frontend/webv1/src/features/queue/store/readiness.ts:773 — readiness.getReasonsWhyCannotEnqueueCanvasTab has cognitive complexity 300 (threshold 15). Drivers by points: if/else 128 (274 pts), boolean chains 24, loops 1 (2 pts) (nesting depth added 147). Of this number, 294 points are the body's own statements and 6 belong to 5 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · LayersTree.LayersTree (cognitive 279) · ×1
  • LayersTree.LayersTree (cognitive 279) invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx:169 — LayersTree.LayersTree has cognitive complexity 279 (threshold 15). Drivers by points: if/else 97 (128 pts), ternaries 63 (94 pts), boolean chains 52, loops 4 (5 pts) (nesting depth added 63). Of this number, 37 points are the body's own statements and 242 belong to 50 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · setEventListeners.setEventListeners (cognitive 266) · ×1
  • setEventListeners.setEventListeners (cognitive 266) invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:86 — setEventListeners.setEventListeners has cognitive complexity 266 (threshold 15). Drivers by points: if/else 79 (150 pts), ternaries 16 (68 pts), boolean chains 24, error handling 4 (19 pts), loops 3 (5 pts) (nesting depth added 140). None of this is in the body itself: all 266 points belong to 39 function items inside it that branch (a function literal at line 594, a function literal at line 836, a function literal at line 719, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · useImageActions.useImageActions (cognitive 188) · ×1
  • useImageActions.useImageActions (cognitive 188) invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts:200 — useImageActions.useImageActions has cognitive complexity 188 (threshold 15). Drivers by points: if/else 77 (106 pts), ternaries 20 (26 pts), boolean chains 25, error handling 14 (20 pts), loops 11 (nesting depth added 41). None of this is in the body itself: all 188 points belong to 50 function literals inside it that branch (lines 463, 894, 355, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · recallParameters.buildRecallParametersSettings (cognitive 177) · ×1
  • recallParameters.buildRecallParametersSettings (cognitive 177) invokeai/frontend/webv2/src/workbench/image-actions/recallParameters.ts:186 — recallParameters.buildRecallParametersSettings has cognitive complexity 177 (threshold 15). Drivers by points: if/else 58 (90 pts), ternaries 30 (59 pts), boolean chains 20, loops 5 (8 pts) (nesting depth added 64). Of this number, 157 points are the body's own statements and 20 belong to 13 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utils.pred_squares (cognitive 163) · ×1
  • utils.pred_squares (cognitive 163) invokeai/backend/image_util/mlsd/utils.py:97 — utils.pred_squares has cognitive complexity 163 (threshold 15). Drivers by points: if/else 20 (81 pts), loops 17 (54 pts), boolean chains 20, error handling 4, ternaries 2 (4 pts) (nesting depth added 100). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · LayerContextMenu.LayerMenu (cognitive 153) · ×1
  • LayerContextMenu.LayerMenu (cognitive 153) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx:223 — LayerContextMenu.LayerMenu has cognitive complexity 153 (threshold 15). Drivers by points: if/else 62 (68 pts), ternaries 37 (66 pts), boolean chains 14, match/switch 3, error handling 1 (2 pts) (nesting depth added 36). Most of this is not in the body itself: 8 of the 153 points are its own statements and the rest belongs to 40 function literals inside it that branch (lines 504, 379, 776, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · readiness.getReasonsWhyCannotEnqueueGenerateTab (cognitive 150) · ×1
  • readiness.getReasonsWhyCannotEnqueueGenerateTab (cognitive 150) invokeai/frontend/webv1/src/features/queue/store/readiness.ts:357 — readiness.getReasonsWhyCannotEnqueueGenerateTab has cognitive complexity 150 (threshold 15). Drivers by points: if/else 62 (124 pts), boolean chains 24, loops 1 (2 pts) (nesting depth added 63). Of this number, 148 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · video_smart_concat.try_build_smart_render_plan (cognitive 147) · ×1
  • video_smart_concat.try_build_smart_render_plan (cognitive 147) invokeai/app/util/video_smart_concat.py:60 — video_smart_concat.try_build_smart_render_plan has cognitive complexity 147 (threshold 15). Drivers by points: if/else 55 (109 pts), boolean chains 24, loops 7 (11 pts), ternaries 3 (nesting depth added 58). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · addRegions.addRegions (cognitive 141) · ×1
  • addRegions.addRegions (cognitive 141) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/addRegions.ts:84 — addRegions.addRegions has cognitive complexity 141 (threshold 15). Drivers by points: loops 20 (75 pts), if/else 45 (63 pts), boolean chains 3 (nesting depth added 73). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · validateConnection.validateConnection (cognitive 140) · ×1
  • validateConnection.validateConnection (cognitive 140) invokeai/frontend/webv1/src/features/nodes/store/util/validateConnection.ts:202 — validateConnection.validateConnection has cognitive complexity 140 (threshold 15). Drivers by points: if/else 42 (116 pts), boolean chains 13, loops 2 (8 pts), ternaries 1 (3 pts) (nesting depth added 82). Of this number, 133 points are the body's own statements and 7 belong to 4 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · WorkflowLibraryDetailPanel.WorkflowLibraryDetailPanel (cognitive 139) · ×1
  • WorkflowLibraryDetailPanel.WorkflowLibraryDetailPanel (cognitive 139) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryDetailPanel.tsx:101 — WorkflowLibraryDetailPanel.WorkflowLibraryDetailPanel has cognitive complexity 139 (threshold 15). Drivers by points: ternaries 32 (59 pts), if/else 30 (42 pts), boolean chains 28, error handling 7, loops 2 (3 pts) (nesting depth added 40). Of this number, 61 points are the body's own statements and 78 belong to 22 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · validateWorkflow.validateWorkflow (cognitive 129) · ×1
  • validateWorkflow.validateWorkflow (cognitive 129) invokeai/frontend/webv1/src/features/nodes/util/workflow/validateWorkflow.ts:140 — validateWorkflow.validateWorkflow has cognitive complexity 129 (threshold 15). Drivers by points: if/else 34 (91 pts), boolean chains 13, loops 7 (12 pts), ternaries 4 (10 pts), error handling 1 (3 pts) (nesting depth added 70). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GalleryPickerView.GalleryPickerView (cognitive 128) · ×1
  • GalleryPickerView.GalleryPickerView (cognitive 128) invokeai/frontend/webv2/src/features/gallery/ui/picker/GalleryPickerView.tsx:67 — GalleryPickerView.GalleryPickerView has cognitive complexity 128 (threshold 15). Drivers by points: ternaries 39 (72 pts), if/else 22 (31 pts), boolean chains 24, loops 1 (nesting depth added 42). Of this number, 78 points are the body's own statements and 50 belong to 10 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkflowEditorView.WorkflowFlow (cognitive 125) · ×1
  • WorkflowEditorView.WorkflowFlow (cognitive 125) invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowEditorView.tsx:320 — WorkflowEditorView.WorkflowFlow has cognitive complexity 125 (threshold 15). Drivers by points: if/else 56 (59 pts), ternaries 31 (33 pts), boolean chains 31, loops 1, match/switch 1 (nesting depth added 5). Of this number, 20 points are the body's own statements and 105 belong to 49 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · lora._is_flux2_lora_state_dict (cognitive 124) · ×1
  • lora._is_flux2_lora_state_dict (cognitive 124) invokeai/backend/model_manager/configs/lora.py:285 — lora._is_flux2_lora_state_dict has cognitive complexity 124 (threshold 15). Drivers by points: if/else 37 (102 pts), boolean chains 14, loops 6 (8 pts) (nesting depth added 67). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · denoise.denoise (cognitive 121) · ×1
  • denoise.denoise (cognitive 121) invokeai/backend/flux2/denoise.py:25 — denoise.denoise has cognitive complexity 121 (threshold 15). Drivers by points: if/else 27 (79 pts), ternaries 10 (34 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 78). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · executeVideoRecall.applyVideoRecallMetadata (cognitive 120) · ×1
  • executeVideoRecall.applyVideoRecallMetadata (cognitive 120) invokeai/frontend/webv2/src/workbench/image-actions/executeVideoRecall.ts:247 — executeVideoRecall.applyVideoRecallMetadata has cognitive complexity 120 (threshold 15). Drivers by points: if/else 26 (65 pts), ternaries 13 (40 pts), boolean chains 11, loops 1 (3 pts), error handling 1 (nesting depth added 68). Of this number, 118 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · videoPolicies.getVideoValidationReasons (cognitive 119) · ×1
  • videoPolicies.getVideoValidationReasons (cognitive 119) invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:2293 — videoPolicies.getVideoValidationReasons has cognitive complexity 119 (threshold 15). Drivers by points: if/else 39 (57 pts), boolean chains 32, ternaries 13 (27 pts), loops 2 (3 pts) (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VideoWidgetView.VideoWidgetView (cognitive 115) · ×1
  • VideoWidgetView.VideoWidgetView (cognitive 115) invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx:131 — VideoWidgetView.VideoWidgetView has cognitive complexity 115 (threshold 15). Drivers by points: ternaries 48 (75 pts), boolean chains 26, if/else 14 (nesting depth added 27). Of this number, 87 points are the body's own statements and 28 belong to 13 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · canvasProjectMutations.applyCanvasProjectMutation (cognitive 109) · ×1
  • canvasProjectMutations.applyCanvasProjectMutation (cognitive 109) invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts:769 — canvasProjectMutations.applyCanvasProjectMutation has cognitive complexity 109 (threshold 15). Drivers by points: ternaries 30 (64 pts), if/else 13 (26 pts), boolean chains 16, loops 1 (2 pts), match/switch 1 (nesting depth added 48). Of this number, 84 points are the body's own statements and 25 belong to 10 function literals inside it that branch. The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · buildFLUXGraph.buildFLUXGraph (cognitive 108) · ×1
  • buildFLUXGraph.buildFLUXGraph (cognitive 108) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildFLUXGraph.ts:55 — buildFLUXGraph.buildFLUXGraph has cognitive complexity 108 (threshold 15). Drivers by points: if/else 67 (104 pts), boolean chains 19, ternaries 3 (7 pts), loops 2 (6 pts) (nesting depth added 45). To reduce it, split the body into named stages: move each independent 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 (buildFLUXGraph.buildFLUXGraph::addFlux2Features) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · parseFieldType.parseFieldType (cognitive 106) · ×1
  • parseFieldType.parseFieldType (cognitive 106) invokeai/frontend/webv1/src/features/nodes/util/schema/parseFieldType.ts:45 — parseFieldType.parseFieldType has cognitive complexity 106 (threshold 15). Drivers by points: if/else 32 (99 pts), boolean chains 7 (nesting depth added 67). Of this number, 97 points are the body's own statements and 9 belong to one function literal inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · batch.planWorkflowBatch (cognitive 103) · ×1
  • batch.planWorkflowBatch (cognitive 103) invokeai/frontend/webv2/src/features/workflow/core/batch.ts:682 — batch.planWorkflowBatch has cognitive complexity 103 (threshold 15). Drivers by points: if/else 26 (59 pts), ternaries 8 (26 pts), boolean chains 14, loops 3 (4 pts) (nesting depth added 52). Of this number, 95 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · InputFieldRenderer.InputFieldRenderer (cognitive 101) · ×1
  • InputFieldRenderer.InputFieldRenderer (cognitive 101) invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/InputFieldRenderer.tsx:93 — InputFieldRenderer.InputFieldRenderer has cognitive complexity 101 (threshold 15). Drivers by points: if/else 62 (98 pts), boolean chains 3 (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · videoRecall.buildVideoRecallSettings (cognitive 98) · ×1
  • videoRecall.buildVideoRecallSettings (cognitive 98) invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts:546 — videoRecall.buildVideoRecallSettings has cognitive complexity 98 (threshold 15). Drivers by points: if/else 37 (52 pts), boolean chains 29, ternaries 9 (15 pts), loops 2 (nesting depth added 21). Of this number, 96 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · canvasHotkeyCommands.executeCanvasHotkeyCommand (cognitive 96) · ×1
  • canvasHotkeyCommands.executeCanvasHotkeyCommand (cognitive 96) invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHotkeyCommands.ts:166 — canvasHotkeyCommands.executeCanvasHotkeyCommand has cognitive complexity 96 (threshold 15). Drivers by points: if/else 39 (61 pts), boolean chains 20, ternaries 7 (15 pts) (nesting depth added 30). Of this number, 81 points are the body's own statements and 15 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · graph_if_dependencies._can_use_fresh_flat_if_activation (cognitive 95) · ×1
  • graph_if_dependencies._can_use_fresh_flat_if_activation (cognitive 95) invokeai/app/services/shared/graph_if_dependencies.py:195 — graph_if_dependencies._can_use_fresh_flat_if_activation has cognitive complexity 95 (threshold 15). Drivers by points: if/else 26 (69 pts), boolean chains 13, loops 4 (12 pts), error handling 1 (nesting depth added 51). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · _ExecutionNodeBuilder.prepare (cognitive 95) · ×1
  • _ExecutionNodeBuilder.prepare (cognitive 95) invokeai/app/services/shared/graph_materializer.py:2385 — _ExecutionNodeBuilder.prepare has cognitive complexity 95 (threshold 15). Drivers by points: if/else 18 (37 pts), loops 8 (26 pts), boolean chains 15, ternaries 7 (15 pts), error handling 1 (2 pts) (nesting depth added 46). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · ScrubberField.ScrubberField (cognitive 92) · ×1
  • ScrubberField.ScrubberField (cognitive 92) invokeai/frontend/webv2/src/platform/ui/ScrubberField.tsx:231 — ScrubberField.ScrubberField has cognitive complexity 92 (threshold 15). Drivers by points: if/else 33 (38 pts), ternaries 29 (36 pts), boolean chains 16, error handling 1, match/switch 1 (nesting depth added 12). Of this number, 19 points are the body's own statements and 73 belong to 28 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · document.applyProjectGraphAction (cognitive 90) · ×1
  • document.applyProjectGraphAction (cognitive 90) invokeai/frontend/webv2/src/features/workflow/core/document.ts:910 — document.applyProjectGraphAction has cognitive complexity 90 (threshold 15). Drivers by points: if/else 19 (39 pts), ternaries 14 (30 pts), boolean chains 18, loops 1 (2 pts), match/switch 1 (nesting depth added 37). Of this number, 57 points are the body's own statements and 33 belong to 9 function literals inside it that branch. The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · videoPolicies.getVideoModelSelectionResult (cognitive 87) · ×1
  • videoPolicies.getVideoModelSelectionResult (cognitive 87) invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:1966 — videoPolicies.getVideoModelSelectionResult has cognitive complexity 87 (threshold 15). Drivers by points: if/else 33 (50 pts), boolean chains 21, ternaries 8 (14 pts), loops 2 (nesting depth added 23). Of this number, 86 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · workbenchState.enqueueCompiledSnapshot (cognitive 86) · ×1
  • workbenchState.enqueueCompiledSnapshot (cognitive 86) invokeai/frontend/webv2/src/workbench/workbenchState.ts:3948 — workbenchState.enqueueCompiledSnapshot has cognitive complexity 86 (threshold 15). Drivers by points: ternaries 43 (77 pts), boolean chains 9 (nesting depth added 34). Of this number, 80 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · hidiffusion.apply_hidiffusion (cognitive 85) · ×1
  • hidiffusion.apply_hidiffusion (cognitive 85) invokeai/backend/hidiffusion/hidiffusion.py:2040 — hidiffusion.apply_hidiffusion has cognitive complexity 85 (threshold 15). Drivers by points: if/else 21 (50 pts), boolean chains 24, loops 5 (9 pts), ternaries 1 (2 pts) (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LayerRow.LayerRowComponent (cognitive 84) · ×1
  • LayerRow.LayerRowComponent (cognitive 84) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerRow.tsx:80 — LayerRow.LayerRowComponent has cognitive complexity 84 (threshold 15). Drivers by points: ternaries 38 (56 pts), boolean chains 16, if/else 12 (nesting depth added 18). Of this number, 65 points are the body's own statements and 19 belong to 9 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ZImageDenoiseInvocation._run_diffusion (cognitive 83) · ×1
  • ZImageDenoiseInvocation._run_diffusion (cognitive 83) invokeai/app/invocations/z_image/z_image_denoise.py:259 — ZImageDenoiseInvocation._run_diffusion has cognitive complexity 83 (threshold 15). Drivers by points: if/else 39 (66 pts), boolean chains 8, ternaries 3 (5 pts), loops 2 (4 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · runtime.createFontRuntime (cognitive 82) · ×1
  • runtime.createFontRuntime (cognitive 82) invokeai/frontend/webv2/src/features/fonts/runtime.ts:263 — runtime.createFontRuntime has cognitive complexity 82 (threshold 15). Drivers by points: if/else 46 (54 pts), boolean chains 20, loops 7, ternaries 1 (nesting depth added 8). None of this is in the body itself: all 82 points belong to 24 function items inside it that branch (a function literal at line 452, removeState, a function literal at line 509, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · forLoops.validateForLoopGraph (cognitive 81) · ×1
  • forLoops.validateForLoopGraph (cognitive 81) invokeai/frontend/webv2/src/features/workflow/core/forLoops.ts:268 — forLoops.validateForLoopGraph has cognitive complexity 81 (threshold 15). Drivers by points: if/else 57 (98 pts), boolean chains 71, loops 18 (29 pts), ternaries 2 (4 pts) (nesting depth added 54). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (forLoops.validateForLoopGraph::supportsNestedIterateBody, forLoops.validateForLoopGraph::getSupportedNestedForBody) have the same decision points, in the same order, at the same nesting depths — 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.
D2 · Cognitive Complexity · ProjectConflictBanner.ProjectConflictBanner (cognitive 81) · ×1
  • ProjectConflictBanner.ProjectConflictBanner (cognitive 81) invokeai/frontend/webv2/src/workbench/shell/ProjectConflictBanner.tsx:28 — ProjectConflictBanner.ProjectConflictBanner has cognitive complexity 81 (threshold 15). Drivers by points: ternaries 26 (56 pts), if/else 11 (15 pts), boolean chains 7, error handling 2 (3 pts) (nesting depth added 35). Of this number, 60 points are the body's own statements and 21 belong to 7 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · useGalleryActions.useGalleryActions (cognitive 80) · ×1
  • useGalleryActions.useGalleryActions (cognitive 80) invokeai/frontend/webv2/src/features/gallery/ui/useGalleryActions.ts:38 — useGalleryActions.useGalleryActions has cognitive complexity 80 (threshold 15). Drivers by points: if/else 26 (37 pts), ternaries 14 (20 pts), boolean chains 16, error handling 7 (nesting depth added 17). Most of this is not in the body itself: 1 of the 80 points is its own statement and the rest belongs to 11 function literals inside it that branch (lines 119, 318, 232, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · WorkflowPublicationHost.WorkflowPublicationHost (cognitive 80) · ×1
  • WorkflowPublicationHost.WorkflowPublicationHost (cognitive 80) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowPublicationHost.tsx:91 — WorkflowPublicationHost.WorkflowPublicationHost has cognitive complexity 80 (threshold 15). Drivers by points: ternaries 32 (41 pts), boolean chains 19, if/else 16 (17 pts), error handling 2, match/switch 1 (nesting depth added 10). Of this number, 36 points are the body's own statements and 44 belong to 20 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · PidNet.forward (cognitive 79) · ×1
  • PidNet.forward (cognitive 79) invokeai/backend/pid/_src/networks/pid_net.py:274 — PidNet.forward has cognitive complexity 79 (threshold 15). Drivers by points: if/else 26 (44 pts), ternaries 9 (25 pts), boolean chains 7, loops 2 (3 pts) (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AddNodeDialog.AddNodeDialogContent (cognitive 79) · ×1
  • AddNodeDialog.AddNodeDialogContent (cognitive 79) invokeai/frontend/webv2/src/features/workflow/ui/editor/AddNodeDialog.tsx:375 — AddNodeDialog.AddNodeDialogContent has cognitive complexity 79 (threshold 15). Drivers by points: ternaries 22 (32 pts), if/else 25 (28 pts), boolean chains 14, loops 3 (5 pts) (nesting depth added 15). Of this number, 28 points are the body's own statements and 51 belong to 13 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · PixDiT_T2I.forward (cognitive 78) · ×1
  • PixDiT_T2I.forward (cognitive 78) invokeai/backend/pid/_src/networks/pixeldit_official.py:1412 — PixDiT_T2I.forward has cognitive complexity 78 (threshold 15). Drivers by points: if/else 19 (41 pts), ternaries 8 (24 pts), loops 4 (9 pts), boolean chains 4 (nesting depth added 43). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · select_hf_files._filter_by_variant (cognitive 77) · ×1
  • select_hf_files._filter_by_variant (cognitive 77) invokeai/backend/model_manager/util/select_hf_files.py:114 — select_hf_files._filter_by_variant has cognitive complexity 77 (threshold 15). Drivers by points: if/else 20 (53 pts), loops 6 (12 pts), boolean chains 9, ternaries 1 (3 pts) (nesting depth added 41). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · lora._get_flux2_lora_variant (cognitive 76) · ×1
  • lora._get_flux2_lora_variant (cognitive 76) invokeai/backend/model_manager/configs/lora.py:455 — lora._get_flux2_lora_variant has cognitive complexity 76 (threshold 15). Drivers by points: if/else 27 (64 pts), boolean chains 8, loops 4 (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GalleryMediaSlot.GalleryMediaSlot (cognitive 76) · ×1
  • GalleryMediaSlot.GalleryMediaSlot (cognitive 76) invokeai/frontend/webv2/src/features/gallery/ui/picker/GalleryMediaSlot.tsx:82 — GalleryMediaSlot.GalleryMediaSlot has cognitive complexity 76 (threshold 15). Drivers by points: ternaries 32 (50 pts), boolean chains 20, if/else 4 (5 pts), error handling 1 (nesting depth added 19). Of this number, 61 points are the body's own statements and 15 belong to 6 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PreviewFrame.PreviewVideo (cognitive 76) · ×1
  • PreviewFrame.PreviewVideo (cognitive 76) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.tsx:387 — PreviewFrame.PreviewVideo has cognitive complexity 76 (threshold 15). Drivers by points: if/else 35 (36 pts), boolean chains 19, ternaries 14 (16 pts), error handling 5 (nesting depth added 3). Most of this is not in the body itself: 11 of the 76 points are its own statements and the rest belongs to 23 function literals inside it that branch (lines 473, 798, 771, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · imageRecall.buildImageRecallSettings (cognitive 76) · ×1
  • imageRecall.buildImageRecallSettings (cognitive 76) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:1231 — imageRecall.buildImageRecallSettings has cognitive complexity 76 (threshold 15). Drivers by points: if/else 33 (57 pts), boolean chains 16, ternaries 2 (3 pts) (nesting depth added 25). Of this number, 73 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GalleryMaintenanceService._remove_missing_page (cognitive 75) · ×1
  • GalleryMaintenanceService._remove_missing_page (cognitive 75) invokeai/app/services/gallery_maintenance/gallery_maintenance_default.py:595 — GalleryMaintenanceService._remove_missing_page has cognitive complexity 75 (threshold 15). Drivers by points: if/else 17 (46 pts), error handling 7 (15 pts), boolean chains 7, loops 4 (5 pts), ternaries 1 (2 pts) (nesting depth added 39). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · workflow_graph_builder.build_graph_from_workflow (cognitive 74) · ×1
  • workflow_graph_builder.build_graph_from_workflow (cognitive 74) invokeai/app/services/shared/workflow_graph_builder.py:367 — workflow_graph_builder.build_graph_from_workflow has cognitive complexity 74 (threshold 15). Drivers by points: if/else 24 (52 pts), boolean chains 11, loops 7 (9 pts), ternaries 2 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IntermediatesManager.IntermediatesManager (cognitive 74) · ×1
  • IntermediatesManager.IntermediatesManager (cognitive 74) invokeai/frontend/webv2/src/features/intermediates/ui/IntermediatesManager.tsx:63 — IntermediatesManager.IntermediatesManager has cognitive complexity 74 (threshold 15). Drivers by points: ternaries 33 (45 pts), boolean chains 22, if/else 6 (7 pts) (nesting depth added 13). Of this number, 62 points are the body's own statements and 12 belong to 8 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AddModelsView.AddModelsView (cognitive 73) · ×1
  • AddModelsView.AddModelsView (cognitive 73) invokeai/frontend/webv2/src/features/models/ui/add-models/AddModelsView.tsx:72 — AddModelsView.AddModelsView has cognitive complexity 73 (threshold 15). Drivers by points: ternaries 21 (29 pts), if/else 19 (26 pts), boolean chains 18 (nesting depth added 15). Of this number, 30 points are the body's own statements and 43 belong to 14 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · layerChildRows.layerChildRowCommand (cognitive 73) · ×1
  • layerChildRows.layerChildRowCommand (cognitive 73) invokeai/frontend/webv2/src/workbench/widgets/layers/layerChildRows.ts:540 — layerChildRows.layerChildRowCommand has cognitive complexity 73 (threshold 15). Drivers by points: if/else 20 (39 pts), ternaries 10 (24 pts), boolean chains 8, match/switch 1 (2 pts) (nesting depth added 34). Of this number, 70 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AnimaDenoiseInvocation._run_diffusion (cognitive 72) · ×1
  • AnimaDenoiseInvocation._run_diffusion (cognitive 72) invokeai/app/invocations/anima/anima_denoise.py:639 — AnimaDenoiseInvocation._run_diffusion has cognitive complexity 72 (threshold 15). Drivers by points: if/else 28 (45 pts), loops 8 (14 pts), boolean chains 8, ternaries 3, error handling 1 (2 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · graph.buildLtx2VideoGraph (cognitive 71) · ×1
  • graph.buildLtx2VideoGraph (cognitive 71) invokeai/frontend/webv2/src/features/video/core/graph.ts:654 — graph.buildLtx2VideoGraph has cognitive complexity 71 (threshold 15). Drivers by points: if/else 27 (36 pts), ternaries 20 (24 pts), boolean chains 11 (nesting depth added 13). Of this number, 69 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · PreviewWidgetView.PreviewWidgetView (cognitive 71) · ×1
  • PreviewWidgetView.PreviewWidgetView (cognitive 71) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx:196 — PreviewWidgetView.PreviewWidgetView has cognitive complexity 71 (threshold 15). Drivers by points: ternaries 23 (31 pts), boolean chains 19, if/else 18 (19 pts), error handling 1 (2 pts) (nesting depth added 10). Of this number, 19 points are the body's own statements and 52 belong to 15 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · InvokeButton.InvokeButton (cognitive 71) · ×1
  • InvokeButton.InvokeButton (cognitive 71) invokeai/frontend/webv2/src/workbench/shell/topbar/InvokeButton.tsx:72 — InvokeButton.InvokeButton has cognitive complexity 71 (threshold 15). Drivers by points: ternaries 27 (39 pts), if/else 21 (22 pts), boolean chains 10 (nesting depth added 13). Of this number, 40 points are the body's own statements and 31 belong to 17 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · graph_loop_topology._recognize_nested_for_body (cognitive 70) · ×1
  • graph_loop_topology._recognize_nested_for_body (cognitive 70) invokeai/app/services/shared/graph_loop_topology.py:465 — graph_loop_topology._recognize_nested_for_body has cognitive complexity 70 (threshold 15). Drivers by points: if/else 34 (48 pts), boolean chains 15, loops 4 (5 pts), ternaries 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · working_memory_calibration_fits.model_lines (cognitive 70) · ×1
  • working_memory_calibration_fits.model_lines (cognitive 70) invokeai/app/services/working_memory_calibration/working_memory_calibration_fits.py:223 — working_memory_calibration_fits.model_lines has cognitive complexity 70 (threshold 15). Drivers by points: if/else 17 (37 pts), ternaries 8 (18 pts), loops 5 (8 pts), boolean chains 7 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ImageMapPlot.ImageMapPlot (cognitive 70) · ×1
  • ImageMapPlot.ImageMapPlot (cognitive 70) invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapPlot.tsx:114 — ImageMapPlot.ImageMapPlot has cognitive complexity 70 (threshold 15). Drivers by points: if/else 32 (36 pts), boolean chains 20, ternaries 14 (nesting depth added 4). Most of this is not in the body itself: 3 of the 70 points are its own statements and the rest belongs to 25 function items inside it that branch (a function literal at line 447, a function literal at line 294, a function literal at line 393, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · GraphExecutionState._can_use_generic_for_scheduler (cognitive 69) · ×1
  • GraphExecutionState._can_use_generic_for_scheduler (cognitive 69) invokeai/app/services/shared/graph.py:1251 — GraphExecutionState._can_use_generic_for_scheduler has cognitive complexity 69 (threshold 15). Drivers by points: if/else 29 (51 pts), boolean chains 18 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · validators.getRegionalGuidanceWarnings (cognitive 69) · ×1
  • validators.getRegionalGuidanceWarnings (cognitive 69) invokeai/frontend/webv1/src/features/controlLayers/store/validators.ts:37 — validators.getRegionalGuidanceWarnings has cognitive complexity 69 (threshold 15). Drivers by points: if/else 28 (67 pts), boolean chains 2 (nesting depth added 39). Of this number, 64 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · baseGenerationPolicies.getSettingsWithCompatibleModelSelections (cognitive 69) · ×1
  • baseGenerationPolicies.getSettingsWithCompatibleModelSelections (cognitive 69) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:1879 — baseGenerationPolicies.getSettingsWithCompatibleModelSelections has cognitive complexity 69 (threshold 15). Drivers by points: if/else 24 (35 pts), boolean chains 22, ternaries 6 (11 pts), loops 1 (nesting depth added 16). Of this number, 51 points are the body's own statements and 18 belong to 7 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GenerateAdvancedFields.GenerateAdvancedFields (cognitive 69) · ×1
  • GenerateAdvancedFields.GenerateAdvancedFields (cognitive 69) invokeai/frontend/webv2/src/features/generation/ui/GenerateAdvancedFields.tsx:85 — GenerateAdvancedFields.GenerateAdvancedFields has cognitive complexity 69 (threshold 15). Drivers by points: ternaries 23 (41 pts), boolean chains 19, if/else 5 (9 pts) (nesting depth added 22). Of this number, 57 points are the body's own statements and 12 belong to 5 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WanDenoiseInvocation._run_diffusion (cognitive 68) · ×1
  • WanDenoiseInvocation._run_diffusion (cognitive 68) invokeai/app/invocations/wan/wan_denoise.py:424 — WanDenoiseInvocation._run_diffusion has cognitive complexity 68 (threshold 15). Drivers by points: if/else 29 (45 pts), ternaries 10 (13 pts), boolean chains 9, loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkingMemorySection.WorkingMemoryBody (cognitive 68) · ×1
  • WorkingMemorySection.WorkingMemoryBody (cognitive 68) invokeai/frontend/webv2/src/features/models/ui/detail/WorkingMemorySection.tsx:211 — WorkingMemorySection.WorkingMemoryBody has cognitive complexity 68 (threshold 15). Drivers by points: ternaries 28 (34 pts), if/else 14 (17 pts), boolean chains 12, error handling 3, loops 1 (2 pts) (nesting depth added 10). Of this number, 31 points are the body's own statements and 37 belong to 10 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · settings.getUpscaleValidationReasons (cognitive 68) · ×1
  • settings.getUpscaleValidationReasons (cognitive 68) invokeai/frontend/webv2/src/features/upscale/core/settings.ts:977 — settings.getUpscaleValidationReasons has cognitive complexity 68 (threshold 15). Drivers by points: if/else 23 (34 pts), ternaries 9 (18 pts), boolean chains 11, loops 3 (5 pts) (nesting depth added 22). Of this number, 66 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DownloadQueueService._do_download (cognitive 67) · ×1
  • DownloadQueueService._do_download (cognitive 67) invokeai/app/services/download/download_default.py:425 — DownloadQueueService._do_download has cognitive complexity 67 (threshold 15). Drivers by points: if/else 28 (41 pts), boolean chains 19, ternaries 3 (4 pts), error handling 1 (2 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GeminiProvider.generate (cognitive 67) · ×1
  • GeminiProvider.generate (cognitive 67) invokeai/app/services/external_generation/providers/gemini.py:29 — GeminiProvider.generate has cognitive complexity 67 (threshold 15). Drivers by points: if/else 27 (52 pts), boolean chains 8, loops 3 (4 pts), ternaries 1 (3 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CanvasTextOverlay.TextEditor (cognitive 67) · ×1
  • CanvasTextOverlay.TextEditor (cognitive 67) invokeai/frontend/webv1/src/features/controlLayers/components/Text/CanvasTextOverlay.tsx:95 — CanvasTextOverlay.TextEditor has cognitive complexity 67 (threshold 15). Drivers by points: if/else 36 (38 pts), ternaries 14 (15 pts), boolean chains 14 (nesting depth added 3). Most of this is not in the body itself: 12 of the 67 points are its own statements and the rest belongs to 24 function literals inside it that branch (lines 307, 571, 230, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · CanvasWidgetView.CanvasWidgetView (cognitive 67) · ×1
  • CanvasWidgetView.CanvasWidgetView (cognitive 67) invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasWidgetView.tsx:109 — CanvasWidgetView.CanvasWidgetView has cognitive complexity 67 (threshold 15). Drivers by points: ternaries 24 (28 pts), if/else 21 (23 pts), boolean chains 12, error handling 3, loops 1 (nesting depth added 6). Of this number, 18 points are the body's own statements and 49 belong to 20 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · usePreviewNavigation.usePreviewNavigation.navigate (cognitive 67) · ×1
  • usePreviewNavigation.usePreviewNavigation.navigate (cognitive 67) invokeai/frontend/webv2/src/workbench/widgets/preview/usePreviewNavigation.ts:705 — usePreviewNavigation.usePreviewNavigation.navigate has cognitive complexity 67 (threshold 15). Drivers by points: if/else 27 (43 pts), ternaries 5 (13 pts), boolean chains 7, error handling 2 (3 pts), loops 1 (nesting depth added 25). Most of this is not in the body itself: 8 of the 67 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 774, stepTo, updatePage, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · GraphExecutionState._rehydrate_generic_runtime_state (cognitive 66) · ×1
  • GraphExecutionState._rehydrate_generic_runtime_state (cognitive 66) invokeai/app/services/shared/graph.py:3771 — GraphExecutionState._rehydrate_generic_runtime_state has cognitive complexity 66 (threshold 15). Drivers by points: if/else 19 (48 pts), boolean chains 9, loops 7 (9 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · denoise.denoise (cognitive 66) · ×1
  • denoise.denoise (cognitive 66) invokeai/backend/flux/denoise.py:26 — denoise.denoise has cognitive complexity 66 (threshold 15). Drivers by points: if/else 25 (55 pts), boolean chains 4, ternaries 2 (4 pts), loops 2 (3 pts) (nesting depth added 33). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · loaders.sdnq_sd_loader (cognitive 66) · ×1
  • loaders.sdnq_sd_loader (cognitive 66) invokeai/backend/quantization/sdnq/loaders.py:195 — loaders.sdnq_sd_loader has cognitive complexity 66 (threshold 15). Drivers by points: if/else 18 (45 pts), ternaries 3 (10 pts), loops 4 (8 pts), boolean chains 3 (nesting depth added 38). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · setDefaultSettings.addSetDefaultSettingsListener (cognitive 66) · ×1
  • setDefaultSettings.addSetDefaultSettingsListener (cognitive 66) invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/setDefaultSettings.ts:34 — setDefaultSettings.addSetDefaultSettingsListener has cognitive complexity 66 (threshold 15). Drivers by points: if/else 27 (65 pts), boolean chains 1 (nesting depth added 38). None of this is in the body itself: all 66 points belong to one function literal inside it that branches (line 37). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · FontsPage.FontLibrary (cognitive 66) · ×1
  • FontsPage.FontLibrary (cognitive 66) invokeai/frontend/webv2/src/features/fonts/ui/FontsPage.tsx:291 — FontsPage.FontLibrary has cognitive complexity 66 (threshold 15). Drivers by points: ternaries 26 (41 pts), if/else 9 (12 pts), boolean chains 8, error handling 3 (4 pts), loops 1 (nesting depth added 19). Of this number, 27 points are the body's own statements and 39 belong to 14 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · useGalleryData.useGalleryData (cognitive 66) · ×1
  • useGalleryData.useGalleryData (cognitive 66) invokeai/frontend/webv2/src/features/gallery/ui/useGalleryData.ts:280 — useGalleryData.useGalleryData has cognitive complexity 66 (threshold 15). Drivers by points: boolean chains 28, ternaries 27, if/else 8 (11 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · indexedDbDraftStore.createIndexedDbProjectDraftStore.reconcileUnloadJournal (cognitive 66) · ×1
  • indexedDbDraftStore.createIndexedDbProjectDraftStore.reconcileUnloadJournal (cognitive 66) invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:784 — indexedDbDraftStore.createIndexedDbProjectDraftStore.reconcileUnloadJournal has cognitive complexity 66 (threshold 15). Drivers by points: ternaries 9 (31 pts), if/else 8 (23 pts), error handling 2 (5 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 41). Of this number, 29 points are the body's own statements and 37 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GraphExecutionState._can_use_generic_two_sibling_nested_for_scheduler (cognitive 65) · ×1
  • GraphExecutionState._can_use_generic_two_sibling_nested_for_scheduler (cognitive 65) invokeai/app/services/shared/graph.py:1050 — GraphExecutionState._can_use_generic_two_sibling_nested_for_scheduler has cognitive complexity 65 (threshold 15). Drivers by points: if/else 30 (47 pts), boolean chains 16, loops 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AddNodeCmdk.NodeCommandList (cognitive 64) · ×1
  • AddNodeCmdk.NodeCommandList (cognitive 64) invokeai/frontend/webv1/src/features/nodes/components/flow/AddNodeCmdk/AddNodeCmdk.tsx:386 — AddNodeCmdk.NodeCommandList has cognitive complexity 64 (threshold 15). Drivers by points: if/else 16 (31 pts), ternaries 4 (15 pts), loops 5 (11 pts), boolean chains 7 (nesting depth added 32). Most of this is not in the body itself: 2 of the 64 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 426, 514, 486, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · FloatingWidgetWindow.FloatingWidgetWindow (cognitive 64) · ×1
  • FloatingWidgetWindow.FloatingWidgetWindow (cognitive 64) invokeai/frontend/webv2/src/workbench/widget-frame/FloatingWidgetWindow.tsx:357 — FloatingWidgetWindow.FloatingWidgetWindow has cognitive complexity 64 (threshold 15). Drivers by points: ternaries 26, if/else 24 (25 pts), boolean chains 12, loops 1 (nesting depth added 1). Of this number, 24 points are the body's own statements and 40 belong to 16 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · GalleryItemSearch.GalleryItemSearch (cognitive 63) · ×1
  • GalleryItemSearch.GalleryItemSearch (cognitive 63) invokeai/frontend/webv2/src/features/gallery/ui/GalleryItemSearch.tsx:66 — GalleryItemSearch.GalleryItemSearch has cognitive complexity 63 (threshold 15). Drivers by points: ternaries 25 (37 pts), boolean chains 14, if/else 11, match/switch 1 (nesting depth added 12). Of this number, 30 points are the body's own statements and 33 belong to 13 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · graphCoverage.testing.candidatesForSlot (cognitive 63) · ×1
  • graphCoverage.testing.candidatesForSlot (cognitive 63) invokeai/frontend/webv2/src/features/generation/core/graphCoverage.testing.ts:88 — graphCoverage.testing.candidatesForSlot has cognitive complexity 63 (threshold 15). Drivers by points: ternaries 8 (48 pts), loops 5 (15 pts) (nesting depth added 50). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UpscaleWidgetView.UpscaleWidgetView (cognitive 63) · ×1
  • UpscaleWidgetView.UpscaleWidgetView (cognitive 63) invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsx:424 — UpscaleWidgetView.UpscaleWidgetView has cognitive complexity 63 (threshold 15). Drivers by points: ternaries 24 (35 pts), boolean chains 19, if/else 9 (nesting depth added 11). Of this number, 38 points are the body's own statements and 25 belong to 13 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · video_smart_concat.encode_rgb_frames (cognitive 62) · ×1
  • video_smart_concat.encode_rgb_frames (cognitive 62) invokeai/app/util/video_smart_concat.py:340 — video_smart_concat.encode_rgb_frames has cognitive complexity 62 (threshold 15). Drivers by points: if/else 22 (32 pts), error handling 8 (16 pts), boolean chains 10, loops 3 (4 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · compositor.compositeDocument (cognitive 62) · ×1
  • compositor.compositeDocument (cognitive 62) invokeai/frontend/webv2/src/workbench/canvas-engine/render/compositor.ts:560 — compositor.compositeDocument has cognitive complexity 62 (threshold 15). Drivers by points: if/else 20 (34 pts), ternaries 7 (12 pts), boolean chains 8, loops 4 (8 pts) (nesting depth added 23). Of this number, 46 points are the body's own statements and 16 belong to 5 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · maskOutline.traceMaskOutlinePath (cognitive 62) · ×1
  • maskOutline.traceMaskOutlinePath (cognitive 62) invokeai/frontend/webv2/src/workbench/canvas-engine/selection/maskOutline.ts:22 — maskOutline.traceMaskOutlinePath has cognitive complexity 62 (threshold 15). Drivers by points: if/else 18 (44 pts), loops 7 (13 pts), boolean chains 5 (nesting depth added 32). Of this number, 51 points are the body's own statements and 11 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChildExecutionCapability.create_dependency (cognitive 61) · ×1
  • ChildExecutionCapability.create_dependency (cognitive 61) invokeai/app/services/shared/execution_engine/child.py:311 — ChildExecutionCapability.create_dependency has cognitive complexity 61 (threshold 15). Drivers by points: if/else 18 (33 pts), boolean chains 9, ternaries 3 (9 pts), loops 5 (8 pts), error handling 1 (2 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · useCanvasWorkflowIntegrationExecute.useCanvasWorkflowIntegrationExecute.execute (cognitive 61) · ×1
  • useCanvasWorkflowIntegrationExecute.useCanvasWorkflowIntegrationExecute.execute (cognitive 61) invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/useCanvasWorkflowIntegrationExecute.tsx:40 — useCanvasWorkflowIntegrationExecute.useCanvasWorkflowIntegrationExecute.execute has cognitive complexity 61 (threshold 15). Drivers by points: if/else 21 (40 pts), boolean chains 9, ternaries 3 (6 pts), loops 3 (5 pts), error handling 1 (nesting depth added 24). Of this number, 53 points are the body's own statements and 8 belong to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · canvasProjectMutations.patchLayerConfig (cognitive 61) · ×1
  • canvasProjectMutations.patchLayerConfig (cognitive 61) invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts:603 — canvasProjectMutations.patchLayerConfig has cognitive complexity 61 (threshold 15). Drivers by points: ternaries 14 (28 pts), if/else 16 (26 pts), boolean chains 7 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StagingAreaApi.onItemsChangedEvent (cognitive 60) · ×1
  • StagingAreaApi.onItemsChangedEvent (cognitive 60) invokeai/frontend/webv1/src/features/controlLayers/components/StagingArea/state.ts:460 — StagingAreaApi.onItemsChangedEvent has cognitive complexity 60 (threshold 15). Drivers by points: if/else 21 (45 pts), boolean chains 7, loops 4 (6 pts), ternaries 2 (nesting depth added 26). Of this number, 58 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utilityGraph.runUtilityGraph (cognitive 60) · ×1
  • utilityGraph.runUtilityGraph (cognitive 60) invokeai/frontend/webv2/src/features/queue/runtime/utilityGraph.ts:541 — utilityGraph.runUtilityGraph has cognitive complexity 60 (threshold 15). Drivers by points: if/else 26 (29 pts), ternaries 8 (14 pts), error handling 8 (11 pts), boolean chains 5, loops 1 (nesting depth added 12). Most of this is not in the body itself: 5 of the 60 points are its own statements and the rest belongs to 14 function literals inside it that branch (lines 706, 605, 566, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · InvocationFlowNode.ExpandedInvocationNode (cognitive 60) · ×1
  • InvocationFlowNode.ExpandedInvocationNode (cognitive 60) invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx:1001 — InvocationFlowNode.ExpandedInvocationNode has cognitive complexity 60 (threshold 15). Drivers by points: ternaries 23 (43 pts), boolean chains 16, if/else 1 (nesting depth added 20). Of this number, 57 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · groupSurfaceCache.createGroupSurfaceCache.resolve (cognitive 60) · ×1
  • groupSurfaceCache.createGroupSurfaceCache.resolve (cognitive 60) invokeai/frontend/webv2/src/workbench/canvas-engine/render/groupSurfaceCache.ts:706 — groupSurfaceCache.createGroupSurfaceCache.resolve has cognitive complexity 60 (threshold 15). Drivers by points: if/else 18 (28 pts), ternaries 6 (16 pts), boolean chains 13, loops 2 (3 pts) (nesting depth added 21). Of this number, 58 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenAIProvider.generate (cognitive 59) · ×1
  • OpenAIProvider.generate (cognitive 59) invokeai/app/services/external_generation/providers/openai.py:31 — OpenAIProvider.generate has cognitive complexity 59 (threshold 15). Drivers by points: if/else 24 (44 pts), boolean chains 7, ternaries 2 (5 pts), loops 2 (3 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · promptAttention.groupTerminals (cognitive 59) · ×1
  • promptAttention.groupTerminals (cognitive 59) invokeai/frontend/webv1/src/common/util/promptAttention.ts:463 — promptAttention.groupTerminals has cognitive complexity 59 (threshold 15). Drivers by points: if/else 10 (24 pts), loops 9 (21 pts), boolean chains 8, ternaries 2 (6 pts) (nesting depth added 30). Of this number, 55 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · ModelInstallQueueItem.ModelInstallQueueItem (cognitive 59) · ×1
  • ModelInstallQueueItem.ModelInstallQueueItem (cognitive 59) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/AddModelPanel/ModelInstallQueue/ModelInstallQueueItem.tsx:109 — ModelInstallQueueItem.ModelInstallQueueItem has cognitive complexity 59 (threshold 15). Drivers by points: boolean chains 23, if/else 15 (18 pts), ternaries 5 (11 pts), error handling 5, match/switch 2 (nesting depth added 9). Of this number, 26 points are the body's own statements and 33 belong to 14 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReferenceImageCropDialog.ReferenceImageCropDialog (cognitive 59) · ×1
  • ReferenceImageCropDialog.ReferenceImageCropDialog (cognitive 59) invokeai/frontend/webv2/src/features/generation/ui/reference-images/ReferenceImageCropDialog.tsx:212 — ReferenceImageCropDialog.ReferenceImageCropDialog has cognitive complexity 59 (threshold 15). Drivers by points: if/else 24 (27 pts), ternaries 11 (18 pts), boolean chains 12, error handling 2 (nesting depth added 10). Most of this is not in the body itself: 7 of the 59 points are its own statements and the rest belongs to 19 function literals inside it that branch (lines 459, 501, 317, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · runtime.createQueueRuntime.reconcile (cognitive 59) · ×1
  • runtime.createQueueRuntime.reconcile (cognitive 59) invokeai/frontend/webv2/src/features/queue/runtime.ts:2140 — runtime.createQueueRuntime.reconcile has cognitive complexity 59 (threshold 15). Drivers by points: if/else 23 (35 pts), boolean chains 15, ternaries 2 (4 pts), loops 3, match/switch 1 (2 pts) (nesting depth added 15). Most of this is not in the body itself: 4 of the 59 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 2232, 2185, 2342, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · QwenImageDenoiseInvocation._run_diffusion (cognitive 57) · ×1
  • QwenImageDenoiseInvocation._run_diffusion (cognitive 57) invokeai/app/invocations/qwen_image/qwen_image_denoise.py:311 — QwenImageDenoiseInvocation._run_diffusion has cognitive complexity 57 (threshold 15). Drivers by points: if/else 31 (43 pts), boolean chains 9, ternaries 4, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · graph_if_runtime._get_if_iteration_paths_with_ancestry (cognitive 57) · ×1
  • graph_if_runtime._get_if_iteration_paths_with_ancestry (cognitive 57) invokeai/app/services/shared/graph_if_runtime.py:393 — graph_if_runtime._get_if_iteration_paths_with_ancestry has cognitive complexity 57 (threshold 15). Drivers by points: if/else 17 (31 pts), ternaries 5 (11 pts), boolean chains 10, loops 3 (5 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · useGalleryUploadAction.useGalleryUploadAction (cognitive 57) · ×1
  • useGalleryUploadAction.useGalleryUploadAction (cognitive 57) invokeai/frontend/webv2/src/features/gallery/ui/useGalleryUploadAction.ts:47 — useGalleryUploadAction.useGalleryUploadAction has cognitive complexity 57 (threshold 15). Drivers by points: ternaries 21 (29 pts), if/else 12 (16 pts), boolean chains 8, error handling 2 (3 pts), loops 1 (nesting depth added 13). None of this is in the body itself: all 57 points belong to 7 function literals inside it that branch (lines 77, 167, 257, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · indexedDbDraftStore.createIndexedDbProjectDraftStore.retargetAcknowledgedCopy (cognitive 57) · ×1
  • indexedDbDraftStore.createIndexedDbProjectDraftStore.retargetAcknowledgedCopy (cognitive 57) invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:991 — indexedDbDraftStore.createIndexedDbProjectDraftStore.retargetAcknowledgedCopy has cognitive complexity 57 (threshold 15). Drivers by points: if/else 13 (28 pts), ternaries 6 (18 pts), boolean chains 7, error handling 1 (3 pts), loops 1 (nesting depth added 29). Of this number, 30 points are the body's own statements and 27 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rasterSnapshotCapture.createRasterSnapshotCapture.captureRasterSnapshot (cognitive 57) · ×1
  • rasterSnapshotCapture.createRasterSnapshotCapture.captureRasterSnapshot (cognitive 57) invokeai/frontend/webv2/src/workbench/canvas-engine/rasterSnapshotCapture.ts:85 — rasterSnapshotCapture.createRasterSnapshotCapture.captureRasterSnapshot has cognitive complexity 57 (threshold 15). Drivers by points: if/else 20 (37 pts), ternaries 5 (11 pts), loops 5, boolean chains 4 (nesting depth added 23). Of this number, 56 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelInstallService._install_path_with_info_claimed (cognitive 56) · ×1
  • ModelInstallService._install_path_with_info_claimed (cognitive 56) invokeai/app/services/model_install/model_install_default.py:1008 — ModelInstallService._install_path_with_info_claimed has cognitive complexity 56 (threshold 15). Drivers by points: if/else 13 (31 pts), error handling 6 (14 pts), boolean chains 5, loops 2 (5 pts), ternaries 1 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · video_recall.resolve_video_recall_parameters (cognitive 55) · ×1
  • video_recall.resolve_video_recall_parameters (cognitive 55) invokeai/app/api/routers/video_recall.py:295 — video_recall.resolve_video_recall_parameters has cognitive complexity 55 (threshold 15). Drivers by points: if/else 17 (38 pts), loops 5 (11 pts), ternaries 1 (4 pts), boolean chains 2 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkflowFieldRenderer.WorkflowFieldRenderer (cognitive 55) · ×1
  • WorkflowFieldRenderer.WorkflowFieldRenderer (cognitive 55) invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:50 — WorkflowFieldRenderer.WorkflowFieldRenderer has cognitive complexity 55 (threshold 15). Drivers by points: if/else 28 (29 pts), ternaries 11 (13 pts), boolean chains 11, loops 1 (2 pts) (nesting depth added 4). Of this number, 19 points are the body's own statements and 36 belong to 10 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · WildcardsPanel.WildcardsPanel (cognitive 55) · ×1
  • WildcardsPanel.WildcardsPanel (cognitive 55) invokeai/frontend/webv2/src/features/generation/ui/promptFields/WildcardsPanel.tsx:71 — WildcardsPanel.WildcardsPanel has cognitive complexity 55 (threshold 15). Drivers by points: ternaries 22 (35 pts), boolean chains 10, if/else 7, error handling 3 (nesting depth added 13). Of this number, 39 points are the body's own statements and 16 belong to 8 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MergeLayerController.mergeDown (cognitive 55) · ×1
  • MergeLayerController.mergeDown (cognitive 55) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:186 — MergeLayerController.mergeDown has cognitive complexity 55 (threshold 15). Drivers by points: ternaries 14 (21 pts), if/else 16 (17 pts), boolean chains 16, error handling 1 (nesting depth added 8). Of this number, 42 points are the body's own statements and 13 belong to 6 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · WanModelLoaderInvocation.invoke (cognitive 54) · ×1
  • WanModelLoaderInvocation.invoke (cognitive 54) invokeai/app/invocations/wan/wan_model_loader.py:125 — WanModelLoaderInvocation.invoke has cognitive complexity 54 (threshold 15). Drivers by points: if/else 22 (46 pts), boolean chains 7, ternaries 1 (nesting depth added 24). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · GraphExecutionState._record_effect_streams (cognitive 53) · ×1
  • GraphExecutionState._record_effect_streams (cognitive 53) invokeai/app/services/shared/graph.py:1698 — GraphExecutionState._record_effect_streams has cognitive complexity 53 (threshold 15). Drivers by points: if/else 12 (28 pts), ternaries 9 (20 pts), boolean chains 4, loops 1 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Qwen3EncoderCheckpointLoader._load_from_singlefile (cognitive 53) · ×1
  • Qwen3EncoderCheckpointLoader._load_from_singlefile (cognitive 53) invokeai/backend/model_manager/load/model_loaders/z_image.py:1112 — Qwen3EncoderCheckpointLoader._load_from_singlefile has cognitive complexity 53 (threshold 15). Drivers by points: if/else 22 (35 pts), loops 5 (8 pts), boolean chains 6, error handling 1 (4 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VideoReferenceListField.VideoReferenceListField (cognitive 53) · ×1
  • VideoReferenceListField.VideoReferenceListField (cognitive 53) invokeai/frontend/webv2/src/features/video/ui/VideoReferenceListField.tsx:363 — VideoReferenceListField.VideoReferenceListField has cognitive complexity 53 (threshold 15). Drivers by points: if/else 19 (21 pts), boolean chains 16, ternaries 10 (13 pts), error handling 3 (nesting depth added 5). Most of this is not in the body itself: 11 of the 53 points are its own statements and the rest belongs to 17 function literals inside it that branch (lines 557, 539, 469, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ExtractMaskedAreaController.extract (cognitive 53) · ×1
  • ExtractMaskedAreaController.extract (cognitive 53) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/extractMaskedAreaController.ts:122 — ExtractMaskedAreaController.extract has cognitive complexity 53 (threshold 15). Drivers by points: if/else 26 (30 pts), boolean chains 13, ternaries 4 (7 pts), loops 2, error handling 1 (nesting depth added 7). Of this number, 52 points are the body's own statements and 1 belongs to 3 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · CanvasEntityObjectRenderer.renderObject (cognitive 52) · ×1
  • CanvasEntityObjectRenderer.renderObject (cognitive 52) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityObjectRenderer.ts:348 — CanvasEntityObjectRenderer.renderObject has cognitive complexity 52 (threshold 15). Drivers by points: if/else 21 (31 pts), boolean chains 21 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExternalModelSection.ExternalModelSection (cognitive 52) · ×1
  • ExternalModelSection.ExternalModelSection (cognitive 52) invokeai/frontend/webv2/src/features/models/ui/detail/ExternalModelSection.tsx:160 — ExternalModelSection.ExternalModelSection has cognitive complexity 52 (threshold 15). Drivers by points: ternaries 19 (31 pts), boolean chains 13, if/else 7 (8 pts) (nesting depth added 13). Of this number, 34 points are the body's own statements and 18 belong to 11 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · buildGraph.getProjectGraphReadiness (cognitive 52) · ×1
  • buildGraph.getProjectGraphReadiness (cognitive 52) invokeai/frontend/webv2/src/features/workflow/core/buildGraph.ts:125 — buildGraph.getProjectGraphReadiness has cognitive complexity 52 (threshold 15). Drivers by points: if/else 19 (42 pts), boolean chains 6, loops 2 (3 pts), ternaries 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · buildGraph.compileProjectGraph (cognitive 52) · ×1
  • buildGraph.compileProjectGraph (cognitive 52) invokeai/frontend/webv2/src/features/workflow/core/buildGraph.ts:303 — buildGraph.compileProjectGraph has cognitive complexity 52 (threshold 15). Drivers by points: if/else 13 (31 pts), boolean chains 10, ternaries 2 (7 pts), loops 3 (4 pts) (nesting depth added 24). Of this number, 51 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CallSavedWorkflowSyncRuntime.CallSavedWorkflowSyncRuntime · ×1
  • CallSavedWorkflowSyncRuntime.CallSavedWorkflowSyncRuntime::reconcile (cognitive 51) invokeai/frontend/webv2/src/features/workflow/ui/editor/CallSavedWorkflowSyncRuntime.tsx:175 — CallSavedWorkflowSyncRuntime.CallSavedWorkflowSyncRuntime::reconcile has cognitive complexity 51 (threshold 15). Drivers by points: if/else 14 (30 pts), boolean chains 10, ternaries 5 (10 pts), loops 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkflowLibraryDialog.WorkflowLibraryDialog (cognitive 51) · ×1
  • WorkflowLibraryDialog.WorkflowLibraryDialog (cognitive 51) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryDialog.tsx:153 — WorkflowLibraryDialog.WorkflowLibraryDialog has cognitive complexity 51 (threshold 15). Drivers by points: if/else 18, ternaries 17 (18 pts), boolean chains 15 (nesting depth added 1). Of this number, 23 points are the body's own statements and 28 belong to 13 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ModelInstallService._restore_incomplete_installs (cognitive 50) · ×1
  • ModelInstallService._restore_incomplete_installs (cognitive 50) invokeai/app/services/model_install/model_install_default.py:337 — ModelInstallService._restore_incomplete_installs has cognitive complexity 50 (threshold 15). Drivers by points: if/else 15 (32 pts), error handling 5 (13 pts), boolean chains 4, loops 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _ExecutionNodeBuilder._create_nested_iterate_body_iteration (cognitive 50) · ×1
  • _ExecutionNodeBuilder._create_nested_iterate_body_iteration (cognitive 50) invokeai/app/services/shared/graph_materializer.py:1017 — _ExecutionNodeBuilder._create_nested_iterate_body_iteration has cognitive complexity 50 (threshold 15). Drivers by points: if/else 18 (37 pts), loops 7 (9 pts), boolean chains 4 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · hidiffusion_utils.hidiffusion_patch (cognitive 50) · ×1
  • hidiffusion_utils.hidiffusion_patch (cognitive 50) invokeai/backend/stable_diffusion/hidiffusion_utils.py:19 — hidiffusion_utils.hidiffusion_patch has cognitive complexity 50 (threshold 15). Drivers by points: if/else 15 (22 pts), error handling 8 (19 pts), boolean chains 5, ternaries 4 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · check_platform_locks.check_torch (cognitive 50) · ×1
  • check_platform_locks.check_torch (cognitive 50) scripts/check_platform_locks.py:201 — check_platform_locks.check_torch has cognitive complexity 50 (threshold 15). Drivers by points: if/else 6 (26 pts), loops 5 (15 pts), ternaries 1 (5 pts), boolean chains 4 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · modelRequirements.extractWorkflowModelRequirements (cognitive 50) · ×1
  • modelRequirements.extractWorkflowModelRequirements (cognitive 50) invokeai/frontend/webv2/src/features/workflow/core/modelRequirements.ts:193 — modelRequirements.extractWorkflowModelRequirements has cognitive complexity 50 (threshold 15). Drivers by points: if/else 15 (41 pts), loops 3 (7 pts), boolean chains 2 (nesting depth added 30). Of this number, 39 points are the body's own statements and 11 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · imageRecall.getMetadataExternalProvider (cognitive 50) · ×1
  • imageRecall.getMetadataExternalProvider (cognitive 50) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:625 — imageRecall.getMetadataExternalProvider has cognitive complexity 50 (threshold 15). Drivers by points: if/else 12 (27 pts), boolean chains 11, ternaries 4 (9 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 21). Of this number, 36 points are the body's own statements and 14 belong to 5 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GalleryMaintenance.GalleryMaintenance (cognitive 50) · ×1
  • GalleryMaintenance.GalleryMaintenance (cognitive 50) invokeai/frontend/webv2/src/workbench/settings/GalleryMaintenance.tsx:79 — GalleryMaintenance.GalleryMaintenance has cognitive complexity 50 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 14, ternaries 7, error handling 4 (6 pts) (nesting depth added 7). Most of this is not in the body itself: 10 of the 50 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 159, 237, 110, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · RegionalGuidanceSettings.RegionalGuidanceSettings (cognitive 50) · ×1
  • RegionalGuidanceSettings.RegionalGuidanceSettings (cognitive 50) invokeai/frontend/webv2/src/workbench/widgets/layers/RegionalGuidanceSettings.tsx:84 — RegionalGuidanceSettings.RegionalGuidanceSettings has cognitive complexity 50 (threshold 15). Drivers by points: ternaries 23 (27 pts), boolean chains 15, if/else 8 (nesting depth added 4). Of this number, 22 points are the body's own statements and 28 belong to 6 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Krea2DenoiseInvocation._run_diffusion (cognitive 49) · ×1
  • Krea2DenoiseInvocation._run_diffusion (cognitive 49) invokeai/app/invocations/krea2/krea2_denoise.py:488 — Krea2DenoiseInvocation._run_diffusion has cognitive complexity 49 (threshold 15). Drivers by points: if/else 25 (33 pts), ternaries 10, boolean chains 5, loops 1 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · _ExecutionNodeBuilder._create_nested_for_body_iteration (cognitive 49) · ×1
  • _ExecutionNodeBuilder._create_nested_for_body_iteration (cognitive 49) invokeai/app/services/shared/graph_materializer.py:894 — _ExecutionNodeBuilder._create_nested_for_body_iteration has cognitive complexity 49 (threshold 15). Drivers by points: if/else 15 (32 pts), loops 7 (13 pts), boolean chains 4 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GalleryBoardsPanel.GalleryBoardsPanel (cognitive 49) · ×1
  • GalleryBoardsPanel.GalleryBoardsPanel (cognitive 49) invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardsPanel.tsx:47 — GalleryBoardsPanel.GalleryBoardsPanel has cognitive complexity 49 (threshold 15). Drivers by points: ternaries 24 (28 pts), boolean chains 12, if/else 9 (nesting depth added 4). Of this number, 24 points are the body's own statements and 25 belong to 12 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ModelSelect.ModelSelect (cognitive 49) · ×1
  • ModelSelect.ModelSelect (cognitive 49) invokeai/frontend/webv2/src/features/models/ui/components/ModelSelect.tsx:98 — ModelSelect.ModelSelect has cognitive complexity 49 (threshold 15). Drivers by points: ternaries 25 (31 pts), boolean chains 12, if/else 5 (6 pts) (nesting depth added 7). Of this number, 41 points are the body's own statements and 8 belong to 7 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ManagerLayout.ManagerLayout (cognitive 49) · ×1
  • ManagerLayout.ManagerLayout (cognitive 49) invokeai/frontend/webv2/src/platform/ui/ManagerLayout.tsx:151 — ManagerLayout.ManagerLayout has cognitive complexity 49 (threshold 15). Drivers by points: boolean chains 22, if/else 18 (20 pts), ternaries 6 (7 pts) (nesting depth added 3). Most of this is not in the body itself: 3 of the 49 points are its own statements and the rest belongs to 11 function items inside it that branch (watchFocus::tick, a function literal at line 259, repairFocus, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · SeedreamProvider.generate (cognitive 48) · ×1
  • SeedreamProvider.generate (cognitive 48) invokeai/app/services/external_generation/providers/seedream.py:39 — SeedreamProvider.generate has cognitive complexity 48 (threshold 15). Drivers by points: if/else 21 (28 pts), ternaries 5 (13 pts), boolean chains 5, loops 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GalleryMaintenanceService._archive_snapshot_files (cognitive 48) · ×1
  • GalleryMaintenanceService._archive_snapshot_files (cognitive 48) invokeai/app/services/gallery_maintenance/gallery_maintenance_default.py:735 — GalleryMaintenanceService._archive_snapshot_files has cognitive complexity 48 (threshold 15). Drivers by points: if/else 9 (27 pts), ternaries 5 (13 pts), error handling 1 (3 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GraphExecutionState._can_use_generic_serial_nested_for_scheduler (cognitive 48) · ×1
  • GraphExecutionState._can_use_generic_serial_nested_for_scheduler (cognitive 48) invokeai/app/services/shared/graph.py:1158 — GraphExecutionState._can_use_generic_serial_nested_for_scheduler has cognitive complexity 48 (threshold 15). Drivers by points: if/else 21 (30 pts), boolean chains 16, 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.
D2 · Cognitive Complexity · GraphExecutionState._can_use_generic_nested_iterate_scheduler (cognitive 48) · ×1
  • GraphExecutionState._can_use_generic_nested_iterate_scheduler (cognitive 48) invokeai/app/services/shared/graph.py:1404 — GraphExecutionState._can_use_generic_nested_iterate_scheduler has cognitive complexity 48 (threshold 15). Drivers by points: if/else 27 (32 pts), boolean chains 16 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · _ExecutionNodeBuilder._get_sibling_iterate_if_collect_branches (cognitive 48) · ×1
  • _ExecutionNodeBuilder._get_sibling_iterate_if_collect_branches (cognitive 48) invokeai/app/services/shared/graph_materializer.py:1844 — _ExecutionNodeBuilder._get_sibling_iterate_if_collect_branches has cognitive complexity 48 (threshold 15). Drivers by points: if/else 12 (28 pts), loops 6 (11 pts), boolean chains 5, ternaries 1 (4 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · useCleanupDialog.useCleanupDialog.confirm (cognitive 48) · ×1
  • useCleanupDialog.useCleanupDialog.confirm (cognitive 48) invokeai/frontend/webv2/src/features/intermediates/ui/useCleanupDialog.ts:85 — useCleanupDialog.useCleanupDialog.confirm has cognitive complexity 48 (threshold 15). Drivers by points: ternaries 9 (27 pts), if/else 5 (11 pts), boolean chains 6, error handling 2 (4 pts) (nesting depth added 26). Of this number, 21 points are the body's own statements and 27 belong to 4 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · ListItem.ListItem (cognitive 48) · ×1
  • ListItem.ListItem (cognitive 48) invokeai/frontend/webv2/src/platform/ui/list/ListItem.tsx:85 — ListItem.ListItem has cognitive complexity 48 (threshold 15). Drivers by points: ternaries 18 (22 pts), boolean chains 19, if/else 7 (nesting depth added 4). Of this number, 34 points are the body's own statements and 14 belong to 6 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · GraphExecutionState._build_execution_tokens (cognitive 47) · ×1
  • GraphExecutionState._build_execution_tokens (cognitive 47) invokeai/app/services/shared/graph.py:3027 — GraphExecutionState._build_execution_tokens has cognitive complexity 47 (threshold 15). Drivers by points: ternaries 12 (27 pts), if/else 8 (15 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · measure-architecture-performance.runSample (cognitive 47) · ×1
  • measure-architecture-performance.runSample (cognitive 47) invokeai/frontend/webv2/scripts/measure-architecture-performance.mjs:316 — measure-architecture-performance.runSample has cognitive complexity 47 (threshold 15). Drivers by points: if/else 22 (35 pts), boolean chains 8, ternaries 3 (4 pts) (nesting depth added 14). Of this number, 33 points are the body's own statements and 14 belong to 10 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · settings.normalizeGenerateSettings (cognitive 47) · ×1
  • settings.normalizeGenerateSettings (cognitive 47) invokeai/frontend/webv2/src/features/generation/core/settings.ts:874 — settings.normalizeGenerateSettings has cognitive complexity 47 (threshold 15). Drivers by points: ternaries 37 (39 pts), boolean chains 6, if/else 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ReferenceImageCard.ReferenceImageCardBase (cognitive 47) · ×1
  • ReferenceImageCard.ReferenceImageCardBase (cognitive 47) invokeai/frontend/webv2/src/features/generation/ui/reference-images/ReferenceImageCard.tsx:84 — ReferenceImageCard.ReferenceImageCardBase has cognitive complexity 47 (threshold 15). Drivers by points: ternaries 19 (44 pts), if/else 2, boolean chains 1 (nesting depth added 25). Of this number, 45 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · BooleanMergeController.merge (cognitive 47) · ×1
  • BooleanMergeController.merge (cognitive 47) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/booleanMergeController.ts:75 — BooleanMergeController.merge has cognitive complexity 47 (threshold 15). Drivers by points: if/else 18 (23 pts), ternaries 6 (12 pts), boolean chains 11, loops 1 (nesting depth added 11). Of this number, 46 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · queueRunRestoration.normalizeRestoredQueueItem (cognitive 47) · ×1
  • queueRunRestoration.normalizeRestoredQueueItem (cognitive 47) invokeai/frontend/webv2/src/workbench/queue-integration/queueRunRestoration.ts:17 — queueRunRestoration.normalizeRestoredQueueItem has cognitive complexity 47 (threshold 15). Drivers by points: boolean chains 23, ternaries 12, if/else 9 (11 pts), error handling 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · useProjectActions.useProjectActions (cognitive 47) · ×1
  • useProjectActions.useProjectActions (cognitive 47) invokeai/frontend/webv2/src/workbench/projects/useProjectActions.ts:56 — useProjectActions.useProjectActions has cognitive complexity 47 (threshold 15). Drivers by points: if/else 24 (33 pts), boolean chains 5, error handling 4, ternaries 2 (3 pts), loops 2 (nesting depth added 10). None of this is in the body itself: all 47 points belong to 9 function literals inside it that branch (lines 190, 73, 239, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · InstallStagingLedger._sweep_stale_claims_locked (cognitive 46) · ×1
  • InstallStagingLedger._sweep_stale_claims_locked (cognitive 46) invokeai/app/services/model_install/install_staging_ledger.py:689 — InstallStagingLedger._sweep_stale_claims_locked has cognitive complexity 46 (threshold 15). Drivers by points: if/else 12 (26 pts), error handling 6 (14 pts), boolean chains 4, loops 2 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelInstallService._enqueue_remote_download (cognitive 46) · ×1
  • ModelInstallService._enqueue_remote_download (cognitive 46) invokeai/app/services/model_install/model_install_default.py:2184 — ModelInstallService._enqueue_remote_download has cognitive complexity 46 (threshold 15). Drivers by points: if/else 15 (30 pts), boolean chains 9, ternaries 2 (3 pts), error handling 2, loops 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · execution_effects.normalize_persisted_execution_effects (cognitive 46) · ×1
  • execution_effects.normalize_persisted_execution_effects (cognitive 46) invokeai/app/services/shared/execution_effects.py:414 — execution_effects.normalize_persisted_execution_effects has cognitive complexity 46 (threshold 15). Drivers by points: if/else 11 (31 pts), error handling 2 (7 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · settings.normalizeVideoSettings (cognitive 46) · ×1
  • settings.normalizeVideoSettings (cognitive 46) invokeai/frontend/webv2/src/features/video/core/settings.ts:347 — settings.normalizeVideoSettings has cognitive complexity 46 (threshold 15). Drivers by points: ternaries 35 (36 pts), boolean chains 9, if/else 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · paintTool.resolveTarget (cognitive 46) · ×1
  • paintTool.resolveTarget (cognitive 46) invokeai/frontend/webv2/src/workbench/canvas-engine/tools/paintTool.ts:144 — paintTool.resolveTarget has cognitive complexity 46 (threshold 15). Drivers by points: if/else 15 (24 pts), ternaries 7 (15 pts), boolean chains 7 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ControlLayerSettings.ControlLayerSettings (cognitive 46) · ×1
  • ControlLayerSettings.ControlLayerSettings (cognitive 46) invokeai/frontend/webv2/src/workbench/widgets/layers/ControlLayerSettings.tsx:85 — ControlLayerSettings.ControlLayerSettings has cognitive complexity 46 (threshold 15). Drivers by points: boolean chains 18, ternaries 15 (16 pts), if/else 12 (nesting depth added 1). Of this number, 17 points are the body's own statements and 29 belong to 16 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · WanVideoDenoiseInvocation._run_diffusion (cognitive 45) · ×1
  • WanVideoDenoiseInvocation._run_diffusion (cognitive 45) invokeai/app/invocations/wan/wan_video_denoise.py:157 — WanVideoDenoiseInvocation._run_diffusion has cognitive complexity 45 (threshold 15). Drivers by points: if/else 16 (22 pts), ternaries 9 (13 pts), boolean chains 9, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · graph_iterate_planner._get_direct_iterate_collect_nodes (cognitive 45) · ×1
  • graph_iterate_planner._get_direct_iterate_collect_nodes (cognitive 45) invokeai/app/services/shared/graph_iterate_planner.py:164 — graph_iterate_planner._get_direct_iterate_collect_nodes has cognitive complexity 45 (threshold 15). Drivers by points: if/else 27 (35 pts), boolean chains 8, loops 2 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · calibrate_flux_vae_working_memory.main (cognitive 45) · ×1
  • calibrate_flux_vae_working_memory.main (cognitive 45) scripts/calibrate_flux_vae_working_memory.py:150 — calibrate_flux_vae_working_memory.main has cognitive complexity 45 (threshold 15). Drivers by points: if/else 11 (18 pts), ternaries 7 (15 pts), loops 4 (8 pts), boolean chains 4 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · graphToDocument.previewGraphToDocument (cognitive 45) · ×1
  • graphToDocument.previewGraphToDocument (cognitive 45) invokeai/frontend/webv2/src/features/workflow/core/graphToDocument.ts:36 — graphToDocument.previewGraphToDocument has cognitive complexity 45 (threshold 15). Drivers by points: if/else 11 (25 pts), ternaries 4 (9 pts), boolean chains 6, loops 4 (5 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · templates.parseInvocationSchema (cognitive 45) · ×1
  • templates.parseInvocationSchema (cognitive 45) invokeai/frontend/webv2/src/features/workflow/data/templates.ts:331 — templates.parseInvocationSchema has cognitive complexity 45 (threshold 15). Drivers by points: if/else 9 (16 pts), ternaries 15, boolean chains 12, loops 2 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · InvocationFlowNode.InputFieldRow (cognitive 45) · ×1
  • InvocationFlowNode.InputFieldRow (cognitive 45) invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx:541 — InvocationFlowNode.InputFieldRow has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 23 (36 pts), boolean chains 8, if/else 1 (nesting depth added 13). Of this number, 40 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · List.List (cognitive 45) · ×1
  • List.List (cognitive 45) invokeai/frontend/webv2/src/platform/ui/list/List.tsx:145 — List.List has cognitive complexity 45 (threshold 15). Drivers by points: if/else 17 (20 pts), ternaries 12 (13 pts), boolean chains 10, loops 1, match/switch 1 (nesting depth added 4). Of this number, 19 points are the body's own statements and 26 belong to 13 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · layerTreeDrop.projectLayerDrop (cognitive 45) · ×1
  • layerTreeDrop.projectLayerDrop (cognitive 45) invokeai/frontend/webv2/src/workbench/widgets/layers/layerTreeDrop.ts:52 — layerTreeDrop.projectLayerDrop has cognitive complexity 45 (threshold 15). Drivers by points: if/else 15 (25 pts), ternaries 7 (11 pts), loops 3 (5 pts), boolean chains 4 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PreviewFrame.PreviewImageFrame (cognitive 45) · ×1
  • PreviewFrame.PreviewImageFrame (cognitive 45) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.tsx:100 — PreviewFrame.PreviewImageFrame has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 22 (28 pts), boolean chains 12, if/else 5 (nesting depth added 6). Of this number, 34 points are the body's own statements and 11 belong to 6 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · LayerMutationController.commitDuplicate (cognitive 45) · ×1
  • LayerMutationController.commitDuplicate (cognitive 45) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/layerMutationController.ts:206 — LayerMutationController.commitDuplicate has cognitive complexity 45 (threshold 15). Drivers by points: if/else 19 (26 pts), boolean chains 11, ternaries 6, loops 2 (nesting depth added 7). Of this number, 19 points are the body's own statements and 26 belong to 11 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Flux2DenoiseInvocation._run_diffusion (cognitive 44) · ×1
  • Flux2DenoiseInvocation._run_diffusion (cognitive 44) invokeai/app/invocations/flux2/flux2_denoise.py:229 — Flux2DenoiseInvocation._run_diffusion has cognitive complexity 44 (threshold 15). Drivers by points: if/else 21 (24 pts), ternaries 11 (12 pts), boolean chains 8 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · graph_scheduler._prepare_deferred_nested_for_body (cognitive 44) · ×1
  • graph_scheduler._prepare_deferred_nested_for_body (cognitive 44) invokeai/app/services/shared/graph_scheduler.py:28 — graph_scheduler._prepare_deferred_nested_for_body has cognitive complexity 44 (threshold 15). Drivers by points: if/else 10 (31 pts), loops 3 (6 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CanvasEntityBufferObjectRenderer.renderBufferObject (cognitive 44) · ×1
  • CanvasEntityBufferObjectRenderer.renderBufferObject (cognitive 44) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityBufferObjectRenderer.ts:115 — CanvasEntityBufferObjectRenderer.renderBufferObject has cognitive complexity 44 (threshold 15). Drivers by points: if/else 23 (33 pts), boolean chains 11 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · coordinator.createQueueCoordinator.reconcile (cognitive 44) · ×1
  • coordinator.createQueueCoordinator.reconcile (cognitive 44) invokeai/frontend/webv2/src/features/queue/runtime/coordinator.ts:1080 — coordinator.createQueueCoordinator.reconcile has cognitive complexity 44 (threshold 15). Drivers by points: ternaries 9 (23 pts), boolean chains 8, if/else 5 (8 pts), loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 19). Of this number, 31 points are the body's own statements and 13 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HsvWheelPicker.HsvWheelPicker (cognitive 44) · ×1
  • HsvWheelPicker.HsvWheelPicker (cognitive 44) invokeai/frontend/webv2/src/platform/ui/HsvWheelPicker.tsx:38 — HsvWheelPicker.HsvWheelPicker has cognitive complexity 44 (threshold 15). Drivers by points: ternaries 13 (22 pts), if/else 9 (11 pts), boolean chains 8, loops 2 (3 pts) (nesting depth added 12). Most of this is not in the body itself: 6 of the 44 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 62, 189, 171, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · invocation.resolveInvocationRouteInput (cognitive 44) · ×1
  • invocation.resolveInvocationRouteInput (cognitive 44) invokeai/frontend/webv2/src/workbench/invocation.ts:373 — invocation.resolveInvocationRouteInput has cognitive complexity 44 (threshold 15). Drivers by points: if/else 17 (28 pts), boolean chains 7, ternaries 4 (6 pts), loops 1 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · layerPanelRows.navigateTree (cognitive 44) · ×1
  • layerPanelRows.navigateTree (cognitive 44) invokeai/frontend/webv2/src/workbench/widgets/layers/layerPanelRows.ts:147 — layerPanelRows.navigateTree has cognitive complexity 44 (threshold 15). Drivers by points: if/else 12 (24 pts), ternaries 5 (12 pts), boolean chains 7, match/switch 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · strokeSession.createStrokeSession.paint (cognitive 44) · ×1
  • strokeSession.createStrokeSession.paint (cognitive 44) invokeai/frontend/webv2/src/workbench/canvas-engine/tools/strokeSession.ts:323 — strokeSession.createStrokeSession.paint has cognitive complexity 44 (threshold 15). Drivers by points: if/else 19 (22 pts), ternaries 10 (11 pts), boolean chains 9, loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ImageIndexService._worker_loop (cognitive 43) · ×1
  • ImageIndexService._worker_loop (cognitive 43) invokeai/app/services/image_index/image_index_default.py:1161 — ImageIndexService._worker_loop has cognitive complexity 43 (threshold 15). Drivers by points: if/else 12 (29 pts), error handling 4 (9 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GraphExecutionState._record_continuation_effects (cognitive 43) · ×1
  • GraphExecutionState._record_continuation_effects (cognitive 43) invokeai/app/services/shared/graph.py:1841 — GraphExecutionState._record_continuation_effects has cognitive complexity 43 (threshold 15). Drivers by points: if/else 10 (31 pts), ternaries 3 (6 pts), boolean chains 5, loops 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Graph._validate_type_dependents_after_edge (cognitive 43) · ×1
  • Graph._validate_type_dependents_after_edge (cognitive 43) invokeai/app/services/shared/graph_validation.py:792 — Graph._validate_type_dependents_after_edge has cognitive complexity 43 (threshold 15). Drivers by points: if/else 15 (37 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · counted_dtypes.return_to_counted_dtypes (cognitive 43) · ×1
  • counted_dtypes.return_to_counted_dtypes (cognitive 43) invokeai/backend/model_manager/load/model_cache/counted_dtypes.py:21 — counted_dtypes.return_to_counted_dtypes has cognitive complexity 43 (threshold 15). Drivers by points: if/else 8 (28 pts), loops 3 (6 pts), ternaries 2 (6 pts), boolean chains 3 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Editor.getNextCropBoxByHandleWithAspectRatio (cognitive 43) · ×1
  • Editor.getNextCropBoxByHandleWithAspectRatio (cognitive 43) invokeai/frontend/webv1/src/features/cropper/lib/editor.ts:746 — Editor.getNextCropBoxByHandleWithAspectRatio has cognitive complexity 43 (threshold 15). Drivers by points: if/else 23 (30 pts), boolean chains 9, ternaries 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · readiness.getReasonsWhyCannotEnqueueWorkflowsTab (cognitive 43) · ×1
  • readiness.getReasonsWhyCannotEnqueueWorkflowsTab (cognitive 43) invokeai/frontend/webv1/src/features/queue/store/readiness.ts:642 — readiness.getReasonsWhyCannotEnqueueWorkflowsTab has cognitive complexity 43 (threshold 15). Drivers by points: if/else 13 (32 pts), loops 4 (11 pts) (nesting depth added 26). Of this number, 35 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · templates.parseFieldType (cognitive 43) · ×1
  • templates.parseFieldType (cognitive 43) invokeai/frontend/webv2/src/features/workflow/data/templates.ts:71 — templates.parseFieldType has cognitive complexity 43 (threshold 15). Drivers by points: if/else 14 (29 pts), ternaries 4 (9 pts), boolean chains 5 (nesting depth added 20). Of this number, 42 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · ResizeHandle.ResizeHandle (cognitive 43) · ×1
  • ResizeHandle.ResizeHandle (cognitive 43) invokeai/frontend/webv2/src/platform/ui/ResizeHandle.tsx:197 — ResizeHandle.ResizeHandle has cognitive complexity 43 (threshold 15). Drivers by points: ternaries 15 (25 pts), if/else 12 (13 pts), boolean chains 5 (nesting depth added 11). Most of this is not in the body itself: 2 of the 43 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 299, 224, 255, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · videoRecallRuntime.createVideoRecallRuntime · ×1
  • videoRecallRuntime.createVideoRecallRuntime::apply (cognitive 43) invokeai/frontend/webv2/src/workbench/image-actions/videoRecallRuntime.ts:145 — videoRecallRuntime.createVideoRecallRuntime::apply has cognitive complexity 43 (threshold 15). Drivers by points: if/else 16 (21 pts), ternaries 7 (20 pts), boolean chains 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FluxDenoiseInvocation._run_diffusion (cognitive 42) · ×1
  • FluxDenoiseInvocation._run_diffusion (cognitive 42) invokeai/app/invocations/flux/flux_denoise.py:220 — FluxDenoiseInvocation._run_diffusion has cognitive complexity 42 (threshold 15). Drivers by points: if/else 25 (31 pts), ternaries 6 (7 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · GraphExecutionState._rehydrate_resolved_if_exec_branches (cognitive 42) · ×1
  • GraphExecutionState._rehydrate_resolved_if_exec_branches (cognitive 42) invokeai/app/services/shared/graph.py:3667 — GraphExecutionState._rehydrate_resolved_if_exec_branches has cognitive complexity 42 (threshold 15). Drivers by points: if/else 12 (35 pts), loops 3 (5 pts), ternaries 1 (2 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · aac_splice._read_audio_track (cognitive 42) · ×1
  • aac_splice._read_audio_track (cognitive 42) invokeai/app/util/aac_splice.py:145 — aac_splice._read_audio_track has cognitive complexity 42 (threshold 15). Drivers by points: if/else 19 (24 pts), boolean chains 12, ternaries 4 (5 pts), loops 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Qwen3EncoderGGUFLoader._load_from_gguf (cognitive 42) · ×1
  • Qwen3EncoderGGUFLoader._load_from_gguf (cognitive 42) invokeai/backend/model_manager/load/model_loaders/z_image.py:1419 — Qwen3EncoderGGUFLoader._load_from_gguf has cognitive complexity 42 (threshold 15). Drivers by points: if/else 19 (28 pts), boolean chains 4, error handling 1 (4 pts), ternaries 4, loops 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · calibrate_vae_tiling_working_memory._summarize (cognitive 42) · ×1
  • calibrate_vae_tiling_working_memory._summarize (cognitive 42) scripts/calibrate_vae_tiling_working_memory.py:561 — calibrate_vae_tiling_working_memory._summarize has cognitive complexity 42 (threshold 15). Drivers by points: if/else 10 (27 pts), loops 5 (10 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · dynamicPromptSyntax.scanDynamicPromptSyntax (cognitive 42) · ×1
  • dynamicPromptSyntax.scanDynamicPromptSyntax (cognitive 42) invokeai/frontend/webv2/src/features/generation/core/prompt/dynamicPromptSyntax.ts:57 — dynamicPromptSyntax.scanDynamicPromptSyntax has cognitive complexity 42 (threshold 15). Drivers by points: if/else 13 (26 pts), ternaries 3 (9 pts), boolean chains 4, loops 3 (nesting depth added 19). Of this number, 40 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DefaultSettingsSection.DefaultSettingsSection (cognitive 42) · ×1
  • DefaultSettingsSection.DefaultSettingsSection (cognitive 42) invokeai/frontend/webv2/src/features/models/ui/detail/DefaultSettingsSection.tsx:160 — DefaultSettingsSection.DefaultSettingsSection has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 18 (27 pts), boolean chains 8, if/else 7 (nesting depth added 9). Most of this is not in the body itself: 7 of the 42 points are its own statements and the rest belongs to 10 function items inside it that branch (a function literal at line 316, a function literal at line 188, retrySchedulerRules, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · runtime.createQueueRuntime.synchronizeRunPersistence (cognitive 42) · ×1
  • runtime.createQueueRuntime.synchronizeRunPersistence (cognitive 42) invokeai/frontend/webv2/src/features/queue/runtime.ts:1987 — runtime.createQueueRuntime.synchronizeRunPersistence has cognitive complexity 42 (threshold 15). Drivers by points: if/else 13 (30 pts), boolean chains 7, loops 4 (5 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · prepareCanvasInvocation.runCanvasInvocation (cognitive 42) · ×1
  • prepareCanvasInvocation.runCanvasInvocation (cognitive 42) invokeai/frontend/webv2/src/workbench/widgets/canvas/invoke/prepareCanvasInvocation.ts:323 — prepareCanvasInvocation.runCanvasInvocation has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 11 (35 pts), if/else 4 (5 pts), boolean chains 1, error handling 1 (nesting depth added 25). Of this number, 40 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · controlPanelModel.deriveModel (cognitive 42) · ×1
  • controlPanelModel.deriveModel (cognitive 42) invokeai/frontend/webv2/src/workbench/widgets/layers/controlPanelModel.ts:233 — controlPanelModel.deriveModel has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 16 (34 pts), boolean chains 4, if/else 2 (3 pts), match/switch 1 (nesting depth added 19). Of this number, 41 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InvokeImageBlendInvocation.apply_blend (cognitive 41) · ×1
  • InvokeImageBlendInvocation.apply_blend (cognitive 41) invokeai/app/invocations/composition-nodes.py:679 — InvokeImageBlendInvocation.apply_blend has cognitive complexity 41 (threshold 15). Drivers by points: if/else 19 (30 pts), ternaries 4 (8 pts), boolean chains 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Graph._is_for_connection_valid (cognitive 41) · ×1
  • Graph._is_for_connection_valid (cognitive 41) invokeai/app/services/shared/graph_validation.py:1384 — Graph._is_for_connection_valid has cognitive complexity 41 (threshold 15). Drivers by points: if/else 16 (26 pts), boolean chains 7, loops 5 (7 pts), ternaries 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ControlNetModel.forward (cognitive 41) · ×1
  • ControlNetModel.forward (cognitive 41) invokeai/backend/util/hotfixes.py:570 — ControlNetModel.forward has cognitive complexity 41 (threshold 15). Drivers by points: if/else 21 (30 pts), ternaries 3 (7 pts), boolean chains 2, loops 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UseDefaultSettingsButton.UseDefaultSettingsButton (cognitive 41) · ×1
  • UseDefaultSettingsButton.UseDefaultSettingsButton (cognitive 41) invokeai/frontend/webv1/src/features/parameters/components/MainModel/UseDefaultSettingsButton.tsx:24 — UseDefaultSettingsButton.UseDefaultSettingsButton has cognitive complexity 41 (threshold 15). Drivers by points: if/else 16 (26 pts), boolean chains 14, ternaries 1 (nesting depth added 10). Most of this is not in the body itself: 1 of the 41 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 62, 133, 40, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · useCompareLoupe.useCompareLoupe (cognitive 41) · ×1
  • useCompareLoupe.useCompareLoupe (cognitive 41) invokeai/frontend/webv2/src/workbench/widgets/preview/useCompareLoupe.ts:57 — useCompareLoupe.useCompareLoupe has cognitive complexity 41 (threshold 15). Drivers by points: if/else 24 (28 pts), boolean chains 8, loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 6). Most of this is not in the body itself: 1 of the 41 points is its own statement and the rest belongs to 9 function literals inside it that branch (lines 399, 210, 323, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · layerRasterizer.createLayerRasterizer.getOrStartLayerRasterization (cognitive 41) · ×1
  • layerRasterizer.createLayerRasterizer.getOrStartLayerRasterization (cognitive 41) invokeai/frontend/webv2/src/workbench/canvas-engine/layerRasterizer.ts:138 — layerRasterizer.createLayerRasterizer.getOrStartLayerRasterization has cognitive complexity 41 (threshold 15). Drivers by points: if/else 12 (18 pts), ternaries 5 (10 pts), boolean chains 9, error handling 2 (4 pts) (nesting depth added 13). Most of this is not in the body itself: 11 of the 41 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 216, 185). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · generationComposite.composeForGeneration (cognitive 41) · ×1
  • generationComposite.composeForGeneration (cognitive 41) invokeai/frontend/webv2/src/workbench/canvas-operations/generationComposite.ts:144 — generationComposite.composeForGeneration has cognitive complexity 41 (threshold 15). Drivers by points: if/else 13 (21 pts), loops 8 (10 pts), boolean chains 6, ternaries 2 (3 pts), error handling 1 (nesting depth added 11). Of this number, 37 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GraphExecutionState.apply (cognitive 40) · ×1
  • GraphExecutionState.apply (cognitive 40) invokeai/app/services/shared/graph.py:3153 — GraphExecutionState.apply has cognitive complexity 40 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 9, ternaries 3 (8 pts), error handling 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · graph_if_runtime._get_effective_iteration_paths_for_edge (cognitive 40) · ×1
  • graph_if_runtime._get_effective_iteration_paths_for_edge (cognitive 40) invokeai/app/services/shared/graph_if_runtime.py:300 — graph_if_runtime._get_effective_iteration_paths_for_edge has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (27 pts), boolean chains 5, loops 2 (4 pts), ternaries 2 (4 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · working_memory_calibration_plan.build_plan (cognitive 40) · ×1
  • working_memory_calibration_plan.build_plan (cognitive 40) invokeai/app/services/working_memory_calibration/working_memory_calibration_plan.py:570 — working_memory_calibration_plan.build_plan has cognitive complexity 40 (threshold 15). Drivers by points: if/else 14 (18 pts), ternaries 6 (10 pts), boolean chains 9, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AdvancedSettingsAccordion.AdvancedSettingsAccordion (cognitive 40) · ×1
  • AdvancedSettingsAccordion.AdvancedSettingsAccordion (cognitive 40) invokeai/frontend/webv1/src/features/settingsAccordions/components/AdvancedSettingsAccordion/AdvancedSettingsAccordion.tsx:69 — AdvancedSettingsAccordion.AdvancedSettingsAccordion has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 18 (nesting depth added 10). Of this number, 16 points are the body's own statements and 24 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mock-working-memory.createWorkingMemoryMock.calibrate (cognitive 40) · ×1
  • mock-working-memory.createWorkingMemoryMock.calibrate (cognitive 40) invokeai/frontend/webv2/scripts/mock-working-memory.mjs:710 — mock-working-memory.createWorkingMemoryMock.calibrate has cognitive complexity 40 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 13, ternaries 4 (6 pts), loops 1 (2 pts) (nesting depth added 9). Of this number, 36 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · runtime.createQueueRuntime.submitQueueItem (cognitive 40) · ×1
  • runtime.createQueueRuntime.submitQueueItem (cognitive 40) invokeai/frontend/webv2/src/features/queue/runtime.ts:1806 — runtime.createQueueRuntime.submitQueueItem has cognitive complexity 40 (threshold 15). Drivers by points: if/else 25 (28 pts), boolean chains 10, ternaries 2 (nesting depth added 3). Of this number, 16 points are the body's own statements and 24 belong to 4 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · WorkflowLibraryThumbnail.WorkflowLibraryThumbnail (cognitive 40) · ×1
  • WorkflowLibraryThumbnail.WorkflowLibraryThumbnail (cognitive 40) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryThumbnail.tsx:47 — WorkflowLibraryThumbnail.WorkflowLibraryThumbnail has cognitive complexity 40 (threshold 15). Drivers by points: ternaries 13 (20 pts), if/else 9 (10 pts), boolean chains 9, error handling 1 (nesting depth added 8). Of this number, 26 points are the body's own statements and 14 belong to 6 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · indexedDbDraftStore.createIndexedDbProjectDraftStore.stage (cognitive 40) · ×1
  • indexedDbDraftStore.createIndexedDbProjectDraftStore.stage (cognitive 40) invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:1275 — indexedDbDraftStore.createIndexedDbProjectDraftStore.stage has cognitive complexity 40 (threshold 15). Drivers by points: if/else 15 (20 pts), ternaries 5 (10 pts), boolean chains 9, error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rasterComposite.renderRasterComposite (cognitive 40) · ×1
  • rasterComposite.renderRasterComposite (cognitive 40) invokeai/frontend/webv2/src/workbench/canvas-engine/render/rasterComposite.ts:457 — rasterComposite.renderRasterComposite has cognitive complexity 40 (threshold 15). Drivers by points: if/else 17 (27 pts), ternaries 4 (6 pts), loops 4, boolean chains 3 (nesting depth added 12). None of this is in the body itself: all 40 points belong to 6 function items inside it that branch (renderRange, drawLayer, drawSpatialScope, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · GeneratedResultController.commit (cognitive 40) · ×1
  • GeneratedResultController.commit (cognitive 40) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/generatedResultController.ts:56 — GeneratedResultController.commit has cognitive complexity 40 (threshold 15). Drivers by points: if/else 21 (26 pts), ternaries 6 (9 pts), boolean chains 4, error handling 1 (nesting depth added 8). Of this number, 32 points are the body's own statements and 8 belong to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · alphaFill.propagateNearestVisibleLabels (cognitive 40) · ×1
  • alphaFill.propagateNearestVisibleLabels (cognitive 40) invokeai/frontend/webv2/src/workbench/canvas-engine/render/spatial/alphaFill.ts:28 — alphaFill.propagateNearestVisibleLabels has cognitive complexity 40 (threshold 15). Drivers by points: if/else 6 (22 pts), loops 6 (12 pts), boolean chains 6 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · model_manager.get_is_installed (cognitive 39) · ×1
  • model_manager.get_is_installed (cognitive 39) invokeai/app/api/routers/model_manager.py:1484 — model_manager.get_is_installed has cognitive complexity 39 (threshold 15). Drivers by points: if/else 9 (30 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · CreateGradientMaskInvocation.invoke (cognitive 39) · ×1
  • CreateGradientMaskInvocation.invoke (cognitive 39) invokeai/app/invocations/sd/create_gradient_mask.py:80 — CreateGradientMaskInvocation.invoke has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 4 (14 pts), boolean chains 2 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · workflow_call_batch.build_batch_child_workflow_session_results (cognitive 39) · ×1
  • workflow_call_batch.build_batch_child_workflow_session_results (cognitive 39) invokeai/app/services/session_processor/workflow_call_batch.py:517 — workflow_call_batch.build_batch_child_workflow_session_results has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (27 pts), ternaries 2 (6 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _ExecutionNodeBuilder._attach_pending_if_inputs (cognitive 39) · ×1
  • _ExecutionNodeBuilder._attach_pending_if_inputs (cognitive 39) invokeai/app/services/shared/graph_materializer.py:1934 — _ExecutionNodeBuilder._attach_pending_if_inputs has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (29 pts), loops 3 (7 pts), boolean chains 3 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MistralEncoderCheckpointLoader._load_text_encoder (cognitive 39) · ×1
  • MistralEncoderCheckpointLoader._load_text_encoder (cognitive 39) REDACTED:1149 — MistralEncoderCheckpointLoader._load_text_encoder has cognitive complexity 39 (threshold 15). Drivers by points: if/else 16 (24 pts), boolean chains 6, loops 3 (5 pts), error handling 1 (4 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Qwen3EncoderSDNQLoader._load_from_sdnq (cognitive 39) · ×1
  • Qwen3EncoderSDNQLoader._load_from_sdnq (cognitive 39) invokeai/backend/model_manager/load/model_loaders/z_image.py:1624 — Qwen3EncoderSDNQLoader._load_from_sdnq has cognitive complexity 39 (threshold 15). Drivers by points: if/else 18 (27 pts), error handling 1 (4 pts), ternaries 4, boolean chains 2, loops 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · dnd-hooks.useBuilderDndMonitor (cognitive 39) · ×1
  • dnd-hooks.useBuilderDndMonitor (cognitive 39) invokeai/frontend/webv1/src/features/nodes/components/sidePanel/builder/dnd-hooks.ts:203 — dnd-hooks.useBuilderDndMonitor has cognitive complexity 39 (threshold 15). Drivers by points: if/else 16 (28 pts), ternaries 3 (9 pts), boolean chains 2 (nesting depth added 18). None of this is in the body itself: all 39 points belong to 2 function literals inside it that branch (lines 224, 223). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · buildSDXLGraph.buildSDXLGraph (cognitive 39) · ×1
  • buildSDXLGraph.buildSDXLGraph (cognitive 39) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildSDXLGraph.ts:41 — buildSDXLGraph.buildSDXLGraph has cognitive complexity 39 (threshold 15). Drivers by points: if/else 26 (33 pts), ternaries 4, boolean chains 2 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · GraphPreviewOpenAsMenu.GraphPreviewOpenAsMenu (cognitive 39) · ×1
  • GraphPreviewOpenAsMenu.GraphPreviewOpenAsMenu (cognitive 39) invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/GraphPreviewOpenAsMenu.tsx:51 — GraphPreviewOpenAsMenu.GraphPreviewOpenAsMenu has cognitive complexity 39 (threshold 15). Drivers by points: if/else 26 (29 pts), ternaries 5 (6 pts), boolean chains 4 (nesting depth added 4). Most of this is not in the body itself: 5 of the 39 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 115, 215, 179, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · draftStore.createMemoryProjectDraftStore.retargetAcknowledgedCopy (cognitive 39) · ×1
  • draftStore.createMemoryProjectDraftStore.retargetAcknowledgedCopy (cognitive 39) invokeai/frontend/webv2/src/workbench/projects/draftStore.ts:1355 — draftStore.createMemoryProjectDraftStore.retargetAcknowledgedCopy has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (20 pts), ternaries 4 (9 pts), boolean chains 8, error handling 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · store.normalizeWorkbenchPreferences (cognitive 39) · ×1
  • store.normalizeWorkbenchPreferences (cognitive 39) invokeai/frontend/webv2/src/workbench/settings/store.ts:372 — store.normalizeWorkbenchPreferences has cognitive complexity 39 (threshold 15). Drivers by points: ternaries 34 (36 pts), boolean chains 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ControlLayerCanvasOverlay.SelectedControlLayerOverlay (cognitive 39) · ×1
  • ControlLayerCanvasOverlay.SelectedControlLayerOverlay (cognitive 39) invokeai/frontend/webv2/src/workbench/widgets/canvas/ControlLayerCanvasOverlay.tsx:64 — ControlLayerCanvasOverlay.SelectedControlLayerOverlay has cognitive complexity 39 (threshold 15). Drivers by points: ternaries 19 (31 pts), boolean chains 7, if/else 1 (nesting depth added 12). Of this number, 32 points are the body's own statements and 7 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FilterResultController.commit (cognitive 39) · ×1
  • FilterResultController.commit (cognitive 39) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/filterResultController.ts:66 — FilterResultController.commit has cognitive complexity 39 (threshold 15). Drivers by points: if/else 20 (24 pts), boolean chains 7, ternaries 4 (7 pts), error handling 1 (nesting depth added 7). Of this number, 36 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · groupSurfaceCache.createGroupSurfaceCache.damagedRegion (cognitive 39) · ×1
  • groupSurfaceCache.createGroupSurfaceCache.damagedRegion (cognitive 39) invokeai/frontend/webv2/src/workbench/canvas-engine/render/groupSurfaceCache.ts:566 — groupSurfaceCache.createGroupSurfaceCache.damagedRegion has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (27 pts), loops 4 (8 pts), boolean chains 4 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Krea2LoRACollectionLoader.invoke (cognitive 38) · ×1
  • Krea2LoRACollectionLoader.invoke (cognitive 38) invokeai/app/invocations/krea2/krea2_lora_loader.py:132 — Krea2LoRACollectionLoader.invoke has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (24 pts), ternaries 4 (8 pts), boolean chains 5, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · h264_splice._read_video_stbl (cognitive 38) · ×1
  • h264_splice._read_video_stbl (cognitive 38) invokeai/app/util/h264_splice.py:344 — h264_splice._read_video_stbl has cognitive complexity 38 (threshold 15). Drivers by points: if/else 22 (29 pts), boolean chains 7, loops 1, ternaries 1 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Flux2CheckpointModel._load_from_singlefile (cognitive 38) · ×1
  • Flux2CheckpointModel._load_from_singlefile (cognitive 38) invokeai/backend/model_manager/load/model_loaders/flux.py:1261 — Flux2CheckpointModel._load_from_singlefile has cognitive complexity 38 (threshold 15). Drivers by points: if/else 21 (29 pts), boolean chains 7, ternaries 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · loaders._infer_quantization_type (cognitive 38) · ×1
  • loaders._infer_quantization_type (cognitive 38) invokeai/backend/quantization/sdnq/loaders.py:70 — loaders._infer_quantization_type has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (28 pts), boolean chains 6, ternaries 2 (4 pts) (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · GalleryThumbnail.GalleryThumbnail (cognitive 38) · ×1
  • GalleryThumbnail.GalleryThumbnail (cognitive 38) invokeai/frontend/webv2/src/features/gallery/ui/GalleryThumbnail.tsx:76 — GalleryThumbnail.GalleryThumbnail has cognitive complexity 38 (threshold 15). Drivers by points: ternaries 18, if/else 10 (11 pts), boolean chains 9 (nesting depth added 1). Of this number, 18 points are the body's own statements and 20 belong to 14 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · compileCanvasGraph.getCanvasValidationReasons (cognitive 38) · ×1
  • compileCanvasGraph.getCanvasValidationReasons (cognitive 38) invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.ts:145 — compileCanvasGraph.getCanvasValidationReasons has cognitive complexity 38 (threshold 15). Drivers by points: if/else 18 (25 pts), boolean chains 13 (nesting depth added 7). Of this number, 37 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · graphInputMedia.collectSubmissionInputMediaNames (cognitive 38) · ×1
  • graphInputMedia.collectSubmissionInputMediaNames (cognitive 38) invokeai/frontend/webv2/src/features/queue/core/graphInputMedia.ts:19 — graphInputMedia.collectSubmissionInputMediaNames has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 6 (14 pts), boolean chains 4, ternaries 1 (nesting depth added 17). Of this number, 30 points are the body's own statements and 8 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkflowWidgetChrome.WorkflowDialogHost (cognitive 38) · ×1
  • WorkflowWidgetChrome.WorkflowDialogHost (cognitive 38) invokeai/frontend/webv2/src/features/workflow/ui/WorkflowWidgetChrome.tsx:405 — WorkflowWidgetChrome.WorkflowDialogHost has cognitive complexity 38 (threshold 15). Drivers by points: ternaries 9 (16 pts), if/else 13 (15 pts), boolean chains 7 (nesting depth added 9). Most of this is not in the body itself: 3 of the 38 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 487, 585, 440, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · bitmapStore.createBitmapStore.flushLayer (cognitive 38) · ×1
  • bitmapStore.createBitmapStore.flushLayer (cognitive 38) invokeai/frontend/webv2/src/workbench/canvas-engine/document/bitmapStore.ts:397 — bitmapStore.createBitmapStore.flushLayer has cognitive complexity 38 (threshold 15). Drivers by points: if/else 18 (22 pts), boolean chains 8, error handling 4 (5 pts), ternaries 2 (3 pts) (nesting depth added 6). Of this number, 36 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · createCanvasEngine.createCanvasEngine (cognitive 38) · ×1
  • createCanvasEngine.createCanvasEngine (cognitive 38) invokeai/frontend/webv2/src/workbench/canvas-operations/createCanvasEngine.ts:81 — createCanvasEngine.createCanvasEngine has cognitive complexity 38 (threshold 15). Drivers by points: if/else 14 (17 pts), ternaries 12 (15 pts), boolean chains 3, error handling 2, loops 1 (nesting depth added 6). Most of this is not in the body itself: 3 of the 38 points are its own statements and the rest belongs to 15 function items inside it that branch (a function literal at line 161, resolveUploadProjectId, uploadImage, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · QwenImage21DenoiseInvocation._run_diffusion (cognitive 37) · ×1
  • QwenImage21DenoiseInvocation._run_diffusion (cognitive 37) invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_denoise.py:323 — QwenImage21DenoiseInvocation._run_diffusion has cognitive complexity 37 (threshold 15). Drivers by points: if/else 11 (15 pts), ternaries 10 (12 pts), boolean chains 9, loops 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · _ExecutionNodeBuilder._materialize_root_if_for_completed_collect_branch (cognitive 37) · ×1
  • _ExecutionNodeBuilder._materialize_root_if_for_completed_collect_branch (cognitive 37) invokeai/app/services/shared/graph_materializer.py:2247 — _ExecutionNodeBuilder._materialize_root_if_for_completed_collect_branch has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (25 pts), loops 6 (9 pts), boolean chains 3 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · color.restore_lightness (cognitive 37) · ×1
  • color.restore_lightness (cognitive 37) invokeai/backend/image_util/color.py:70 — color.restore_lightness has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16 (27 pts), boolean chains 6, ternaries 2, error handling 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Krea2CheckpointModel._load_from_singlefile (cognitive 37) · ×1
  • Krea2CheckpointModel._load_from_singlefile (cognitive 37) invokeai/backend/model_manager/load/model_loaders/krea2.py:541 — Krea2CheckpointModel._load_from_singlefile has cognitive complexity 37 (threshold 15). Drivers by points: if/else 20 (32 pts), boolean chains 5 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · loaders.parse_gguf_convrot_markers (cognitive 37) · ×1
  • loaders.parse_gguf_convrot_markers (cognitive 37) invokeai/backend/quantization/gguf/loaders.py:165 — loaders.parse_gguf_convrot_markers has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 6, ternaries 1 (4 pts), error handling 1 (2 pts), loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · loaders.gguf_sd_loader (cognitive 37) · ×1
  • loaders.gguf_sd_loader (cognitive 37) invokeai/backend/quantization/gguf/loaders.py:290 — loaders.gguf_sd_loader has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (20 pts), ternaries 4 (11 pts), boolean chains 4, loops 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · calibrate_flux3_denoise_working_memory._summarize_fit (cognitive 37) · ×1
  • calibrate_flux3_denoise_working_memory._summarize_fit (cognitive 37) scripts/calibrate_flux3_denoise_working_memory.py:597 — calibrate_flux3_denoise_working_memory._summarize_fit has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (24 pts), loops 5 (7 pts), boolean chains 3, ternaries 1 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CurrentVideoPreview.CurrentVideoPreview (cognitive 37) · ×1
  • CurrentVideoPreview.CurrentVideoPreview (cognitive 37) invokeai/frontend/webv1/src/features/gallery/components/ImageViewer/CurrentVideoPreview.tsx:66 — CurrentVideoPreview.CurrentVideoPreview has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16, boolean chains 15, error handling 4 (6 pts) (nesting depth added 2). Most of this is not in the body itself: 9 of the 37 points are its own statements and the rest belongs to 12 function literals inside it that branch (lines 263, 315, 367, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · buildQwenImageGraph.buildQwenImageGraph (cognitive 37) · ×1
  • buildQwenImageGraph.buildQwenImageGraph (cognitive 37) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildQwenImageGraph.ts:87 — buildQwenImageGraph.buildQwenImageGraph has cognitive complexity 37 (threshold 15). Drivers by points: if/else 19 (25 pts), ternaries 4 (6 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 9). Of this number, 36 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · index.dynamicBaseQuery (cognitive 37) · ×1
  • index.dynamicBaseQuery (cognitive 37) invokeai/frontend/webv1/src/services/api/index.ts:99 — index.dynamicBaseQuery has cognitive complexity 37 (threshold 15). Drivers by points: boolean chains 20, if/else 9 (13 pts), ternaries 4 (nesting depth added 4). Of this number, 35 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · OverviewPane.ConnectedOverview (cognitive 37) · ×1
  • OverviewPane.ConnectedOverview (cognitive 37) invokeai/frontend/webv2/src/workbench/widgets/layers/panes/OverviewPane.tsx:60 — OverviewPane.ConnectedOverview has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16 (18 pts), ternaries 6 (12 pts), boolean chains 6, loops 1 (nesting depth added 8). None of this is in the body itself: all 37 points belong to 13 function literals inside it that branch (lines 244, 135, 124, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · projectFile.importProjectFile (cognitive 37) · ×1
  • projectFile.importProjectFile (cognitive 37) invokeai/frontend/webv2/src/workbench/projects/projectFile.ts:283 — projectFile.importProjectFile has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (17 pts), ternaries 10 (12 pts), boolean chains 7, error handling 1 (nesting depth added 7). Of this number, 35 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · recall_parameters.update_recall_parameters (cognitive 36) · ×1
  • recall_parameters.update_recall_parameters (cognitive 36) invokeai/app/api/routers/recall_parameters.py:380 — recall_parameters.update_recall_parameters has cognitive complexity 36 (threshold 15). Drivers by points: if/else 18 (25 pts), error handling 4 (5 pts), boolean chains 3, ternaries 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · session_queue.strip_missing_image_results (cognitive 36) · ×1
  • session_queue.strip_missing_image_results (cognitive 36) invokeai/app/api/routers/session_queue.py:81 — session_queue.strip_missing_image_results has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 6, ternaries 3 (6 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InvokeAdjustImageHuePlusInvocation.invoke (cognitive 36) · ×1
  • InvokeAdjustImageHuePlusInvocation.invoke (cognitive 36) invokeai/app/invocations/composition-nodes.py:85 — InvokeAdjustImageHuePlusInvocation.invoke has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (22 pts), boolean chains 8, ternaries 3 (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.
D2 · Cognitive Complexity · InvokeImageCompositorInvocation.invoke (cognitive 36) · ×1
  • InvokeImageCompositorInvocation.invoke (cognitive 36) invokeai/app/invocations/composition-nodes.py:1312 — InvokeImageCompositorInvocation.invoke has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 10, loops 3 (8 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MiniMaxH3ReferenceConditioningInvocation.invoke (cognitive 36) · ×1
  • MiniMaxH3ReferenceConditioningInvocation.invoke (cognitive 36) invokeai/app/invocations/minimax_h3/minimax_h3_reference.py:348 — MiniMaxH3ReferenceConditioningInvocation.invoke has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (28 pts), loops 4 (7 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · graph_iterate_planner._get_body_iterate_collect_fan_in (cognitive 36) · ×1
  • graph_iterate_planner._get_body_iterate_collect_fan_in (cognitive 36) invokeai/app/services/shared/graph_iterate_planner.py:80 — graph_iterate_planner._get_body_iterate_collect_fan_in has cognitive complexity 36 (threshold 15). Drivers by points: if/else 17 (28 pts), boolean chains 7, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · workflow_graph_builder._collect_exposed_inputs_from_form (cognitive 36) · ×1
  • workflow_graph_builder._collect_exposed_inputs_from_form (cognitive 36) invokeai/app/services/shared/workflow_graph_builder.py:66 — workflow_graph_builder._collect_exposed_inputs_from_form has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (29 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · sampling.build_ref2va_denoise_state (cognitive 36) · ×1
  • sampling.build_ref2va_denoise_state (cognitive 36) invokeai/backend/minimax_h3/sampling.py:290 — sampling.build_ref2va_denoise_state has cognitive complexity 36 (threshold 15). Drivers by points: if/else 17 (31 pts), boolean chains 4, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · build_shipped.build_points (cognitive 36) · ×1
  • build_shipped.build_points (cognitive 36) scripts/working_memory/build_shipped.py:223 — build_shipped.build_points has cognitive complexity 36 (threshold 15). Drivers by points: if/else 6 (18 pts), ternaries 4 (9 pts), loops 3 (4 pts), error handling 1 (3 pts), boolean chains 2 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · modelSettingsIO.validateImportData (cognitive 36) · ×1
  • modelSettingsIO.validateImportData (cognitive 36) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/modelSettingsIO.ts:100 — modelSettingsIO.validateImportData has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (24 pts), boolean chains 12 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · useEnqueueWorkflows.getBatchDataForWorkflowGeneration (cognitive 36) · ×1
  • useEnqueueWorkflows.getBatchDataForWorkflowGeneration (cognitive 36) invokeai/frontend/webv1/src/features/queue/hooks/useEnqueueWorkflows.ts:15 — useEnqueueWorkflows.getBatchDataForWorkflowGeneration has cognitive complexity 36 (threshold 15). Drivers by points: if/else 6 (20 pts), loops 4 (11 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 23). Of this number, 35 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · settings.normalizeUpscaleWidgetValues (cognitive 36) · ×1
  • settings.normalizeUpscaleWidgetValues (cognitive 36) invokeai/frontend/webv2/src/features/upscale/core/settings.ts:785 — settings.normalizeUpscaleWidgetValues has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 30 (34 pts), boolean chains 1, if/else 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · outputImages.visitOutputImageNames (cognitive 36) · ×1
  • outputImages.visitOutputImageNames (cognitive 36) invokeai/frontend/webv2/src/platform/core/outputImages.ts:10 — outputImages.visitOutputImageNames has cognitive complexity 36 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 8, loops 2 (4 pts), ternaries 1 (nesting depth added 7). Of this number, 18 points are the body's own statements and 18 belong to 4 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · StagingBar.StagingBar (cognitive 36) · ×1
  • StagingBar.StagingBar (cognitive 36) invokeai/frontend/webv2/src/workbench/widgets/canvas/StagingBar.tsx:121 — StagingBar.StagingBar has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 24 (43 pts), if/else 13 (16 pts), boolean chains 10 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (StagingBar.StagingBar::handleKeyDown) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · adjustments.applyPixelRgbNoise (cognitive 36) · ×1
  • adjustments.applyPixelRgbNoise (cognitive 36) invokeai/frontend/webv2/src/workbench/canvas-engine/render/adjustments.ts:860 — adjustments.applyPixelRgbNoise has cognitive complexity 36 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 5 (13 pts), boolean chains 1, ternaries 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TextOptions.TextFontSettings (cognitive 36) · ×1
  • TextOptions.TextFontSettings (cognitive 36) invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/TextOptions.tsx:566 — TextOptions.TextFontSettings has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 9 (14 pts), boolean chains 12, if/else 9 (10 pts) (nesting depth added 6). Most of this is not in the body itself: 11 of the 36 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 637, 680, 705, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · LTX2DenoiseInvocation.invoke (cognitive 35) · ×1
  • LTX2DenoiseInvocation.invoke (cognitive 35) invokeai/app/invocations/ltx2/ltx2_denoise.py:398 — LTX2DenoiseInvocation.invoke has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 11 (17 pts), if/else 11 (12 pts), boolean chains 6 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · VideoConcatInvocation._build_audio_track (cognitive 35) · ×1
  • VideoConcatInvocation._build_audio_track (cognitive 35) invokeai/app/invocations/video_concat.py:699 — VideoConcatInvocation._build_audio_track has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (21 pts), ternaries 4 (8 pts), boolean chains 3, loops 3 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DefaultSessionProcessor._process (cognitive 35) · ×1
  • DefaultSessionProcessor._process (cognitive 35) invokeai/app/services/session_processor/session_processor_default.py:1386 — DefaultSessionProcessor._process has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (28 pts), error handling 2 (3 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · graph_if_runtime._validate_frame_axes (cognitive 35) · ×1
  • graph_if_runtime._validate_frame_axes (cognitive 35) invokeai/app/services/shared/graph_if_runtime.py:78 — graph_if_runtime._validate_frame_axes has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (22 pts), ternaries 2 (6 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · quantized_loading.load_bnb4bit_state_dict (cognitive 35) · ×1
  • quantized_loading.load_bnb4bit_state_dict (cognitive 35) invokeai/backend/ideogram4/quantized_loading.py:67 — quantized_loading.load_bnb4bit_state_dict has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (20 pts), ternaries 3 (8 pts), loops 4, boolean chains 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Flux2GGUFCheckpointModel._load_from_singlefile (cognitive 35) · ×1
  • Flux2GGUFCheckpointModel._load_from_singlefile (cognitive 35) invokeai/backend/model_manager/load/model_loaders/flux.py:1815 — Flux2GGUFCheckpointModel._load_from_singlefile has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 7 (18 pts), if/else 11 (15 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ZImageDiffusersModel._load_sdnq_text_encoder (cognitive 35) · ×1
  • ZImageDiffusersModel._load_sdnq_text_encoder (cognitive 35) invokeai/backend/model_manager/load/model_loaders/z_image.py:297 — ZImageDiffusersModel._load_sdnq_text_encoder has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (23 pts), error handling 1 (4 pts), ternaries 4, boolean chains 2, loops 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StableDiffusionGeneratorPipeline.step (cognitive 35) · ×1
  • StableDiffusionGeneratorPipeline.step (cognitive 35) invokeai/backend/stable_diffusion/diffusers_pipeline.py:438 — StableDiffusionGeneratorPipeline.step has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (23 pts), loops 3 (8 pts), ternaries 1 (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.
D2 · Cognitive Complexity · RasterLayerCurvesAdjustmentsGraph.drawHistogram (cognitive 35) · ×1
  • RasterLayerCurvesAdjustmentsGraph.drawHistogram (cognitive 35) invokeai/frontend/webv1/src/features/controlLayers/components/RasterLayer/RasterLayerCurvesAdjustmentsGraph.tsx:63 — RasterLayerCurvesAdjustmentsGraph.drawHistogram has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 7 (14 pts), ternaries 1 (4 pts), boolean chains 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · useConnection.useConnection (cognitive 35) · ×1
  • useConnection.useConnection (cognitive 35) invokeai/frontend/webv1/src/features/nodes/hooks/useConnection.ts:27 — useConnection.useConnection has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (17 pts), ternaries 7 (13 pts), boolean chains 5 (nesting depth added 11). None of this is in the body itself: all 35 points belong to 2 function literals inside it that branch (lines 108, 33). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · addOutpaint.addOutpaint (cognitive 35) · ×1
  • addOutpaint.addOutpaint (cognitive 35) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/addOutpaint.ts:39 — addOutpaint.addOutpaint has cognitive complexity 35 (threshold 15). Drivers by points: if/else 17 (25 pts), ternaries 3 (7 pts), boolean chains 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · useGalleryGridHotkeys.useGalleryGridHotkeys (cognitive 35) · ×1
  • useGalleryGridHotkeys.useGalleryGridHotkeys (cognitive 35) invokeai/frontend/webv2/src/features/gallery/ui/useGalleryGridHotkeys.ts:73 — useGalleryGridHotkeys.useGalleryGridHotkeys has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (20 pts), ternaries 7 (10 pts), boolean chains 5 (nesting depth added 7). None of this is in the body itself: all 35 points belong to 6 function items inside it that branch (a function literal at line 205, a function literal at line 137, getRangeAnchorKey, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · GenerateReferenceImagesSection.GenerateReferenceImagesContent (cognitive 35) · ×1
  • GenerateReferenceImagesSection.GenerateReferenceImagesContent (cognitive 35) invokeai/frontend/webv2/src/features/generation/ui/reference-images/GenerateReferenceImagesSection.tsx:61 — GenerateReferenceImagesSection.GenerateReferenceImagesContent has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 18 (20 pts), if/else 10 (11 pts), boolean chains 4 (nesting depth added 3). Most of this is not in the body itself: 15 of the 35 points are its own statements and the rest belongs to 10 function items inside it that branch (addGalleryImages, a function literal at line 163, a function literal at line 177, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · VideoReferenceListField.ReferenceCard (cognitive 35) · ×1
  • VideoReferenceListField.ReferenceCard (cognitive 35) invokeai/frontend/webv2/src/features/video/ui/VideoReferenceListField.tsx:82 — VideoReferenceListField.ReferenceCard has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 16 (19 pts), boolean chains 8, if/else 8 (nesting depth added 3). Most of this is not in the body itself: 14 of the 35 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 216, 141, 158, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · validation.isValidLoopLinkageConnection (cognitive 35) · ×1
  • validation.isValidLoopLinkageConnection (cognitive 35) invokeai/frontend/webv2/src/features/workflow/core/validation.ts:370 — validation.isValidLoopLinkageConnection has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 11, ternaries 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GraphPreviewDialog.GraphPreviewDialog (cognitive 35) · ×1
  • GraphPreviewDialog.GraphPreviewDialog (cognitive 35) invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/GraphPreviewDialog.tsx:88 — GraphPreviewDialog.GraphPreviewDialog has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 17 (27 pts), if/else 6, boolean chains 2 (nesting depth added 10). Of this number, 27 points are the body's own statements and 8 belong to 6 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Picker.Picker (cognitive 35) · ×1
  • Picker.Picker (cognitive 35) invokeai/frontend/webv2/src/platform/ui/Picker.tsx:125 — Picker.Picker has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 13 (17 pts), if/else 9 (11 pts), boolean chains 6, loops 1 (nesting depth added 6). Of this number, 16 points are the body's own statements and 19 belong to 6 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · restoreProjectMedia.restoreProjectMedia (cognitive 35) · ×1
  • restoreProjectMedia.restoreProjectMedia (cognitive 35) invokeai/frontend/webv2/src/workbench/projects/invk/restoreProjectMedia.ts:204 — restoreProjectMedia.restoreProjectMedia has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (22 pts), loops 7 (9 pts), ternaries 3, error handling 1 (nesting depth added 10). Of this number, 26 points are the body's own statements and 9 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RasterExportController.rasterize (cognitive 35) · ×1
  • RasterExportController.rasterize (cognitive 35) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/rasterExportController.ts:167 — RasterExportController.rasterize has cognitive complexity 35 (threshold 15). Drivers by points: if/else 18 (19 pts), boolean chains 7, ternaries 4 (7 pts), error handling 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · selectObjectSession.createSelectObjectSession.runRequest (cognitive 35) · ×1
  • selectObjectSession.createSelectObjectSession.runRequest (cognitive 35) invokeai/frontend/webv2/src/workbench/canvas-operations/selectObjectSession.ts:282 — selectObjectSession.createSelectObjectSession.runRequest has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 10, ternaries 3 (5 pts), error handling 3 (nesting depth added 6). Most of this is not in the body itself: 13 of the 35 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 293, 355). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · imageRecall.getMetadataModelTuning (cognitive 35) · ×1
  • imageRecall.getMetadataModelTuning (cognitive 35) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:539 — imageRecall.getMetadataModelTuning has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 14 (27 pts), if/else 5, boolean chains 3 (nesting depth added 13). Of this number, 31 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · fields.InputField (cognitive 34) · ×1
  • fields.InputField (cognitive 34) invokeai/app/invocations/fields.py:934 — fields.InputField has cognitive complexity 34 (threshold 15). Drivers by points: if/else 24 (30 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · GalleryMaintenanceService._regenerate_thumbnails (cognitive 34) · ×1
  • GalleryMaintenanceService._regenerate_thumbnails (cognitive 34) invokeai/app/services/gallery_maintenance/gallery_maintenance_default.py:791 — GalleryMaintenanceService._regenerate_thumbnails has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (22 pts), error handling 2 (8 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _ExecutionNodeBuilder._get_known_iteration_path (cognitive 34) · ×1
  • _ExecutionNodeBuilder._get_known_iteration_path (cognitive 34) invokeai/app/services/shared/graph_materializer.py:118 — _ExecutionNodeBuilder._get_known_iteration_path has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (24 pts), loops 4 (7 pts), boolean chains 3 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _ExecutionNodeBuilder.create_nested_for_return (cognitive 34) · ×1
  • _ExecutionNodeBuilder.create_nested_for_return (cognitive 34) invokeai/app/services/shared/graph_materializer.py:543 — _ExecutionNodeBuilder.create_nested_for_return has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (24 pts), loops 5 (6 pts), boolean chains 3, ternaries 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _ExecutionNodeBuilder._create_serial_nested_iterate_body_iteration (cognitive 34) · ×1
  • _ExecutionNodeBuilder._create_serial_nested_iterate_body_iteration (cognitive 34) invokeai/app/services/shared/graph_materializer.py:771 — _ExecutionNodeBuilder._create_serial_nested_iterate_body_iteration has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (24 pts), loops 4 (6 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Flux2DiffusersModel._load_model (cognitive 34) · ×1
  • Flux2DiffusersModel._load_model (cognitive 34) invokeai/backend/model_manager/load/model_loaders/flux.py:1148 — Flux2DiffusersModel._load_model has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (29 pts), boolean chains 2, ternaries 2, error handling 1 (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · z_image._convert_z_image_gguf_to_diffusers (cognitive 34) · ×1
  • z_image._convert_z_image_gguf_to_diffusers (cognitive 34) invokeai/backend/model_manager/load/model_loaders/z_image.py:145 — z_image._convert_z_image_gguf_to_diffusers has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (28 pts), loops 2 (6 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · anima_lora_conversion_utils.lora_model_from_anima_state_dict (cognitive 34) · ×1
  • anima_lora_conversion_utils.lora_model_from_anima_state_dict (cognitive 34) invokeai/backend/patches/lora_conversions/anima_lora_conversion_utils.py:289 — anima_lora_conversion_utils.lora_model_from_anima_state_dict has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 4 (11 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InvokeAIDiffuserComponent.do_controlnet_step (cognitive 34) · ×1
  • InvokeAIDiffuserComponent.do_controlnet_step (cognitive 34) invokeai/backend/stable_diffusion/diffusion/shared_invokeai_diffusion.py:58 — InvokeAIDiffuserComponent.do_controlnet_step has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (29 pts), boolean chains 4, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CanvasToolModule.onKeyDown (cognitive 34) · ×1
  • CanvasToolModule.onKeyDown (cognitive 34) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasToolModule.ts:796 — CanvasToolModule.onKeyDown has cognitive complexity 34 (threshold 15). Drivers by points: if/else 18 (26 pts), boolean chains 8 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelInstallQueue.ModelInstallQueue (cognitive 34) · ×1
  • ModelInstallQueue.ModelInstallQueue (cognitive 34) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/AddModelPanel/ModelInstallQueue/ModelInstallQueue.tsx:75 — ModelInstallQueue.ModelInstallQueue has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 11, ternaries 3 (6 pts), error handling 1, loops 1 (nesting depth added 8). Most of this is not in the body itself: 8 of the 34 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 90, 127, 137, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · connectorTopology.getConnectorDeletionSpliceConnections (cognitive 34) · ×1
  • connectorTopology.getConnectorDeletionSpliceConnections (cognitive 34) invokeai/frontend/webv1/src/features/nodes/store/util/connectorTopology.ts:108 — connectorTopology.getConnectorDeletionSpliceConnections has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 7, loops 3 (4 pts) (nesting depth added 14). Of this number, 31 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · buildNodesGraph.buildNodesGraph (cognitive 34) · ×1
  • buildNodesGraph.buildNodesGraph (cognitive 34) invokeai/frontend/webv1/src/features/nodes/util/graph/buildNodesGraph.ts:48 — buildNodesGraph.buildNodesGraph has cognitive complexity 34 (threshold 15). Drivers by points: if/else 18 (21 pts), boolean chains 12, ternaries 1 (nesting depth added 3). None of this is in the body itself: all 34 points belong to 8 function literals inside it that branch (lines 68, 130, 55, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ModelPicker.ModelPicker (cognitive 34) · ×1
  • ModelPicker.ModelPicker (cognitive 34) invokeai/frontend/webv1/src/features/parameters/components/ModelPicker.tsx:166 — ModelPicker.ModelPicker has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (26 pts), boolean chains 5, loops 3 (nesting depth added 12). None of this is in the body itself: all 34 points belong to 5 function literals inside it that branch (lines 202, 287, 211, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · HotkeyListItem.HotkeyItem (cognitive 34) · ×1
  • HotkeyListItem.HotkeyItem (cognitive 34) invokeai/frontend/webv1/src/features/system/components/HotkeysModal/HotkeyListItem.tsx:92 — HotkeyListItem.HotkeyItem has cognitive complexity 34 (threshold 15). Drivers by points: if/else 16 (18 pts), ternaries 5 (11 pts), boolean chains 4, loops 1 (nesting depth added 8). Most of this is not in the body itself: 2 of the 34 points are its own statements and the rest belongs to 8 function items inside it that branch (renderHotkeyKeys, a function literal at line 151, a function literal at line 116, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · GalleryBoardRow.GalleryBoardRow (cognitive 34) · ×1
  • GalleryBoardRow.GalleryBoardRow (cognitive 34) invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardRow.tsx:42 — GalleryBoardRow.GalleryBoardRow has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 18 (24 pts), if/else 6, boolean chains 4 (nesting depth added 6). Of this number, 18 points are the body's own statements and 16 belong to 8 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · LayerChildRow.LayerChildRowComponent (cognitive 34) · ×1
  • LayerChildRow.LayerChildRowComponent (cognitive 34) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerChildRow.tsx:89 — LayerChildRow.LayerChildRowComponent has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 11 (13 pts), if/else 12, boolean chains 9 (nesting depth added 2). Most of this is not in the body itself: 14 of the 34 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 171, 192, 147, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · CropLayerController.cropAll (cognitive 34) · ×1
  • CropLayerController.cropAll (cognitive 34) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/cropLayerController.ts:282 — CropLayerController.cropAll has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 5, error handling 3 (4 pts), loops 3 (nesting depth added 9). Of this number, 33 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · documentIndex.deriveIndexForValueEdit (cognitive 34) · ×1
  • documentIndex.deriveIndexForValueEdit (cognitive 34) invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentIndex.ts:292 — documentIndex.deriveIndexForValueEdit has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 6 (8 pts), boolean chains 6, ternaries 5 (nesting depth added 9). Of this number, 27 points are the body's own statements and 7 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PsdExportController.export (cognitive 34) · ×1
  • PsdExportController.export (cognitive 34) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/psdExportController.ts:81 — PsdExportController.export has cognitive complexity 34 (threshold 15). Drivers by points: if/else 20 (23 pts), ternaries 6 (7 pts), boolean chains 3, error handling 1 (nesting depth added 4). Of this number, 23 points are the body's own statements and 11 belong to 2 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · bitmapStore.createBitmapStore.flushPendingUploads (cognitive 34) · ×1
  • bitmapStore.createBitmapStore.flushPendingUploads (cognitive 34) invokeai/frontend/webv2/src/workbench/canvas-engine/document/bitmapStore.ts:699 — bitmapStore.createBitmapStore.flushPendingUploads has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (23 pts), boolean chains 5, loops 3 (5 pts), ternaries 1 (nesting depth added 16). Of this number, 31 points are the body's own statements and 3 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ImageContextMenu.SingleItemMenuItems (cognitive 34) · ×1
  • ImageContextMenu.SingleItemMenuItems (cognitive 34) invokeai/frontend/webv2/src/workbench/image-actions/ImageContextMenu.tsx:275 — ImageContextMenu.SingleItemMenuItems has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 12 (15 pts), boolean chains 11, if/else 6 (7 pts), error handling 1 (nesting depth added 4). Of this number, 24 points are the body's own statements and 10 belong to 6 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · MetadataToSDXLLorasInvocation.invoke (cognitive 33) · ×1
  • MetadataToSDXLLorasInvocation.invoke (cognitive 33) invokeai/app/invocations/metadata_linked.py:1076 — MetadataToSDXLLorasInvocation.invoke has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (31 pts), loops 1, ternaries 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelInstallService._clear_pending_jobs (cognitive 33) · ×1
  • ModelInstallService._clear_pending_jobs (cognitive 33) invokeai/app/services/model_install/model_install_default.py:808 — ModelInstallService._clear_pending_jobs has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 7, loops 3 (5 pts), error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExecutionPlan.from_snapshot (cognitive 33) · ×1
  • ExecutionPlan.from_snapshot (cognitive 33) invokeai/app/services/shared/execution_engine/scheduler.py:151 — ExecutionPlan.from_snapshot has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (24 pts), boolean chains 5, loops 3 (4 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GraphExecutionState._validate_for_continuation_output (cognitive 33) · ×1
  • GraphExecutionState._validate_for_continuation_output (cognitive 33) invokeai/app/services/shared/graph.py:2019 — GraphExecutionState._validate_for_continuation_output has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (22 pts), ternaries 2 (8 pts), boolean chains 3 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · graph_loop_topology._recognize_nested_iterate_sequence (cognitive 33) · ×1
  • graph_loop_topology._recognize_nested_iterate_sequence (cognitive 33) invokeai/app/services/shared/graph_loop_topology.py:370 — graph_loop_topology._recognize_nested_iterate_sequence has cognitive complexity 33 (threshold 15). Drivers by points: if/else 17 (23 pts), boolean chains 6, loops 3 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · denoise.denoise (cognitive 33) · ×1
  • denoise.denoise (cognitive 33) invokeai/backend/ernie_image/denoise.py:27 — denoise.denoise has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (24 pts), ternaries 2 (4 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · useImageUploadButton.useImageUploadButton (cognitive 33) · ×1
  • useImageUploadButton.useImageUploadButton (cognitive 33) invokeai/frontend/webv1/src/common/hooks/useImageUploadButton.tsx:68 — useImageUploadButton.useImageUploadButton has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (19 pts), ternaries 4 (11 pts), boolean chains 2, error handling 1 (nesting depth added 14). Most of this is not in the body itself: 1 of the 33 points is its own statement and the rest belongs to 6 function literals inside it that branch (lines 89, 140, 210, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · UserManagement.UserFormModal (cognitive 33) · ×1
  • UserManagement.UserFormModal (cognitive 33) invokeai/frontend/webv1/src/features/auth/components/UserManagement.tsx:77 — UserManagement.UserFormModal has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 15, ternaries 9 (10 pts), if/else 5 (6 pts), error handling 2 (nesting depth added 2). Of this number, 16 points are the body's own statements and 17 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ToolWidthPicker.ToolWidthPicker (cognitive 33) · ×1
  • ToolWidthPicker.ToolWidthPicker (cognitive 33) invokeai/frontend/webv1/src/features/controlLayers/components/Tool/ToolWidthPicker.tsx:223 — ToolWidthPicker.ToolWidthPicker has cognitive complexity 33 (threshold 15). Drivers by points: if/else 21 (22 pts), boolean chains 7, ternaries 2 (3 pts), loops 1 (nesting depth added 2). Most of this is not in the body itself: 2 of the 33 points are its own statements and the rest belongs to 16 function literals inside it that branch (lines 388, 252, 411, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · mock-working-memory.createWorkingMemoryMock.linesOf (cognitive 33) · ×1
  • mock-working-memory.createWorkingMemoryMock.linesOf (cognitive 33) invokeai/frontend/webv2/scripts/mock-working-memory.mjs:470 — mock-working-memory.createWorkingMemoryMock.linesOf has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 19 (28 pts), boolean chains 4, if/else 1 (nesting depth added 9). None of this is in the body itself: all 33 points belong to 5 function items inside it that branch (a function literal at line 483, a function literal at line 499, judged, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · semanticImageQuery.parseGallerySemanticReference (cognitive 33) · ×1
  • semanticImageQuery.parseGallerySemanticReference (cognitive 33) invokeai/frontend/webv2/src/features/gallery/core/semanticImageQuery.ts:232 — semanticImageQuery.parseGallerySemanticReference has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 9, ternaries 2 (6 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GeneratePresetsPopover.GeneratePresetsPopover (cognitive 33) · ×1
  • GeneratePresetsPopover.GeneratePresetsPopover (cognitive 33) invokeai/frontend/webv2/src/features/generation/ui/GeneratePresetsPopover.tsx:174 — GeneratePresetsPopover.GeneratePresetsPopover has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 15 (20 pts), if/else 10, loops 1 (2 pts), boolean chains 1 (nesting depth added 6). Of this number, 17 points are the body's own statements and 16 belong to 8 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · installsStore.refreshInstalls (cognitive 33) · ×1
  • installsStore.refreshInstalls (cognitive 33) invokeai/frontend/webv2/src/features/models/data/installsStore.ts:146 — installsStore.refreshInstalls has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (17 pts), ternaries 5 (7 pts), boolean chains 5, loops 4 (nesting depth added 8). None of this is in the body itself: all 33 points belong to 4 function literals inside it that branch (lines 152, 158, 231, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · widgetValues.syncVideoWidgetValuesWithModels (cognitive 33) · ×1
  • widgetValues.syncVideoWidgetValuesWithModels (cognitive 33) invokeai/frontend/webv2/src/features/video/core/widgetValues.ts:39 — widgetValues.syncVideoWidgetValuesWithModels has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 11, if/else 9 (11 pts), ternaries 10 (11 pts) (nesting depth added 3). Of this number, 25 points are the body's own statements and 8 belong to 2 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · validation.validateConnection (cognitive 33) · ×1
  • validation.validateConnection (cognitive 33) invokeai/frontend/webv2/src/features/workflow/core/validation.ts:511 — validation.validateConnection has cognitive complexity 33 (threshold 15). Drivers by points: if/else 17 (23 pts), boolean chains 8, loops 1 (2 pts) (nesting depth added 7). Of this number, 32 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ProjectWorkflowsView.ProjectWorkflowDetailPanel (cognitive 33) · ×1
  • ProjectWorkflowsView.ProjectWorkflowDetailPanel (cognitive 33) invokeai/frontend/webv2/src/features/workflow/ui/library/ProjectWorkflowsView.tsx:225 — ProjectWorkflowsView.ProjectWorkflowDetailPanel has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 17 (21 pts), boolean chains 10, if/else 2 (nesting depth added 4). Of this number, 19 points are the body's own statements and 14 belong to 12 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · WorkflowFieldInput.VideoFrameIndexInput (cognitive 33) · ×1
  • WorkflowFieldInput.VideoFrameIndexInput (cognitive 33) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:1230 — WorkflowFieldInput.VideoFrameIndexInput has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 13 (24 pts), boolean chains 8, if/else 1 (nesting depth added 11). Of this number, 26 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SettingControl.SettingControl (cognitive 33) · ×1
  • SettingControl.SettingControl (cognitive 33) invokeai/frontend/webv2/src/platform/ui/settings/SettingControl.tsx:25 — SettingControl.SettingControl has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 17 (28 pts), if/else 4, boolean chains 1 (nesting depth added 11). Of this number, 29 points are the body's own statements and 4 belong to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · layerPanelRows.flattenPanelRows (cognitive 33) · ×1
  • layerPanelRows.flattenPanelRows (cognitive 33) invokeai/frontend/webv2/src/workbench/widgets/layers/layerPanelRows.ts:65 — layerPanelRows.flattenPanelRows has cognitive complexity 33 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 3 (9 pts), ternaries 2 (9 pts), boolean chains 5 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RunLayerWorkflowDialog.RunLayerWorkflowDialog (cognitive 33) · ×1
  • RunLayerWorkflowDialog.RunLayerWorkflowDialog (cognitive 33) invokeai/frontend/webv2/src/workbench/widgets/layers/RunLayerWorkflowDialog.tsx:198 — RunLayerWorkflowDialog.RunLayerWorkflowDialog has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (16 pts), ternaries 9 (10 pts), boolean chains 6, error handling 1 (nesting depth added 2). Most of this is not in the body itself: 12 of the 33 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 354, 320, 255, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · LayerGroupContextMenu.LayerGroupContextMenu (cognitive 33) · ×1
  • LayerGroupContextMenu.LayerGroupContextMenu (cognitive 33) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerGroupContextMenu.tsx:74 — LayerGroupContextMenu.LayerGroupContextMenu has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 13 (17 pts), if/else 8, boolean chains 7, error handling 1 (nesting depth added 4). Of this number, 20 points are the body's own statements and 13 belong to 6 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · controlPanelModel.deriveDetection (cognitive 33) · ×1
  • controlPanelModel.deriveDetection (cognitive 33) invokeai/frontend/webv2/src/workbench/widgets/layers/controlPanelModel.ts:148 — controlPanelModel.deriveDetection has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 17 (28 pts), boolean chains 4, if/else 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · board_images.remove_images_from_board (cognitive 32) · ×1
  • board_images.remove_images_from_board (cognitive 32) invokeai/app/api/routers/board_images.py:303 — board_images.remove_images_from_board has cognitive complexity 32 (threshold 15). Drivers by points: error handling 9 (18 pts), if/else 4 (9 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MiniMaxH3DenoiseInvocation.invoke (cognitive 32) · ×1
  • MiniMaxH3DenoiseInvocation.invoke (cognitive 32) invokeai/app/invocations/minimax_h3/minimax_h3_denoise.py:319 — MiniMaxH3DenoiseInvocation.invoke has cognitive complexity 32 (threshold 15). Drivers by points: if/else 19 (21 pts), boolean chains 7, error handling 2 (4 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ExtractVideoRangeInvocation.invoke (cognitive 32) · ×1
  • ExtractVideoRangeInvocation.invoke (cognitive 32) invokeai/app/invocations/video_frame_extract_range.py:187 — ExtractVideoRangeInvocation.invoke has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 6, ternaries 3, error handling 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · image_index_common.blobs_to_embeddings (cognitive 32) · ×1
  • image_index_common.blobs_to_embeddings (cognitive 32) invokeai/app/services/image_index/image_index_common.py:94 — image_index_common.blobs_to_embeddings has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (26 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OrphanedModelsService.find_orphaned_models (cognitive 32) · ×1
  • OrphanedModelsService.find_orphaned_models (cognitive 32) invokeai/app/services/orphaned_models/orphaned_models_service.py:73 — OrphanedModelsService.find_orphaned_models has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (16 pts), error handling 3 (8 pts), loops 6 (8 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChildDependencyRecord._validate_relationship (cognitive 32) · ×1
  • ChildDependencyRecord._validate_relationship (cognitive 32) invokeai/app/services/shared/execution_engine/child.py:479 — ChildDependencyRecord._validate_relationship has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 7, loops 3 (4 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · _ExecutionScheduler.get_next_node (cognitive 32) · ×1
  • _ExecutionScheduler.get_next_node (cognitive 32) invokeai/app/services/shared/graph_scheduler.py:254 — _ExecutionScheduler.get_next_node has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (27 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ControlNetModel.__init__ (cognitive 32) · ×1
  • ControlNetModel.__init__ (cognitive 32) invokeai/backend/util/hotfixes.py:109 — ControlNetModel.__init__ has cognitive complexity 32 (threshold 15). Drivers by points: if/else 18 (21 pts), boolean chains 6, loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · fit.fit_points (cognitive 32) · ×1
  • fit.fit_points (cognitive 32) invokeai/backend/working_memory/fit.py:544 — fit.fit_points has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (25 pts), boolean chains 4, loops 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · fit._lowest_rounded (cognitive 32) · ×1
  • fit._lowest_rounded (cognitive 32) invokeai/backend/working_memory/fit.py:843 — fit._lowest_rounded has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 3 (9 pts), boolean chains 7, loops 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · addInpaint.addInpaint (cognitive 32) · ×1
  • addInpaint.addInpaint (cognitive 32) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/addInpaint.ts:47 — addInpaint.addInpaint has cognitive complexity 32 (threshold 15). Drivers by points: if/else 17 (25 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · buildZImageGraph.buildZImageGraph (cognitive 32) · ×1
  • buildZImageGraph.buildZImageGraph (cognitive 32) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildZImageGraph.ts:49 — buildZImageGraph.buildZImageGraph has cognitive complexity 32 (threshold 15). Drivers by points: if/else 21 (25 pts), boolean chains 7 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · GenerationSettingsAccordion.GenerationSettingsAccordion (cognitive 32) · ×1
  • GenerationSettingsAccordion.GenerationSettingsAccordion (cognitive 32) invokeai/frontend/webv1/src/features/settingsAccordions/components/GenerationSettingsAccordion/GenerationSettingsAccordion.tsx:62 — GenerationSettingsAccordion.GenerationSettingsAccordion has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 27, ternaries 5. Of this number, 30 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · selection.getGalleryNavigationStep (cognitive 32) · ×1
  • selection.getGalleryNavigationStep (cognitive 32) invokeai/frontend/webv2/src/features/gallery/core/selection.ts:311 — selection.getGalleryNavigationStep has cognitive complexity 32 (threshold 15). Drivers by points: loops 6 (11 pts), boolean chains 9, if/else 4 (9 pts), ternaries 2 (3 pts) (nesting depth added 11). Of this number, 27 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · galleryBoardGroups.getGalleryBoardGroups (cognitive 32) · ×1
  • galleryBoardGroups.getGalleryBoardGroups (cognitive 32) invokeai/frontend/webv2/src/features/gallery/ui/galleryBoardGroups.ts:61 — galleryBoardGroups.getGalleryBoardGroups has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 16, if/else 4 (9 pts), loops 2 (4 pts), ternaries 3 (nesting depth added 7). Of this number, 20 points are the body's own statements and 12 belong to 9 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · compileCanvasGraph.compileCanvasGraph (cognitive 32) · ×1
  • compileCanvasGraph.compileCanvasGraph (cognitive 32) invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.ts:1039 — compileCanvasGraph.compileCanvasGraph has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 6, ternaries 3 (6 pts) (nesting depth added 9). Of this number, 28 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · runtime.createQueueRuntime.initialize · ×1
  • runtime.createQueueRuntime.initialize::initializeProjects (cognitive 32) invokeai/frontend/webv2/src/features/queue/runtime.ts:2445 — runtime.createQueueRuntime.initialize::initializeProjects has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 4 (9 pts), boolean chains 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · buildGraph.planWorkflowSeeds (cognitive 32) · ×1
  • buildGraph.planWorkflowSeeds (cognitive 32) invokeai/frontend/webv2/src/features/workflow/core/buildGraph.ts:485 — buildGraph.planWorkflowSeeds has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 5 (17 pts), if/else 4 (11 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · workflowJson.parseWorkflowJson (cognitive 32) · ×1
  • workflowJson.parseWorkflowJson (cognitive 32) invokeai/frontend/webv2/src/features/workflow/core/workflowJson.ts:283 — workflowJson.parseWorkflowJson has cognitive complexity 32 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 5 (11 pts), boolean chains 6, loops 3 (4 pts) (nesting depth added 12). Of this number, 31 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ToolStripFlyout.ToolFamilyButton (cognitive 32) · ×1
  • ToolStripFlyout.ToolFamilyButton (cognitive 32) invokeai/frontend/webv2/src/workbench/widgets/canvas/ToolStripFlyout.tsx:49 — ToolStripFlyout.ToolFamilyButton has cognitive complexity 32 (threshold 15). Drivers by points: if/else 17 (22 pts), ternaries 5, boolean chains 4, error handling 1 (nesting depth added 5). Most of this is not in the body itself: 3 of the 32 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 118, 148, 96, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ImageMapWidgetView.ImageMapWidgetView (cognitive 32) · ×1
  • ImageMapWidgetView.ImageMapWidgetView (cognitive 32) invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapWidgetView.tsx:73 — ImageMapWidgetView.ImageMapWidgetView has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 9 (17 pts), if/else 10, boolean chains 5 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MergeLayerController.mergeSelectedInto (cognitive 32) · ×1
  • MergeLayerController.mergeSelectedInto (cognitive 32) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:628 — MergeLayerController.mergeSelectedInto has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (17 pts), boolean chains 6, loops 5, ternaries 3 (4 pts) (nesting depth added 2). Of this number, 28 points are the body's own statements and 4 belong to 4 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ControlDerivationController.commitControlMap (cognitive 32) · ×1
  • ControlDerivationController.commitControlMap (cognitive 32) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/controlDerivationController.ts:198 — ControlDerivationController.commitControlMap has cognitive complexity 32 (threshold 15). Drivers by points: if/else 19 (20 pts), boolean chains 7, ternaries 2 (4 pts), error handling 1 (nesting depth added 3). Of this number, 21 points are the body's own statements and 11 belong to 2 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · imageRecall.getRefinerRecall (cognitive 32) · ×1
  • imageRecall.getRefinerRecall (cognitive 32) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:889 — imageRecall.getRefinerRecall has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 10 (17 pts), if/else 7 (8 pts), boolean chains 7 (nesting depth added 8). Of this number, 31 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · QueueRecoveryNotice.QueueRecoveryNotice (cognitive 32) · ×1
  • QueueRecoveryNotice.QueueRecoveryNotice (cognitive 32) invokeai/frontend/webv2/src/workbench/queue-integration/QueueRecoveryNotice.tsx:34 — QueueRecoveryNotice.QueueRecoveryNotice has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 9, error handling 3, ternaries 1 (nesting depth added 3). Most of this is not in the body itself: 8 of the 32 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 71, 118, 97, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · WorkbenchShell.WorkbenchShell (cognitive 32) · ×1
  • WorkbenchShell.WorkbenchShell (cognitive 32) invokeai/frontend/webv2/src/workbench/shell/WorkbenchShell.tsx:65 — WorkbenchShell.WorkbenchShell has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 12 (13 pts), boolean chains 9, if/else 9, loops 1 (nesting depth added 1). Most of this is not in the body itself: 7 of the 32 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 221, 147, 246, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · widgetDnd.resolveWidgetDragEnd (cognitive 32) · ×1
  • widgetDnd.resolveWidgetDragEnd (cognitive 32) invokeai/frontend/webv2/src/workbench/widgetDnd.ts:224 — widgetDnd.resolveWidgetDragEnd has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 8 (14 pts), if/else 8 (13 pts), boolean chains 5 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LayerFilterControls.FilterParamField (cognitive 32) · ×1
  • LayerFilterControls.FilterParamField (cognitive 32) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerFilterControls.tsx:143 — LayerFilterControls.FilterParamField has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 13 (17 pts), if/else 8, boolean chains 7 (nesting depth added 4). Of this number, 25 points are the body's own statements and 7 belong to 5 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ControlDetectionRow.ControlDetectionRow (cognitive 32) · ×1
  • ControlDetectionRow.ControlDetectionRow (cognitive 32) invokeai/frontend/webv2/src/workbench/widgets/layers/ControlDetectionRow.tsx:40 — ControlDetectionRow.ControlDetectionRow has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 19 (27 pts), boolean chains 4, if/else 1 (nesting depth added 8). Of this number, 21 points are the body's own statements and 11 belong to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VideoConcatInvocation.invoke (cognitive 31) · ×1
  • VideoConcatInvocation.invoke (cognitive 31) invokeai/app/invocations/video_concat.py:205 — VideoConcatInvocation.invoke has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (21 pts), error handling 2 (6 pts), boolean chains 4 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · user_management._modify_user_interactive (cognitive 31) · ×1
  • user_management._modify_user_interactive (cognitive 31) invokeai/app/util/user_management.py:449 — user_management._modify_user_interactive has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (15 pts), ternaries 6 (7 pts), boolean chains 5, error handling 2, loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelConfigFactory._validate_path_looks_like_model (cognitive 31) · ×1
  • ModelConfigFactory._validate_path_looks_like_model (cognitive 31) invokeai/backend/model_manager/configs/factory.py:831 — ModelConfigFactory._validate_path_looks_like_model has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 2 (4 pts), error handling 1 (3 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UserProfile.UserProfile (cognitive 31) · ×1
  • UserProfile.UserProfile (cognitive 31) invokeai/frontend/webv1/src/features/auth/components/UserProfile.tsx:38 — UserProfile.UserProfile has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 13 (14 pts), boolean chains 12, if/else 3, error handling 2 (nesting depth added 1). Of this number, 23 points are the body's own statements and 8 belong to 2 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · CanvasTextToolModule.commitSession (cognitive 31) · ×1
  • CanvasTextToolModule.commitSession (cognitive 31) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasTextToolModule.ts:361 — CanvasTextToolModule.commitSession has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 10 (15 pts), if/else 7 (11 pts), boolean chains 3, error handling 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelEditForm.ModelEditForm (cognitive 31) · ×1
  • ModelEditForm.ModelEditForm (cognitive 31) invokeai/frontend/webv2/src/features/models/ui/detail/ModelEditForm.tsx:72 — ModelEditForm.ModelEditForm has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 16 (18 pts), if/else 8 (10 pts), boolean chains 2, error handling 1 (nesting depth added 4). Most of this is not in the body itself: 8 of the 31 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 157, 134, 103, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · graph.buildMiniMaxH3VideoGraph (cognitive 31) · ×1
  • graph.buildMiniMaxH3VideoGraph (cognitive 31) invokeai/frontend/webv2/src/features/video/core/graph.ts:438 — graph.buildMiniMaxH3VideoGraph has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 13 (15 pts), if/else 10, boolean chains 6 (nesting depth added 2). Of this number, 29 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · CropLayerController.crop (cognitive 31) · ×1
  • CropLayerController.crop (cognitive 31) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/cropLayerController.ts:175 — CropLayerController.crop has cognitive complexity 31 (threshold 15). Drivers by points: if/else 15, ternaries 6 (9 pts), boolean chains 6, error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · MergeLayerController.mergeVisible (cognitive 31) · ×1
  • MergeLayerController.mergeVisible (cognitive 31) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:394 — MergeLayerController.mergeVisible has cognitive complexity 31 (threshold 15). Drivers by points: if/else 23 (32 pts), ternaries 6 (13 pts), boolean chains 5, loops 4 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (MergeLayerController.mergeVisible::drawMerged) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · documentMirror.diffValueEdit (cognitive 31) · ×1
  • documentMirror.diffValueEdit (cognitive 31) invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentMirror.ts:168 — documentMirror.diffValueEdit has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 5 (7 pts), boolean chains 4 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · recall_parameters.resolve_control_models (cognitive 30) · ×1
  • recall_parameters.resolve_control_models (cognitive 30) invokeai/app/api/routers/recall_parameters.py:214 — recall_parameters.resolve_control_models has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (29 pts), loops 1 (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · ExtractVideoRangeInvocation._write_spliced_range (cognitive 30) · ×1
  • ExtractVideoRangeInvocation._write_spliced_range (cognitive 30) invokeai/app/invocations/video_frame_extract_range.py:373 — ExtractVideoRangeInvocation._write_spliced_range has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (15 pts), ternaries 2 (6 pts), loops 3 (4 pts), boolean chains 3, error handling 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · config_default.migrate_v3_config_dict (cognitive 30) · ×1
  • config_default.migrate_v3_config_dict (cognitive 30) invokeai/app/services/config/config_default.py:581 — config_default.migrate_v3_config_dict has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (23 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelInstallService._install_next_item (cognitive 30) · ×1
  • ModelInstallService._install_next_item (cognitive 30) invokeai/app/services/model_install/model_install_default.py:1716 — ModelInstallService._install_next_item has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (19 pts), error handling 3 (8 pts), boolean chains 2, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · graph_if_dependencies._can_use_fresh_mixed_if_iterate_collect (cognitive 30) · ×1
  • graph_if_dependencies._can_use_fresh_mixed_if_iterate_collect (cognitive 30) invokeai/app/services/shared/graph_if_dependencies.py:30 — graph_if_dependencies._can_use_fresh_mixed_if_iterate_collect has cognitive complexity 30 (threshold 15). Drivers by points: if/else 17 (20 pts), boolean chains 9, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · aac_splice._set_audio_edit (cognitive 30) · ×1
  • aac_splice._set_audio_edit (cognitive 30) invokeai/app/util/aac_splice.py:280 — aac_splice._set_audio_edit has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 9 (16 pts), if/else 6 (11 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · denoise.denoise (cognitive 30) · ×1
  • denoise.denoise (cognitive 30) invokeai/backend/ltx2/denoise.py:621 — denoise.denoise has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 5 (9 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · generate_docs_json.build_invocation_context_export (cognitive 30) · ×1
  • generate_docs_json.build_invocation_context_export (cognitive 30) scripts/generate_docs_json.py:103 — generate_docs_json.build_invocation_context_export has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · build_shipped.read_point_files (cognitive 30) · ×1
  • build_shipped.read_point_files (cognitive 30) scripts/working_memory/build_shipped.py:372 — build_shipped.read_point_files has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (18 pts), error handling 3 (8 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CanvasSegmentAnythingModule.onStagePointerUp (cognitive 30) · ×1
  • CanvasSegmentAnythingModule.onStagePointerUp (cognitive 30) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts:752 — CanvasSegmentAnythingModule.onStagePointerUp has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (28 pts), boolean chains 2 (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · run-graph._runGraph (cognitive 30) · ×1
  • run-graph._runGraph (cognitive 30) invokeai/frontend/webv1/src/services/api/run-graph.ts:152 — run-graph._runGraph has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (17 pts), error handling 4 (9 pts), boolean chains 2, loops 1, ternaries 1 (nesting depth added 7). Most of this is not in the body itself: 5 of the 30 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 327, a function literal at line 216, cleanup, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · PromptTextarea.PromptTextarea (cognitive 30) · ×1
  • PromptTextarea.PromptTextarea (cognitive 30) invokeai/frontend/webv2/src/features/generation/ui/promptFields/PromptTextarea.tsx:64 — PromptTextarea.PromptTextarea has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 15 (21 pts), boolean chains 8, if/else 1 (nesting depth added 6). Most of this is not in the body itself: 13 of the 30 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 157, 225, 99, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · PromptParser.parseNodes (cognitive 30) · ×1
  • PromptParser.parseNodes (cognitive 30) invokeai/frontend/webv2/src/features/generation/core/prompt/ast.ts:606 — PromptParser.parseNodes has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 2 (4 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · runtime.createQueueRuntime.handleItemsRetried (cognitive 30) · ×1
  • runtime.createQueueRuntime.handleItemsRetried (cognitive 30) invokeai/frontend/webv2/src/features/queue/runtime.ts:1613 — runtime.createQueueRuntime.handleItemsRetried has cognitive complexity 30 (threshold 15). Drivers by points: loops 7 (13 pts), if/else 6 (11 pts), boolean chains 5, ternaries 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · graph.buildWanVideoGraph (cognitive 30) · ×1
  • graph.buildWanVideoGraph (cognitive 30) invokeai/frontend/webv2/src/features/video/core/graph.ts:280 — graph.buildWanVideoGraph has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 12 (15 pts), if/else 6 (9 pts), boolean chains 6 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkflowFieldInput.SavedWorkflowInput (cognitive 30) · ×1
  • WorkflowFieldInput.SavedWorkflowInput (cognitive 30) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:1766 — WorkflowFieldInput.SavedWorkflowInput has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 14 (18 pts), boolean chains 7, if/else 5 (nesting depth added 4). Of this number, 21 points are the body's own statements and 9 belong to 5 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · HsvBoxPicker.HsvBoxPicker (cognitive 30) · ×1
  • HsvBoxPicker.HsvBoxPicker (cognitive 30) invokeai/frontend/webv2/src/platform/ui/HsvBoxPicker.tsx:27 — HsvBoxPicker.HsvBoxPicker has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 13 (20 pts), boolean chains 6, if/else 4 (nesting depth added 7). Most of this is not in the body itself: 7 of the 30 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 106, 127, 48, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · documentIndex.updateNodeValues (cognitive 30) · ×1
  • documentIndex.updateNodeValues (cognitive 30) invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentIndex.ts:435 — documentIndex.updateNodeValues has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (24 pts), loops 4 (5 pts), boolean chains 1 (nesting depth added 13). Of this number, 16 points are the body's own statements and 14 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · adjustments.streamNoiseRows (cognitive 30) · ×1
  • adjustments.streamNoiseRows (cognitive 30) invokeai/frontend/webv2/src/workbench/canvas-engine/render/adjustments.ts:660 — adjustments.streamNoiseRows has cognitive complexity 30 (threshold 15). Drivers by points: loops 10 (27 pts), if/else 2 (3 pts) (nesting depth added 18). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · workbenchState.compileInvocationSnapshot (cognitive 30) · ×1
  • workbenchState.compileInvocationSnapshot (cognitive 30) invokeai/frontend/webv2/src/workbench/workbenchState.ts:3128 — workbenchState.compileInvocationSnapshot has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (18 pts), ternaries 6 (10 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StatusBar.CompactBottomWidget (cognitive 30) · ×1
  • StatusBar.CompactBottomWidget (cognitive 30) invokeai/frontend/webv2/src/workbench/shell/StatusBar.tsx:271 — StatusBar.CompactBottomWidget has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 16 (18 pts), if/else 7 (8 pts), boolean chains 4 (nesting depth added 3). Of this number, 20 points are the body's own statements and 10 belong to 5 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · VideoConcatInvocation._iter_joined_frames (cognitive 29) · ×1
  • VideoConcatInvocation._iter_joined_frames (cognitive 29) invokeai/app/invocations/video_concat.py:805 — VideoConcatInvocation._iter_joined_frames has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (20 pts), ternaries 2 (4 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExecutionRef._accept_token_fields (cognitive 29) · ×1
  • ExecutionRef._accept_token_fields (cognitive 29) invokeai/app/services/shared/execution_effects.py:146 — ExecutionRef._accept_token_fields has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 3 (6 pts), boolean chains 4 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Config_Base.get_model_discriminator_value (cognitive 29) · ×1
  • Config_Base.get_model_discriminator_value (cognitive 29) invokeai/backend/model_manager/configs/base.py:159 — Config_Base.get_model_discriminator_value has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (28 pts), boolean chains 1 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · main._detect_wan_expert (cognitive 29) · ×1
  • main._detect_wan_expert (cognitive 29) invokeai/backend/model_manager/configs/main.py:2987 — main._detect_wan_expert has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 3 (4 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · minimax_h3_state_dict_utils.convert_minimax_h3_checkpoint_to_diffusers (cognitive 29) · ×1
  • minimax_h3_state_dict_utils.convert_minimax_h3_checkpoint_to_diffusers (cognitive 29) invokeai/backend/model_manager/load/model_loaders/minimax_h3_state_dict_utils.py:76 — minimax_h3_state_dict_utils.convert_minimax_h3_checkpoint_to_diffusers has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 3 (8 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PidDistillModel.generate_samples_from_batch (cognitive 29) · ×1
  • PidDistillModel.generate_samples_from_batch (cognitive 29) invokeai/backend/pid/_src/models/pid_distill_model.py:168 — PidDistillModel.generate_samples_from_batch has cognitive complexity 29 (threshold 15). Drivers by points: if/else 18 (22 pts), boolean chains 5, ternaries 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · TextLLMPipeline.run (cognitive 29) · ×1
  • TextLLMPipeline.run (cognitive 29) invokeai/backend/text_llm_pipeline.py:156 — TextLLMPipeline.run has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 6, error handling 2 (3 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · calibrate_z_image_working_memory._summarize_fit (cognitive 29) · ×1
  • calibrate_z_image_working_memory._summarize_fit (cognitive 29) scripts/calibrate_z_image_working_memory.py:405 — calibrate_z_image_working_memory._summarize_fit has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (22 pts), loops 4 (6 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ProtectedRoute.ProtectedRoute (cognitive 29) · ×1
  • ProtectedRoute.ProtectedRoute (cognitive 29) invokeai/frontend/webv1/src/features/auth/components/ProtectedRoute.tsx:21 — ProtectedRoute.ProtectedRoute has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 13 (nesting depth added 2). Most of this is not in the body itself: 8 of the 29 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 114, 100, 42, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ModelView.ModelView (cognitive 29) · ×1
  • ModelView.ModelView (cognitive 29) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/ModelView.tsx:64 — ModelView.ModelView has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 24, if/else 5. Of this number, 21 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · tsSourceAnalysis.collectPublicExports (cognitive 29) · ×1
  • tsSourceAnalysis.collectPublicExports (cognitive 29) invokeai/frontend/webv2/src/architecture/tsSourceAnalysis.ts:164 — tsSourceAnalysis.collectPublicExports has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 3 (9 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UserFormDialog.UserForm (cognitive 29) · ×1
  • UserFormDialog.UserForm (cognitive 29) invokeai/frontend/webv2/src/features/identity/ui/UserFormDialog.tsx:76 — UserFormDialog.UserForm has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 12 (15 pts), if/else 6 (10 pts), boolean chains 2, error handling 2 (nesting depth added 7). Most of this is not in the body itself: 13 of the 29 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 123, 108). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · holdLease.startIntermediatesHoldLease (cognitive 29) · ×1
  • holdLease.startIntermediatesHoldLease (cognitive 29) invokeai/frontend/webv2/src/features/intermediates/holdLease.ts:32 — holdLease.startIntermediatesHoldLease has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 8, error handling 2 (4 pts), ternaries 2, loops 1 (nesting depth added 3). None of this is in the body itself: all 29 points belong to 9 function items inside it that branch (sendOnce, bodyFor, send, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · WorkflowFieldInput.useMediaUpload.onFileChange (cognitive 29) · ×1
  • WorkflowFieldInput.useMediaUpload.onFileChange (cognitive 29) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:685 — WorkflowFieldInput.useMediaUpload.onFileChange has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (14 pts), ternaries 5 (8 pts), boolean chains 4, error handling 1 (2 pts), loops 1 (nesting depth added 7). Most of this is not in the body itself: 6 of the 29 points are its own statements and the rest belongs to one function literal inside it that branches (line 710). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · usePreviewNavigation.usePreviewNavigation (cognitive 29) · ×1
  • usePreviewNavigation.usePreviewNavigation (cognitive 29) invokeai/frontend/webv2/src/workbench/widgets/preview/usePreviewNavigation.ts:205 — usePreviewNavigation.usePreviewNavigation has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 14, ternaries 11 (12 pts), if/else 3 (nesting depth added 1). Of this number, 25 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · documentMirror.diffForests (cognitive 29) · ×1
  • documentMirror.diffForests (cognitive 29) invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentMirror.ts:99 — documentMirror.diffForests has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 3, loops 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · shapeTool.createShapeTool.commitPixels (cognitive 29) · ×1
  • shapeTool.createShapeTool.commitPixels (cognitive 29) invokeai/frontend/webv2/src/workbench/canvas-engine/tools/shapeTool.ts:154 — shapeTool.createShapeTool.commitPixels has cognitive complexity 29 (threshold 15). Drivers by points: if/else 16 (17 pts), boolean chains 7, ternaries 4, error handling 1 (nesting depth added 1). Of this number, 25 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · mediaReferences.collectMediaNames (cognitive 29) · ×1
  • mediaReferences.collectMediaNames (cognitive 29) invokeai/frontend/webv2/src/workbench/mediaReferences.ts:21 — mediaReferences.collectMediaNames has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · baseinvocation.validate_fields (cognitive 28) · ×1
  • baseinvocation.validate_fields (cognitive 28) invokeai/app/invocations/baseinvocation.py:604 — baseinvocation.validate_fields has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 6, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Flux2KleinLoRACollectionLoader.invoke (cognitive 28) · ×1
  • Flux2KleinLoRACollectionLoader.invoke (cognitive 28) invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:163 — Flux2KleinLoRACollectionLoader.invoke has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 4, ternaries 2 (4 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ZImageLoRACollectionLoader.invoke (cognitive 28) · ×1
  • ZImageLoRACollectionLoader.invoke (cognitive 28) invokeai/app/invocations/z_image/z_image_lora_loader.py:135 — ZImageLoRACollectionLoader.invoke has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 4, ternaries 2 (4 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExternalGenerationService._validate_request (cognitive 28) · ×1
  • ExternalGenerationService._validate_request (cognitive 28) invokeai/app/services/external_generation/external_generation_default.py:96 — ExternalGenerationService._validate_request has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 8 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DiskImageFileStorage.__recover_pending_deletes (cognitive 28) · ×1
  • DiskImageFileStorage.__recover_pending_deletes (cognitive 28) invokeai/app/services/image_files/image_files_disk.py:711 — DiskImageFileStorage.__recover_pending_deletes has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 3 (7 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelInstallService._migrate_yaml (cognitive 28) · ×1
  • ModelInstallService._migrate_yaml (cognitive 28) invokeai/app/services/model_install/model_install_default.py:1451 — ModelInstallService._migrate_yaml has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (19 pts), error handling 1 (4 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · graph_if_runtime.validate_if_iteration_axes (cognitive 28) · ×1
  • graph_if_runtime.validate_if_iteration_axes (cognitive 28) invokeai/app/services/shared/graph_if_runtime.py:28 — graph_if_runtime.validate_if_iteration_axes has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 3 (6 pts), boolean chains 5 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · h264_splice._sample_locations (cognitive 28) · ×1
  • h264_splice._sample_locations (cognitive 28) invokeai/app/util/h264_splice.py:273 — h264_splice._sample_locations has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 6, loops 3 (6 pts), ternaries 3 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · main._get_flux2_variant (cognitive 28) · ×1
  • main._get_flux2_variant (cognitive 28) invokeai/backend/model_manager/configs/main.py:522 — main._get_flux2_variant has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (26 pts), loops 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelCache.put (cognitive 28) · ×1
  • ModelCache.put (cognitive 28) invokeai/backend/model_manager/load/model_cache/model_cache.py:902 — ModelCache.put has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 12, if/else 12, loops 2 (3 pts), ternaries 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · TorchDevice.get_generation_devices (cognitive 28) · ×1
  • TorchDevice.get_generation_devices (cognitive 28) invokeai/backend/util/devices.py:363 — TorchDevice.get_generation_devices has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 3, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · build_shipped.describe_changes (cognitive 28) · ×1
  • build_shipped.describe_changes (cognitive 28) scripts/working_memory/build_shipped.py:707 — build_shipped.describe_changes has cognitive complexity 28 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 5 (11 pts), boolean chains 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · build_shipped.main (cognitive 28) · ×1
  • build_shipped.main (cognitive 28) scripts/working_memory/build_shipped.py:776 — build_shipped.main has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 4 (5 pts), ternaries 3 (5 pts), boolean chains 3, error handling 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TextToolOptions.FontSelect (cognitive 28) · ×1
  • TextToolOptions.FontSelect (cognitive 28) invokeai/frontend/webv1/src/features/controlLayers/components/Text/TextToolOptions.tsx:97 — TextToolOptions.FontSelect has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (18 pts), boolean chains 7, ternaries 2, loops 1 (nesting depth added 2). None of this is in the body itself: all 28 points belong to 14 function literals inside it that branch (lines 123, 216, 265, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · DeleteBoardModal.DeleteBoardModal (cognitive 28) · ×1
  • DeleteBoardModal.DeleteBoardModal (cognitive 28) invokeai/frontend/webv1/src/features/gallery/components/Boards/DeleteBoardModal.tsx:43 — DeleteBoardModal.DeleteBoardModal has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 9 (13 pts), boolean chains 9, if/else 6 (nesting depth added 4). Most of this is not in the body itself: 8 of the 28 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 105, 123, 97, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · GalleryImageGrid.useKeyboardNavigation (cognitive 28) · ×1
  • GalleryImageGrid.useKeyboardNavigation (cognitive 28) invokeai/frontend/webv1/src/features/gallery/components/GalleryImageGrid.tsx:135 — GalleryImageGrid.useKeyboardNavigation has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (23 pts), boolean chains 3, match/switch 1, ternaries 1 (nesting depth added 7). None of this is in the body itself: all 28 points belong to one function literal inside it that branches (line 144). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · addRegionalGuidance.addRegionalGuidance (cognitive 28) · ×1
  • addRegionalGuidance.addRegionalGuidance (cognitive 28) invokeai/frontend/webv2/src/features/generation/core/canvas/addRegionalGuidance.ts:386 — addRegionalGuidance.addRegionalGuidance has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · attention.groupWeightedLeaves (cognitive 28) · ×1
  • attention.groupWeightedLeaves (cognitive 28) invokeai/frontend/webv2/src/features/generation/core/prompt/attention.ts:209 — attention.groupWeightedLeaves has cognitive complexity 28 (threshold 15). Drivers by points: if/else 4 (13 pts), ternaries 4 (10 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 16). Of this number, 25 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · modelSettingsIO.validateImportData (cognitive 28) · ×1
  • modelSettingsIO.validateImportData (cognitive 28) invokeai/frontend/webv2/src/features/models/core/modelSettingsIO.ts:78 — modelSettingsIO.validateImportData has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 10 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · workingMemory.deriveCalibrationProgress (cognitive 28) · ×1
  • workingMemory.deriveCalibrationProgress (cognitive 28) invokeai/frontend/webv2/src/features/models/core/workingMemory.ts:300 — workingMemory.deriveCalibrationProgress has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 13, ternaries 5 (9 pts), if/else 6 (nesting depth added 4). Of this number, 27 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OrphanedModelsDialog.OrphanedModelsDialog (cognitive 28) · ×1
  • OrphanedModelsDialog.OrphanedModelsDialog (cognitive 28) invokeai/frontend/webv2/src/features/models/ui/library/OrphanedModelsDialog.tsx:25 — OrphanedModelsDialog.OrphanedModelsDialog has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 6 (19 pts), if/else 6 (7 pts), boolean chains 1, error handling 1 (nesting depth added 14). Of this number, 16 points are the body's own statements and 12 belong to 5 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · QueueItemRow.QueueItemRow (cognitive 28) · ×1
  • QueueItemRow.QueueItemRow (cognitive 28) invokeai/frontend/webv2/src/features/queue/ui/QueueItemRow.tsx:30 — QueueItemRow.QueueItemRow has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 16 (19 pts), boolean chains 7, if/else 2 (nesting depth added 3). Of this number, 25 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · shortcutHints.getCanvasShortcutHints (cognitive 28) · ×1
  • shortcutHints.getCanvasShortcutHints (cognitive 28) invokeai/frontend/webv2/src/workbench/widgets/canvas/shortcutHints.ts:22 — shortcutHints.getCanvasShortcutHints has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14, ternaries 4 (8 pts), boolean chains 6 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · MissingFontsDialog.RecoveryRow (cognitive 28) · ×1
  • MissingFontsDialog.RecoveryRow (cognitive 28) invokeai/frontend/webv2/src/workbench/widgets/canvas/MissingFontsDialog.tsx:139 — MissingFontsDialog.RecoveryRow has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 9 (11 pts), boolean chains 9, if/else 6 (7 pts), error handling 1 (nesting depth added 3). Most of this is not in the body itself: 12 of the 28 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 166, 193). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · SelectionPixelController.edit (cognitive 28) · ×1
  • SelectionPixelController.edit (cognitive 28) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/selectionPixelController.ts:133 — SelectionPixelController.edit has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (13 pts), ternaries 7 (9 pts), boolean chains 6 (nesting depth added 3). Of this number, 24 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · documentMirror.createDocumentMirror.refresh (cognitive 28) · ×1
  • documentMirror.createDocumentMirror.refresh (cognitive 28) invokeai/frontend/webv2/src/workbench/canvas-engine/document/documentMirror.ts:244 — documentMirror.createDocumentMirror.refresh has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (22 pts), ternaries 1 (4 pts), boolean chains 2 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · revealGalleryItem.revealGalleryItem (cognitive 28) · ×1
  • revealGalleryItem.revealGalleryItem (cognitive 28) invokeai/frontend/webv2/src/workbench/image-actions/revealGalleryItem.ts:54 — revealGalleryItem.revealGalleryItem has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 11, if/else 11, ternaries 5 (6 pts) (nesting depth added 1). Most of this is not in the body itself: 1 of the 28 points is its own statement and the rest belongs to 2 function items inside it that branch (a function literal at line 70, isCurrent). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · PreferencesPage.PreferencesPage (cognitive 28) · ×1
  • PreferencesPage.PreferencesPage (cognitive 28) invokeai/frontend/webv2/src/workbench/settings/PreferencesPage.tsx:30 — PreferencesPage.PreferencesPage has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 11 (13 pts), boolean chains 9, if/else 5 (6 pts) (nesting depth added 3). Of this number, 18 points are the body's own statements and 10 belong to 6 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Flux3DenoiseInvocation._run_diffusion (cognitive 27) · ×1
  • Flux3DenoiseInvocation._run_diffusion (cognitive 27) invokeai/app/invocations/flux3/flux3_denoise.py:115 — Flux3DenoiseInvocation._run_diffusion has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (16 pts), ternaries 7, boolean chains 4 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · VideoConcatInvocation._execute_smart_render (cognitive 27) · ×1
  • VideoConcatInvocation._execute_smart_render (cognitive 27) invokeai/app/invocations/video_concat.py:378 — VideoConcatInvocation._execute_smart_render has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 6 (8 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · fonts_parsing.parse_font_bytes (cognitive 27) · ×1
  • fonts_parsing.parse_font_bytes (cognitive 27) invokeai/app/services/fonts/fonts_parsing.py:91 — fonts_parsing.parse_font_bytes has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 9, if/else 8 (9 pts), loops 2 (4 pts), ternaries 3, error handling 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelInstallService._register_or_install (cognitive 27) · ×1
  • ModelInstallService._register_or_install (cognitive 27) invokeai/app/services/model_install/model_install_default.py:1780 — ModelInstallService._register_or_install has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (18 pts), error handling 4 (9 pts) (nesting depth added 9). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · graph_if_dependencies._can_use_fresh_literal_if_iterate_collect (cognitive 27) · ×1
  • graph_if_dependencies._can_use_fresh_literal_if_iterate_collect (cognitive 27) invokeai/app/services/shared/graph_if_dependencies.py:107 — graph_if_dependencies._can_use_fresh_literal_if_iterate_collect has cognitive complexity 27 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 6, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · working_memory_calibration_fits._sizes (cognitive 27) · ×1
  • working_memory_calibration_fits._sizes (cognitive 27) invokeai/app/services/working_memory_calibration/working_memory_calibration_fits.py:423 — working_memory_calibration_fits._sizes has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (15 pts), ternaries 3 (8 pts), boolean chains 2, loops 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · video_thumbnails._iter_video_frames_unbounded (cognitive 27) · ×1
  • video_thumbnails._iter_video_frames_unbounded (cognitive 27) invokeai/app/util/video_thumbnails.py:211 — video_thumbnails._iter_video_frames_unbounded has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 3 (7 pts), error handling 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LoRALoader._load_model (cognitive 27) · ×1
  • LoRALoader._load_model (cognitive 27) invokeai/backend/model_manager/load/model_loaders/lora.py:102 — LoRALoader._load_model has cognitive complexity 27 (threshold 15). Drivers by points: if/else 16 (26 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mistral_encoder._load_tokenizer_for_model (cognitive 27) · ×1
  • mistral_encoder._load_tokenizer_for_model (cognitive 27) REDACTED:984 — mistral_encoder._load_tokenizer_for_model has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 2 (5 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · model_util.calc_model_size_by_fs (cognitive 27) · ×1
  • model_util.calc_model_size_by_fs (cognitive 27) invokeai/backend/model_manager/load/model_util.py:118 — model_util.calc_model_size_by_fs has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (18 pts), loops 3 (4 pts), boolean chains 3, error handling 1 (2 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ModelSettingsImportButton.ModelSettingsImportButton (cognitive 27) · ×1
  • ModelSettingsImportButton.ModelSettingsImportButton (cognitive 27) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/ModelSettingsImportButton.tsx:16 — ModelSettingsImportButton.ModelSettingsImportButton has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (17 pts), error handling 2 (5 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 7). None of this is in the body itself: all 27 points belong to 3 function literals inside it that branch (lines 23, 122, 129). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · buildFLUXGraph.buildFLUXGraph · ×1
  • buildFLUXGraph.buildFLUXGraph::addFlux2Features (cognitive 27) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildFLUXGraph.ts:388 — buildFLUXGraph.buildFLUXGraph::addFlux2Features has cognitive complexity 27 (threshold 15). Drivers by points: if/else 16 (22 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (buildFLUXGraph.buildFLUXGraph) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · ast.tokenizePrompt (cognitive 27) · ×1
  • ast.tokenizePrompt (cognitive 27) invokeai/frontend/webv2/src/features/generation/core/prompt/ast.ts:162 — ast.tokenizePrompt has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (21 pts), ternaries 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GenerateProviderOptionsSection.GenerateProviderOptionsSection (cognitive 27) · ×1
  • GenerateProviderOptionsSection.GenerateProviderOptionsSection (cognitive 27) invokeai/frontend/webv2/src/features/generation/ui/GenerateProviderOptionsSection.tsx:50 — GenerateProviderOptionsSection.GenerateProviderOptionsSection has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 10 (12 pts), match/switch 1 (nesting depth added 8). Most of this is not in the body itself: 11 of the 27 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 165, 213, 99, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · SystemPromptsField.SystemPromptsField (cognitive 27) · ×1
  • SystemPromptsField.SystemPromptsField (cognitive 27) invokeai/frontend/webv2/src/features/generation/ui/promptFields/SystemPromptsField.tsx:101 — SystemPromptsField.SystemPromptsField has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 9 (14 pts), if/else 7, boolean chains 3, error handling 3 (nesting depth added 5). Of this number, 15 points are the body's own statements and 12 belong to 6 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · InstallJobRow.InstallJobRow (cognitive 27) · ×1
  • InstallJobRow.InstallJobRow (cognitive 27) invokeai/frontend/webv2/src/features/models/ui/install-queue/InstallJobRow.tsx:61 — InstallJobRow.InstallJobRow has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 20 (22 pts), boolean chains 5 (nesting depth added 2). Of this number, 22 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · runtime.createQueueItemBackendSubmission (cognitive 27) · ×1
  • runtime.createQueueItemBackendSubmission (cognitive 27) invokeai/frontend/webv2/src/features/queue/runtime.ts:267 — runtime.createQueueItemBackendSubmission has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 10, if/else 9 (10 pts), ternaries 4 (7 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · QueueHeaderActions.InvocationCacheSection (cognitive 27) · ×1
  • QueueHeaderActions.InvocationCacheSection (cognitive 27) invokeai/frontend/webv2/src/features/queue/ui/QueueHeaderActions.tsx:181 — QueueHeaderActions.InvocationCacheSection has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 12 (22 pts), boolean chains 3, error handling 1, if/else 1 (nesting depth added 10). Of this number, 24 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · settings.sanitizeVideoReferences (cognitive 27) · ×1
  • settings.sanitizeVideoReferences (cognitive 27) invokeai/frontend/webv2/src/features/video/core/settings.ts:190 — settings.sanitizeVideoReferences has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 7, loops 4 (5 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RasterizeLayerController.rasterize (cognitive 27) · ×1
  • RasterizeLayerController.rasterize (cognitive 27) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/rasterizeLayerController.ts:72 — RasterizeLayerController.rasterize has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 6, ternaries 3 (6 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · adjustments.buildCurveLut (cognitive 27) · ×1
  • adjustments.buildCurveLut (cognitive 27) invokeai/frontend/webv2/src/workbench/canvas-engine/render/adjustments.ts:33 — adjustments.buildCurveLut has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 8 (11 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · pointerPipeline.createPointerPipeline.onKeyDown (cognitive 27) · ×1
  • pointerPipeline.createPointerPipeline.onKeyDown (cognitive 27) invokeai/frontend/webv2/src/workbench/canvas-engine/input/pointerPipeline.ts:413 — pointerPipeline.createPointerPipeline.onKeyDown has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 6 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · executeImageRecall.executeLoadMediaWorkflow (cognitive 27) · ×1
  • executeImageRecall.executeLoadMediaWorkflow (cognitive 27) invokeai/frontend/webv2/src/workbench/image-actions/executeImageRecall.ts:96 — executeImageRecall.executeLoadMediaWorkflow has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 4, ternaries 2, error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReferenceImageSettings.ReferenceImageEditor (cognitive 27) · ×1
  • ReferenceImageSettings.ReferenceImageEditor (cognitive 27) invokeai/frontend/webv2/src/workbench/widgets/layers/ReferenceImageSettings.tsx:225 — ReferenceImageSettings.ReferenceImageEditor has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 14 (17 pts), if/else 6, boolean chains 4 (nesting depth added 3). Most of this is not in the body itself: 11 of the 27 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 328, 278, 291, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · recall_parameters.resolve_ip_adapter_models (cognitive 26) · ×1
  • recall_parameters.resolve_ip_adapter_models (cognitive 26) invokeai/app/api/routers/recall_parameters.py:270 — recall_parameters.resolve_ip_adapter_models has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (25 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AnimaLoRACollectionLoader.invoke (cognitive 26) · ×1
  • AnimaLoRACollectionLoader.invoke (cognitive 26) invokeai/app/invocations/anima/anima_lora_loader.py:124 — AnimaLoRACollectionLoader.invoke has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (19 pts), ternaries 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelInstallService._staged_remote_files (cognitive 26) · ×1
  • ModelInstallService._staged_remote_files (cognitive 26) invokeai/app/services/model_install/model_install_default.py:2386 — ModelInstallService._staged_remote_files has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 4 (9 pts), error handling 1 (4 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DefaultSessionRunner._run_session_loop (cognitive 26) · ×1
  • DefaultSessionRunner._run_session_loop (cognitive 26) invokeai/app/services/session_processor/session_processor_default.py:214 — DefaultSessionRunner._run_session_loop has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (20 pts), boolean chains 3, error handling 1 (2 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StreamBuffer._coerce_event (cognitive 26) · ×1
  • StreamBuffer._coerce_event (cognitive 26) invokeai/app/services/shared/execution_engine/primitives.py:322 — StreamBuffer._coerce_event has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 3, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GraphExecutionState._record_iterate_stream (cognitive 26) · ×1
  • GraphExecutionState._record_iterate_stream (cognitive 26) invokeai/app/services/shared/graph.py:1625 — GraphExecutionState._record_iterate_stream has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (22 pts), ternaries 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Graph._resolve_collection_input_types (cognitive 26) · ×1
  • Graph._resolve_collection_input_types (cognitive 26) invokeai/app/services/shared/graph_validation.py:1762 — Graph._resolve_collection_input_types has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 3 (7 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkingMemoryCalibrationService.refresh_user_fits (cognitive 26) · ×1
  • WorkingMemoryCalibrationService.refresh_user_fits (cognitive 26) invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py:1520 — WorkingMemoryCalibrationService.refresh_user_fits has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (15 pts), ternaries 3 (8 pts), boolean chains 2, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkingMemoryCalibrationService._canceled_runs (cognitive 26) · ×1
  • WorkingMemoryCalibrationService._canceled_runs (cognitive 26) invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py:1637 — WorkingMemoryCalibrationService._canceled_runs has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 3 (5 pts), boolean chains 4, ternaries 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LQProjection2D.init_weights (cognitive 26) · ×1
  • LQProjection2D.init_weights (cognitive 26) invokeai/backend/pid/_src/networks/lq_projection_2d.py:271 — LQProjection2D.init_weights has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (24 pts), loops 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · nvfp4.find_nvfp4_layers (cognitive 26) · ×1
  • nvfp4.find_nvfp4_layers (cognitive 26) invokeai/backend/quantization/nvfp4.py:196 — nvfp4.find_nvfp4_layers has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 8, error handling 1 (2 pts), loops 2, ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · MultiDiffusionPipeline.multi_diffusion_denoise (cognitive 26) · ×1
  • MultiDiffusionPipeline.multi_diffusion_denoise (cognitive 26) invokeai/backend/stable_diffusion/multi_diffusion_pipeline.py:39 — MultiDiffusionPipeline.multi_diffusion_denoise has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (23 pts), loops 2 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · fit.two_phase_envelope (cognitive 26) · ×1
  • fit.two_phase_envelope (cognitive 26) invokeai/backend/working_memory/fit.py:415 — fit.two_phase_envelope has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (15 pts), ternaries 3 (4 pts), error handling 1 (3 pts), boolean chains 2, loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · calibrate_flux2_denoise_working_memory._summarize_fit (cognitive 26) · ×1
  • calibrate_flux2_denoise_working_memory._summarize_fit (cognitive 26) scripts/calibrate_flux2_denoise_working_memory.py:424 — calibrate_flux2_denoise_working_memory._summarize_fit has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 4 (6 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Picker.PickerSyncer (cognitive 26) · ×1
  • Picker.PickerSyncer (cognitive 26) invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx:669 — Picker.PickerSyncer has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 13). None of this is in the body itself: all 26 points belong to 2 function literals inside it that branch (lines 687, 689). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ChangeBoardModal.ChangeBoardModal (cognitive 26) · ×1
  • ChangeBoardModal.ChangeBoardModal (cognitive 26) invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:40 — ChangeBoardModal.ChangeBoardModal has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 7, ternaries 4 (5 pts), loops 1 (2 pts) (nesting depth added 4). Most of this is not in the body itself: 1 of the 26 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 87, 59, 182, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · pressure.appendPressureStrokeRenderOpsToCanvas (cognitive 26) · ×1
  • pressure.appendPressureStrokeRenderOpsToCanvas (cognitive 26) invokeai/frontend/webv1/src/features/controlLayers/konva/pressure.ts:491 — pressure.appendPressureStrokeRenderOpsToCanvas has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · buildAnimaGraph.buildAnimaGraph (cognitive 26) · ×1
  • buildAnimaGraph.buildAnimaGraph (cognitive 26) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildAnimaGraph.ts:32 — buildAnimaGraph.buildAnimaGraph has cognitive complexity 26 (threshold 15). Drivers by points: if/else 16 (18 pts), boolean chains 6, ternaries 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · validateWorkflow.refreshCallSavedWorkflowDynamicInputs (cognitive 26) · ×1
  • validateWorkflow.refreshCallSavedWorkflowDynamicInputs (cognitive 26) invokeai/frontend/webv1/src/features/nodes/util/workflow/validateWorkflow.ts:57 — validateWorkflow.refreshCallSavedWorkflowDynamicInputs has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 3 (5 pts), boolean chains 4, error handling 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mock-backend.filterGalleryItems (cognitive 26) · ×1
  • mock-backend.filterGalleryItems (cognitive 26) invokeai/frontend/webv2/scripts/mock-backend.mjs:793 — mock-backend.filterGalleryItems has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 10, ternaries 1 (nesting depth added 2). None of this is in the body itself: all 26 points belong to 2 function literals inside it that branch (lines 805, 848). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · tsSourceAnalysis.collectModuleReferences · ×1
  • tsSourceAnalysis.collectModuleReferences::visit (cognitive 26) invokeai/frontend/webv2/src/architecture/tsSourceAnalysis.ts:224 — tsSourceAnalysis.collectModuleReferences::visit has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 4 (9 pts), boolean chains 8 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · dependencyPolicy.checkDependency (cognitive 26) · ×1
  • dependencyPolicy.checkDependency (cognitive 26) invokeai/frontend/webv2/src/architecture/dependencyPolicy.ts:199 — dependencyPolicy.checkDependency has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 11 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · react.createDeferredFontRuntime (cognitive 26) · ×1
  • react.createDeferredFontRuntime (cognitive 26) invokeai/frontend/webv2/src/features/fonts/react.tsx:32 — react.createDeferredFontRuntime has cognitive complexity 26 (threshold 15). Drivers by points: if/else 17 (18 pts), loops 4, boolean chains 2, ternaries 2 (nesting depth added 1). None of this is in the body itself: all 26 points belong to 13 function items inside it that branch (a function literal at line 107, a function literal at line 132, a function literal at line 156, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · galleryGridLayout.buildSparseGalleryNavigationEntries (cognitive 26) · ×1
  • galleryGridLayout.buildSparseGalleryNavigationEntries (cognitive 26) invokeai/frontend/webv2/src/features/gallery/ui/galleryGridLayout.ts:204 — galleryGridLayout.buildSparseGalleryNavigationEntries has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 5 (14 pts), boolean chains 4, if/else 3 (4 pts), loops 3 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GalleryBoardMenu.GalleryBoardMenu (cognitive 26) · ×1
  • GalleryBoardMenu.GalleryBoardMenu (cognitive 26) invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardMenu.tsx:38 — GalleryBoardMenu.GalleryBoardMenu has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 16, if/else 8, ternaries 2. Of this number, 16 points are the body's own statements and 10 belong to 9 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · PromptParser.parseQuotedPromptFunction (cognitive 26) · ×1
  • PromptParser.parseQuotedPromptFunction (cognitive 26) invokeai/frontend/webv2/src/features/generation/core/prompt/ast.ts:410 — PromptParser.parseQuotedPromptFunction has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 5, loops 3 (5 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PromptTemplatesPanel.PromptTemplatesPanel (cognitive 26) · ×1
  • PromptTemplatesPanel.PromptTemplatesPanel (cognitive 26) invokeai/frontend/webv2/src/features/generation/ui/promptFields/PromptTemplatesPanel.tsx:65 — PromptTemplatesPanel.PromptTemplatesPanel has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 9 (18 pts), boolean chains 5, if/else 2, error handling 1 (nesting depth added 9). Of this number, 23 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · settings.isVideoSettings (cognitive 26) · ×1
  • settings.isVideoSettings (cognitive 26) invokeai/frontend/webv2/src/features/video/core/settings.ts:470 — settings.isVideoSettings has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 25, if/else 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · PreviewDetailsPanel.PreviewDetailsPanel (cognitive 26) · ×1
  • PreviewDetailsPanel.PreviewDetailsPanel (cognitive 26) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewDetailsPanel.tsx:87 — PreviewDetailsPanel.PreviewDetailsPanel has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 9 (13 pts), if/else 7, boolean chains 6 (nesting depth added 4). Of this number, 15 points are the body's own statements and 11 belong to 4 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · LayerMutationController.convertToControl (cognitive 26) · ×1
  • LayerMutationController.convertToControl (cognitive 26) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/layerMutationController.ts:484 — LayerMutationController.convertToControl has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14, boolean chains 7, ternaries 3 (5 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · fontLoader.createFontLoader.ensureSource (cognitive 26) · ×1
  • fontLoader.createFontLoader.ensureSource (cognitive 26) invokeai/frontend/webv2/src/workbench/canvas-engine/render/fontLoader.ts:350 — fontLoader.createFontLoader.ensureSource has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 4 (9 pts), boolean chains 4 (nesting depth added 11). Of this number, 24 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DiagnosticsPanel.DiagnosticsPanel (cognitive 26) · ×1
  • DiagnosticsPanel.DiagnosticsPanel (cognitive 26) invokeai/frontend/webv2/src/workbench/diagnostics/DiagnosticsPanel.tsx:128 — DiagnosticsPanel.DiagnosticsPanel has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 12 (20 pts), if/else 3, boolean chains 2, error handling 1 (nesting depth added 8). Of this number, 14 points are the body's own statements and 12 belong to 8 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · exportProject.executeInvkExport (cognitive 26) · ×1
  • exportProject.executeInvkExport (cognitive 26) invokeai/frontend/webv2/src/workbench/projects/invk/exportProject.ts:148 — exportProject.executeInvkExport has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 5, ternaries 4, loops 1 (2 pts), error handling 1 (nesting depth added 6). Of this number, 14 points are the body's own statements and 12 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GenerationDevicesSettings.GenerationDevicesSettings (cognitive 26) · ×1
  • GenerationDevicesSettings.GenerationDevicesSettings (cognitive 26) invokeai/frontend/webv2/src/workbench/settings/GenerationDevicesSettings.tsx:24 — GenerationDevicesSettings.GenerationDevicesSettings has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 12 (17 pts), if/else 5, boolean chains 3, error handling 1 (nesting depth added 5). Of this number, 18 points are the body's own statements and 8 belong to 5 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ControlModelRow.ControlModelRow (cognitive 26) · ×1
  • ControlModelRow.ControlModelRow (cognitive 26) invokeai/frontend/webv2/src/workbench/widgets/layers/ControlModelRow.tsx:65 — ControlModelRow.ControlModelRow has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 12 (17 pts), boolean chains 5, if/else 4 (nesting depth added 5). Most of this is not in the body itself: 10 of the 26 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 105, 133, 144, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · FLUXLoRACollectionLoader.invoke (cognitive 25) · ×1
  • FLUXLoRACollectionLoader.invoke (cognitive 25) invokeai/app/invocations/flux/flux_lora_loader.py:146 — FLUXLoRACollectionLoader.invoke has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (17 pts), ternaries 2 (4 pts), boolean chains 3, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _ExpertSwapper.get (cognitive 25) · ×1
  • _ExpertSwapper.get (cognitive 25) invokeai/app/invocations/wan/wan_denoise.py:214 — _ExpertSwapper.get has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (17 pts), ternaries 4, boolean chains 2, error handling 1 (2 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · DiskImageFileStorage.__iter_supported_paths (cognitive 25) · ×1
  • DiskImageFileStorage.__iter_supported_paths (cognitive 25) invokeai/app/services/image_files/image_files_disk.py:132 — DiskImageFileStorage.__iter_supported_paths has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _IfActivationController._branch_sources (cognitive 25) · ×1
  • _IfActivationController._branch_sources (cognitive 25) invokeai/app/services/shared/graph_if_activation.py:26 — _IfActivationController._branch_sources has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 5 (8 pts), boolean chains 6 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · graph_loop_topology._recognize_nested_iterate_body (cognitive 25) · ×1
  • graph_loop_topology._recognize_nested_iterate_body (cognitive 25) invokeai/app/services/shared/graph_loop_topology.py:187 — graph_loop_topology._recognize_nested_iterate_body has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 7, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · graph_loop_topology._recognize_nested_iterate_chain (cognitive 25) · ×1
  • graph_loop_topology._recognize_nested_iterate_chain (cognitive 25) invokeai/app/services/shared/graph_loop_topology.py:263 — graph_loop_topology._recognize_nested_iterate_chain has cognitive complexity 25 (threshold 15). Drivers by points: if/else 17, boolean chains 8. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · graph_nested_iterate_planner._prepare_serial_nested_iterate_chain_for_outer (cognitive 25) · ×1
  • graph_nested_iterate_planner._prepare_serial_nested_iterate_chain_for_outer (cognitive 25) invokeai/app/services/shared/graph_nested_iterate_planner.py:207 — graph_nested_iterate_planner._prepare_serial_nested_iterate_chain_for_outer has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (20 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.
D2 · Cognitive Complexity · Main_Diffusers_LTX2_Config.from_model_on_disk (cognitive 25) · ×1
  • Main_Diffusers_LTX2_Config.from_model_on_disk (cognitive 25) invokeai/backend/model_manager/configs/main.py:2079 — Main_Diffusers_LTX2_Config.from_model_on_disk has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 5, loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · flux2_state_dict_utils.convert_flux2_vae_bfl_to_diffusers (cognitive 25) · ×1
  • flux2_state_dict_utils.convert_flux2_vae_bfl_to_diffusers (cognitive 25) invokeai/backend/model_manager/load/model_loaders/flux2_state_dict_utils.py:252 — flux2_state_dict_utils.convert_flux2_vae_bfl_to_diffusers has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (24 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GenericDiffusersLoader.get_hf_load_class (cognitive 25) · ×1
  • GenericDiffusersLoader.get_hf_load_class (cognitive 25) invokeai/backend/model_manager/load/model_loaders/generic_diffusers.py:52 — GenericDiffusersLoader.get_hf_load_class has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 6 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ggml_tensor.dequantize_and_run (cognitive 25) · ×1
  • ggml_tensor.dequantize_and_run (cognitive 25) invokeai/backend/quantization/gguf/ggml_tensor.py:15 — ggml_tensor.dequantize_and_run has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 6, loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkflowFormPreview.WorkflowFormPreview (cognitive 25) · ×1
  • WorkflowFormPreview.WorkflowFormPreview (cognitive 25) invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:81 — WorkflowFormPreview.WorkflowFormPreview has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 5, loops 1 (nesting depth added 5). Most of this is not in the body itself: 6 of the 25 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 112, 93, 102). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · GalleryImageGridPaged.GalleryImageGridPaged (cognitive 25) · ×1
  • GalleryImageGridPaged.GalleryImageGridPaged (cognitive 25) invokeai/frontend/webv1/src/features/gallery/components/GalleryImageGridPaged.tsx:13 — GalleryImageGridPaged.GalleryImageGridPaged has cognitive complexity 25 (threshold 15). Drivers by points: if/else 18 (19 pts), boolean chains 6 (nesting depth added 1). Most of this is not in the body itself: 2 of the 25 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 36, 84, 67, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · RelatedModels.RelatedModels (cognitive 25) · ×1
  • RelatedModels.RelatedModels (cognitive 25) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/RelatedModels.tsx:108 — RelatedModels.RelatedModels has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 7, loops 3 (4 pts), ternaries 2 (nesting depth added 4). Most of this is not in the body itself: 4 of the 25 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 220, 246, 141, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · fieldValidators.validateNumberFieldCollectionValue (cognitive 25) · ×1
  • fieldValidators.validateNumberFieldCollectionValue (cognitive 25) invokeai/frontend/webv1/src/features/nodes/store/util/fieldValidators.ts:116 — fieldValidators.validateNumberFieldCollectionValue has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 8, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · run-project-file-journey.executeProjectFileJourney (cognitive 25) · ×1
  • run-project-file-journey.executeProjectFileJourney (cognitive 25) REDACTED:1158 — run-project-file-journey.executeProjectFileJourney has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (15 pts), error handling 4, boolean chains 3, ternaries 2 (3 pts) (nesting depth added 3). Most of this is not in the body itself: 5 of the 25 points are its own statements and the rest belongs to 9 function items inside it that branch (stopPreview, a function literal at line 1226, fail, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · backend.moveGalleryVideoItemsToBoard (cognitive 25) · ×1
  • backend.moveGalleryVideoItemsToBoard (cognitive 25) REDACTED:1415 — backend.moveGalleryVideoItemsToBoard has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 3, error handling 1 (2 pts), loops 2, ternaries 1 (nesting depth added 9). Most of this is not in the body itself: 8 of the 25 points are its own statements and the rest belongs to 2 function items inside it that branch (worker, claimNextVideo). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · controlValidation.getControlValidationReason (cognitive 25) · ×1
  • controlValidation.getControlValidationReason (cognitive 25) invokeai/frontend/webv2/src/features/generation/core/canvas/controlValidation.ts:113 — controlValidation.getControlValidationReason has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14, boolean chains 9, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · attention.adjustNodes (cognitive 25) · ×1
  • attention.adjustNodes (cognitive 25) invokeai/frontend/webv2/src/features/generation/core/prompt/attention.ts:263 — attention.adjustNodes has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (16 pts), ternaries 2 (5 pts), boolean chains 3, loops 1 (nesting depth added 11). Of this number, 19 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · videoPolicies.getVideoComponentSectionPolicy (cognitive 25) · ×1
  • videoPolicies.getVideoComponentSectionPolicy (cognitive 25) invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:1510 — videoPolicies.getVideoComponentSectionPolicy has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 10, ternaries 5 (9 pts), if/else 5 (6 pts) (nesting depth added 5). Of this number, 18 points are the body's own statements and 7 belong to 7 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · connectors.resolveLoopLinkagePath (cognitive 25) · ×1
  • connectors.resolveLoopLinkagePath (cognitive 25) invokeai/frontend/webv2/src/features/workflow/core/connectors.ts:56 — connectors.resolveLoopLinkagePath has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 7, loops 1 (nesting depth added 8). Of this number, 24 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · batch.readProperty (cognitive 25) · ×1
  • batch.readProperty (cognitive 25) invokeai/frontend/webv2/src/features/workflow/core/batch.ts:301 — batch.readProperty has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 8 (18 pts), boolean chains 5, if/else 1, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · templates.buildInputTemplate (cognitive 25) · ×1
  • templates.buildInputTemplate (cognitive 25) invokeai/frontend/webv2/src/features/workflow/data/templates.ts:237 — templates.buildInputTemplate has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 13 (17 pts), boolean chains 8 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · GeneratorFieldInput.GeneratorFieldInput (cognitive 25) · ×1
  • GeneratorFieldInput.GeneratorFieldInput (cognitive 25) invokeai/frontend/webv2/src/features/workflow/ui/fields/GeneratorFieldInput.tsx:396 — GeneratorFieldInput.GeneratorFieldInput has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 9, boolean chains 8, if/else 7 (8 pts) (nesting depth added 1). Of this number, 16 points are the body's own statements and 9 belong to 5 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · layerPanelState.reconcileLayerPanelState (cognitive 25) · ×1
  • layerPanelState.reconcileLayerPanelState (cognitive 25) invokeai/frontend/webv2/src/workbench/layerPanelState.ts:204 — layerPanelState.reconcileLayerPanelState has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 8 (12 pts), boolean chains 8, if/else 4 (5 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · useCanvasGallerySave.useCanvasGallerySave.save (cognitive 25) · ×1
  • useCanvasGallerySave.useCanvasGallerySave.save (cognitive 25) invokeai/frontend/webv2/src/workbench/widgets/canvas/useCanvasGallerySave.ts:52 — useCanvasGallerySave.useCanvasGallerySave.save has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (15 pts), ternaries 3 (6 pts), boolean chains 3, error handling 1 (nesting depth added 7). Most of this is not in the body itself: 1 of the 25 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 59, 84). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · layerRowSummary.layerRowSummary (cognitive 25) · ×1
  • layerRowSummary.layerRowSummary (cognitive 25) invokeai/frontend/webv2/src/workbench/widgets/layers/layerRowSummary.ts:6 — layerRowSummary.layerRowSummary has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (14 pts), ternaries 4 (9 pts), boolean chains 1, match/switch 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · PreviewFilmstrip.FilmstripLiveThumb (cognitive 25) · ×1
  • PreviewFilmstrip.FilmstripLiveThumb (cognitive 25) invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFilmstrip.tsx:126 — PreviewFilmstrip.FilmstripLiveThumb has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 11 (14 pts), if/else 7 (8 pts), boolean chains 3 (nesting depth added 4). Of this number, 17 points are the body's own statements and 8 belong to 4 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · workbenchState.assembleWorkbenchProject (cognitive 25) · ×1
  • workbenchState.assembleWorkbenchProject (cognitive 25) invokeai/frontend/webv2/src/workbench/workbenchState.ts:2076 — workbenchState.assembleWorkbenchProject has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 6, ternaries 4 (5 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · imageMapStore.refreshImageIndexStatus (cognitive 25) · ×1
  • imageMapStore.refreshImageIndexStatus (cognitive 25) invokeai/frontend/webv2/src/workbench/image-map/imageMapStore.ts:424 — imageMapStore.refreshImageIndexStatus has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 10, if/else 7 (10 pts), ternaries 2 (5 pts) (nesting depth added 6). Most of this is not in the body itself: 1 of the 25 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 437, 496). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · useCommandPaletteController.useCommandPaletteController (cognitive 25) · ×1
  • useCommandPaletteController.useCommandPaletteController (cognitive 25) invokeai/frontend/webv2/src/workbench/palette/useCommandPaletteController.ts:61 — useCommandPaletteController.useCommandPaletteController has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 11 (19 pts), boolean chains 6 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WidgetInstanceContextMenu.WidgetInstanceContextMenu (cognitive 25) · ×1
  • WidgetInstanceContextMenu.WidgetInstanceContextMenu (cognitive 25) invokeai/frontend/webv2/src/workbench/widget-frame/WidgetInstanceContextMenu.tsx:34 — WidgetInstanceContextMenu.WidgetInstanceContextMenu has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 10 (18 pts), if/else 4, boolean chains 3 (nesting depth added 8). Of this number, 17 points are the body's own statements and 8 belong to 5 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SocketIO._handle_connect (cognitive 24) · ×1
  • SocketIO._handle_connect (cognitive 24) invokeai/app/api/sockets.py:266 — SocketIO._handle_connect has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (18 pts), error handling 1 (4 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MetadataToLorasInvocation.invoke (cognitive 24) · ×1
  • MetadataToLorasInvocation.invoke (cognitive 24) invokeai/app/invocations/metadata_linked.py:999 — MetadataToLorasInvocation.invoke has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 1, ternaries 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WanLatentsToVideoInvocation.invoke (cognitive 24) · ×1
  • WanLatentsToVideoInvocation.invoke (cognitive 24) invokeai/app/invocations/vae/wan_latents_to_video.py:98 — WanLatentsToVideoInvocation.invoke has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 4, loops 1 (2 pts), ternaries 2, error handling 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · run_app.run_app (cognitive 24) · ×1
  • run_app.run_app (cognitive 24) invokeai/app/run_app.py:111 — run_app.run_app has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 4 (6 pts), ternaries 1 (3 pts), boolean chains 1, error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FontService._rescan_directory (cognitive 24) · ×1
  • FontService._rescan_directory (cognitive 24) REDACTED:292 — FontService._rescan_directory has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 4, error handling 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GraphExecutionState._coerce_execution_ref (cognitive 24) · ×1
  • GraphExecutionState._coerce_execution_ref (cognitive 24) invokeai/app/services/shared/graph.py:2310 — GraphExecutionState._coerce_execution_ref has cognitive complexity 24 (threshold 15). Drivers by points: if/else 16 (18 pts), boolean chains 6 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · GraphExecutionState.complete (cognitive 24) · ×1
  • GraphExecutionState.complete (cognitive 24) invokeai/app/services/shared/graph.py:3990 — GraphExecutionState.complete has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (12 pts), error handling 2 (7 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _ExecutionRuntime._build_collect_collection (cognitive 24) · ×1
  • _ExecutionRuntime._build_collect_collection (cognitive 24) invokeai/app/services/shared/graph_execution_runtime.py:134 — _ExecutionRuntime._build_collect_collection has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 4 (7 pts), boolean chains 2, loops 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · graph_iterate_planner._get_direct_iterate_collect_fan_in (cognitive 24) · ×1
  • graph_iterate_planner._get_direct_iterate_collect_fan_in (cognitive 24) invokeai/app/services/shared/graph_iterate_planner.py:26 — graph_iterate_planner._get_direct_iterate_collect_fan_in has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 7, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _ExecutionNodeBuilder._expand_root_if_for_completed_collect_branch (cognitive 24) · ×1
  • _ExecutionNodeBuilder._expand_root_if_for_completed_collect_branch (cognitive 24) invokeai/app/services/shared/graph_materializer.py:2170 — _ExecutionNodeBuilder._expand_root_if_for_completed_collect_branch has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 5, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VideoService.create (cognitive 24) · ×1
  • VideoService.create (cognitive 24) invokeai/app/services/videos/videos_default.py:51 — VideoService.create has cognitive complexity 24 (threshold 15). Drivers by points: error handling 6 (12 pts), if/else 7 (10 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkingMemoryCalibrationService._prepare_run (cognitive 24) · ×1
  • WorkingMemoryCalibrationService._prepare_run (cognitive 24) invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py:826 — WorkingMemoryCalibrationService._prepare_run has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CachedModelWithPartialLoad.partial_load_to_vram_chunk (cognitive 24) · ×1
  • CachedModelWithPartialLoad.partial_load_to_vram_chunk (cognitive 24) invokeai/backend/model_manager/load/model_cache/cached_model/cached_model_with_partial_load.py:398 — CachedModelWithPartialLoad.partial_load_to_vram_chunk has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 4, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · model_util.read_checkpoint_meta (cognitive 24) · ×1
  • model_util.read_checkpoint_meta (cognitive 24) invokeai/backend/model_manager/util/model_util.py:52 — model_util.read_checkpoint_meta has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (20 pts), error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · flux_bfl_peft_lora_conversion_utils._split_qkv_lokr_layer (cognitive 24) · ×1
  • flux_bfl_peft_lora_conversion_utils._split_qkv_lokr_layer (cognitive 24) invokeai/backend/patches/lora_conversions/flux_bfl_peft_lora_conversion_utils.py:493 — flux_bfl_peft_lora_conversion_utils._split_qkv_lokr_layer has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 3 (7 pts), loops 3 (5 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · int8_convrot.swap_in_int8_linears (cognitive 24) · ×1
  • int8_convrot.swap_in_int8_linears (cognitive 24) invokeai/backend/quantization/int8_convrot.py:1024 — int8_convrot.swap_in_int8_linears has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 3 (8 pts), boolean chains 2, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · attention._chunked_sdpa (cognitive 24) · ×1
  • attention._chunked_sdpa (cognitive 24) invokeai/backend/util/attention.py:285 — attention._chunked_sdpa has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 3 (7 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · coefficients.resolve_coefficients (cognitive 24) · ×1
  • coefficients.resolve_coefficients (cognitive 24) invokeai/backend/working_memory/coefficients.py:221 — coefficients.resolve_coefficients has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 8 (11 pts), if/else 7 (9 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · typegen.generateTypes (cognitive 24) · ×1
  • typegen.generateTypes (cognitive 24) invokeai/frontend/api/scripts/typegen.js:10 — typegen.generateTypes has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 5, loops 1 (3 pts), ternaries 1 (2 pts) (nesting depth added 11). Of this number, 17 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · AdministratorSetup.AdministratorSetup (cognitive 24) · ×1
  • AdministratorSetup.AdministratorSetup (cognitive 24) invokeai/frontend/webv1/src/features/auth/components/AdministratorSetup.tsx:26 — AdministratorSetup.AdministratorSetup has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 12, ternaries 4 (6 pts), if/else 5, error handling 1 (nesting depth added 2). Of this number, 18 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · SyncModelsDialog.SyncModelsDialog (cognitive 24) · ×1
  • SyncModelsDialog.SyncModelsDialog (cognitive 24) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelManagerPanel/SyncModelsDialog.tsx:36 — SyncModelsDialog.SyncModelsDialog has cognitive complexity 24 (threshold 15). Drivers by points: if/else 16, boolean chains 4, ternaries 3, error handling 1. Most of this is not in the body itself: 5 of the 24 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 80, 111, 142, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · parseSchema.parseSchema.invocations (cognitive 24) · ×1
  • parseSchema.parseSchema.invocations (cognitive 24) invokeai/frontend/webv1/src/features/nodes/util/schema/parseSchema.ts:108 — parseSchema.parseSchema.invocations has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14, ternaries 4 (6 pts), boolean chains 2, error handling 2 (nesting depth added 2). Most of this is not in the body itself: 3 of the 24 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 120, 200). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · UpscaleTabAdvancedSettingsAccordion.UpscaleTabAdvancedSettingsAccordion (cognitive 24) · ×1
  • UpscaleTabAdvancedSettingsAccordion.UpscaleTabAdvancedSettingsAccordion (cognitive 24) invokeai/frontend/webv1/src/features/settingsAccordions/components/AdvancedSettingsAccordion/UpscaleTabAdvancedSettingsAccordion.tsx:18 — UpscaleTabAdvancedSettingsAccordion.UpscaleTabAdvancedSettingsAccordion has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 2, ternaries 1 (nesting depth added 10). Most of this is not in the body itself: 2 of the 24 points are its own statements and the rest belongs to one function literal inside it that branches (line 26). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · GalleryPickerGrid.GalleryPickerGrid (cognitive 24) · ×1
  • GalleryPickerGrid.GalleryPickerGrid (cognitive 24) invokeai/frontend/webv2/src/features/gallery/ui/picker/GalleryPickerGrid.tsx:192 — GalleryPickerGrid.GalleryPickerGrid has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 10, if/else 8, ternaries 6. Most of this is not in the body itself: 6 of the 24 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 386, 281, 332, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · PositivePromptActions.ExpandPromptButton (cognitive 24) · ×1
  • PositivePromptActions.ExpandPromptButton (cognitive 24) invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx:652 — PositivePromptActions.ExpandPromptButton has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 11 (15 pts), boolean chains 8, if/else 1 (nesting depth added 4). Of this number, 20 points are the body's own statements and 4 belong to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · baseGenerationPolicies.getReferenceImageValidationIssues (cognitive 24) · ×1
  • baseGenerationPolicies.getReferenceImageValidationIssues (cognitive 24) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:2371 — baseGenerationPolicies.getReferenceImageValidationIssues has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 10, ternaries 1 (2 pts) (nesting depth added 3). Most of this is not in the body itself: 7 of the 24 points are its own statements and the rest belongs to one function literal inside it that branches (line 2397). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · graph.buildQwenImageGraph (cognitive 24) · ×1
  • graph.buildQwenImageGraph (cognitive 24) invokeai/frontend/webv2/src/features/generation/core/graph.ts:973 — graph.buildQwenImageGraph has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 6, boolean chains 3, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GenerateModelCard.GenerateModelCard (cognitive 24) · ×1
  • GenerateModelCard.GenerateModelCard (cognitive 24) invokeai/frontend/webv2/src/features/generation/ui/GenerateModelCard.tsx:51 — GenerateModelCard.GenerateModelCard has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 8 (14 pts), boolean chains 5, if/else 5 (nesting depth added 6). Of this number, 16 points are the body's own statements and 8 belong to 6 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WildcardTransferActions.WildcardTransferActions (cognitive 24) · ×1
  • WildcardTransferActions.WildcardTransferActions (cognitive 24) invokeai/frontend/webv2/src/features/generation/ui/promptFields/WildcardTransferActions.tsx:39 — WildcardTransferActions.WildcardTransferActions has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 7 (10 pts), if/else 6 (9 pts), error handling 3, boolean chains 2 (nesting depth added 6). Most of this is not in the body itself: 2 of the 24 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 62, 102, 140, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ClearDialog.ClearDialog (cognitive 24) · ×1
  • ClearDialog.ClearDialog (cognitive 24) invokeai/frontend/webv2/src/features/intermediates/ui/ClearDialog.tsx:151 — ClearDialog.ClearDialog has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 11 (13 pts), boolean chains 10, if/else 1 (nesting depth added 2). Of this number, 21 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ExternalProviderKeyCards.ExternalProviderKeyCard (cognitive 24) · ×1
  • ExternalProviderKeyCards.ExternalProviderKeyCard (cognitive 24) invokeai/frontend/webv2/src/features/models/ui/credentials/ExternalProviderKeyCards.tsx:103 — ExternalProviderKeyCards.ExternalProviderKeyCard has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 8, ternaries 6 (nesting depth added 1). Most of this is not in the body itself: 9 of the 24 points are its own statements and the rest belongs to 6 function items inside it that branch (handleSave, a function literal at line 127, a function literal at line 186, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · runtime.createQueueRuntime.handleUnadoptedRerunSettled (cognitive 24) · ×1
  • runtime.createQueueRuntime.handleUnadoptedRerunSettled (cognitive 24) invokeai/frontend/webv2/src/features/queue/runtime.ts:1733 — runtime.createQueueRuntime.handleUnadoptedRerunSettled has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 7, ternaries 4 (5 pts) (nesting depth added 3). Of this number, 12 points are the body's own statements and 12 belong to 4 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · callSavedWorkflow.syncCallSavedWorkflowFields (cognitive 24) · ×1
  • callSavedWorkflow.syncCallSavedWorkflowFields (cognitive 24) invokeai/frontend/webv2/src/features/workflow/core/callSavedWorkflow.ts:220 — callSavedWorkflow.syncCallSavedWorkflowFields has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 12, ternaries 4 (7 pts), if/else 2 (3 pts), loops 2 (nesting depth added 4). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · workflowJson.parseForm (cognitive 24) · ×1
  • workflowJson.parseForm (cognitive 24) invokeai/frontend/webv2/src/features/workflow/core/workflowJson.ts:212 — workflowJson.parseForm has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 3 (6 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkflowFieldInput.MediaInput (cognitive 24) · ×1
  • WorkflowFieldInput.MediaInput (cognitive 24) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:1044 — WorkflowFieldInput.MediaInput has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 16 (20 pts), boolean chains 3, if/else 1 (nesting depth added 4). Of this number, 22 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · CanvasHeaderActions.CanvasHeaderActionsInner (cognitive 24) · ×1
  • CanvasHeaderActions.CanvasHeaderActionsInner (cognitive 24) invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasHeaderActions.tsx:104 — CanvasHeaderActions.CanvasHeaderActionsInner has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 12, boolean chains 9, if/else 3. Of this number, 16 points are the body's own statements and 8 belong to 5 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · canvasToolCommands.executeCanvasToolCommand (cognitive 24) · ×1
  • canvasToolCommands.executeCanvasToolCommand (cognitive 24) invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasToolCommands.ts:77 — canvasToolCommands.executeCanvasToolCommand has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (16 pts), ternaries 2 (6 pts), boolean chains 1, match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CanvasColorFeed.ColorSampleRouting (cognitive 24) · ×1
  • CanvasColorFeed.ColorSampleRouting (cognitive 24) invokeai/frontend/webv2/src/workbench/widgets/canvas/color-system/CanvasColorFeed.tsx:110 — CanvasColorFeed.ColorSampleRouting has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (18 pts), ternaries 2 (3 pts), boolean chains 2, match/switch 1 (nesting depth added 9). None of this is in the body itself: all 24 points belong to 4 function items inside it that branch (a function literal at line 143, a function literal at line 122, commitSourceColor, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · useLayerStackActions.useLayerStackActions (cognitive 24) · ×1
  • useLayerStackActions.useLayerStackActions (cognitive 24) invokeai/frontend/webv2/src/workbench/widgets/layers/useLayerStackActions.ts:47 — useLayerStackActions.useLayerStackActions has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10, ternaries 6 (10 pts), boolean chains 4 (nesting depth added 4). Most of this is not in the body itself: 1 of the 24 points is its own statement and the rest belongs to 8 function literals inside it that branch (lines 78, 117, 155, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ColorPane.ColorPane (cognitive 24) · ×1
  • ColorPane.ColorPane (cognitive 24) invokeai/frontend/webv2/src/workbench/widgets/layers/panes/ColorPane.tsx:44 — ColorPane.ColorPane has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (14 pts), ternaries 8, boolean chains 2 (nesting depth added 2). Most of this is not in the body itself: 8 of the 24 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 127, 54, 111, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · CopyLayerController.copy (cognitive 24) · ×1
  • CopyLayerController.copy (cognitive 24) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/copyLayerController.ts:85 — CopyLayerController.copy has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (14 pts), ternaries 4 (6 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · workbenchStore.createCommands (cognitive 24) · ×1
  • workbenchStore.createCommands (cognitive 24) invokeai/frontend/webv2/src/workbench/workbenchStore.ts:87 — workbenchStore.createCommands has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11, ternaries 11, boolean chains 2. None of this is in the body itself: all 24 points belong to 15 function literals inside it that branch (lines 428, 374, 460, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · CommandPaletteDialog.CommandPaletteContent (cognitive 24) · ×1
  • CommandPaletteDialog.CommandPaletteContent (cognitive 24) invokeai/frontend/webv2/src/workbench/palette/CommandPaletteDialog.tsx:98 — CommandPaletteDialog.CommandPaletteContent has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 12 (13 pts), if/else 5 (6 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · queueRecallCache.createIndexedDbQueueRecallCache.put (cognitive 24) · ×1
  • queueRecallCache.createIndexedDbQueueRecallCache.put (cognitive 24) invokeai/frontend/webv2/src/workbench/queue-integration/queueRecallCache.ts:210 — queueRecallCache.createIndexedDbQueueRecallCache.put has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 4, error handling 3, loops 2 (nesting depth added 6). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · image_map.search_image_map (cognitive 23) · ×1
  • image_map.search_image_map (cognitive 23) invokeai/app/api/routers/image_map.py:617 — image_map.search_image_map has cognitive complexity 23 (threshold 15). Drivers by points: error handling 4 (11 pts), if/else 8 (10 pts), boolean chains 1, ternaries 1 (nesting depth added 9). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · InvokeImageBlendInvocation.prepare_tensors_from_images (cognitive 23) · ×1
  • InvokeImageBlendInvocation.prepare_tensors_from_images (cognitive 23) invokeai/app/invocations/composition-nodes.py:515 — InvokeImageBlendInvocation.prepare_tensors_from_images has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14, ternaries 4 (8 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · DefaultSessionRunner.run_node (cognitive 23) · ×1
  • DefaultSessionRunner.run_node (cognitive 23) invokeai/app/services/session_processor/session_processor_default.py:451 — DefaultSessionRunner.run_node has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (13 pts), error handling 4 (5 pts), boolean chains 4, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · GraphExecutionState._validate_persisted_activation_tokens (cognitive 23) · ×1
  • GraphExecutionState._validate_persisted_activation_tokens (cognitive 23) invokeai/app/services/shared/graph.py:3636 — GraphExecutionState._validate_persisted_activation_tokens has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · graph_if_runtime._get_edge_frame_axes (cognitive 23) · ×1
  • graph_if_runtime._get_edge_frame_axes (cognitive 23) invokeai/app/services/shared/graph_if_runtime.py:246 — graph_if_runtime._get_edge_frame_axes has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · workflow_graph_builder._resolve_for_connector_loop_linkage_path (cognitive 23) · ×1
  • workflow_graph_builder._resolve_for_connector_loop_linkage_path (cognitive 23) invokeai/app/services/shared/workflow_graph_builder.py:313 — workflow_graph_builder._resolve_for_connector_loop_linkage_path has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 6, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AnimaControlNetLLLite.from_state_dict (cognitive 23) · ×1
  • AnimaControlNetLLLite.from_state_dict (cognitive 23) invokeai/backend/anima/control_net_lllite.py:414 — AnimaControlNetLLLite.from_state_dict has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 4, loops 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · checkpoint_layout.classify_roles (cognitive 23) · ×1
  • checkpoint_layout.classify_roles (cognitive 23) invokeai/backend/ltx2/checkpoint_layout.py:96 — checkpoint_layout.classify_roles has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (15 pts), ternaries 3 (5 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · pid_decoder._int8_sidecar_keys (cognitive 23) · ×1
  • pid_decoder._int8_sidecar_keys (cognitive 23) invokeai/backend/model_manager/configs/pid_decoder.py:253 — pid_decoder._int8_sidecar_keys has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 4, error handling 2 (3 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Ideogram4CheckpointModel._load_model (cognitive 23) · ×1
  • Ideogram4CheckpointModel._load_model (cognitive 23) invokeai/backend/model_manager/load/model_loaders/ideogram4.py:357 — Ideogram4CheckpointModel._load_model has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · loaders._get_original_shape (cognitive 23) · ×1
  • loaders._get_original_shape (cognitive 23) invokeai/backend/quantization/sdnq/loaders.py:145 — loaders._get_original_shape has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MediaImportProcessor.import_image (cognitive 23) · ×1
  • MediaImportProcessor.import_image (cognitive 23) invokeai/frontend/install/import_images.py:569 — MediaImportProcessor.import_image has cognitive complexity 23 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Picker.useKeyboardNavigation (cognitive 23) · ×1
  • Picker.useKeyboardNavigation (cognitive 23) invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx:386 — Picker.useKeyboardNavigation has cognitive complexity 23 (threshold 15). Drivers by points: if/else 20 (23 pts) (nesting depth added 3). None of this is in the body itself: all 23 points belong to 4 function literals inside it that branch (lines 407, 438, 470, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · CanvasToolModule.syncCursorStyle (cognitive 23) · ×1
  • CanvasToolModule.syncCursorStyle (cognitive 23) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasToolModule.ts:299 — CanvasToolModule.syncCursorStyle has cognitive complexity 23 (threshold 15). Drivers by points: if/else 22 (23 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · worker.getImageDataBboxArrayBufferLike (cognitive 23) · ×1
  • worker.getImageDataBboxArrayBufferLike (cognitive 23) invokeai/frontend/webv1/src/features/controlLayers/konva/worker.ts:18 — worker.getImageDataBboxArrayBufferLike has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (19 pts), loops 2 (3 pts), 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.
D2 · Cognitive Complexity · validators.getGlobalReferenceImageWarnings (cognitive 23) · ×1
  • validators.getGlobalReferenceImageWarnings (cognitive 23) invokeai/frontend/webv1/src/features/controlLayers/store/validators.ts:176 — validators.getGlobalReferenceImageWarnings has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 4 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Flow.Flow (cognitive 23) · ×1
  • Flow.Flow (cognitive 23) invokeai/frontend/webv1/src/features/nodes/components/flow/Flow.tsx:89 — Flow.Flow has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15, boolean chains 5, ternaries 3. Most of this is not in the body itself: 2 of the 23 points are its own statements and the rest belongs to 13 function literals inside it that branch (lines 284, 342, 111, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · useNodeCopyPaste._pasteSelection (cognitive 23) · ×1
  • useNodeCopyPaste._pasteSelection (cognitive 23) invokeai/frontend/webv1/src/features/nodes/hooks/useNodeCopyPaste.ts:37 — useNodeCopyPaste._pasteSelection has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 3, ternaries 2, loops 1 (nesting depth added 4). Most of this is not in the body itself: 5 of the 23 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 122, 59, 87, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · PromptTriggerSelect.PromptTriggerSelect (cognitive 23) · ×1
  • PromptTriggerSelect.PromptTriggerSelect (cognitive 23) invokeai/frontend/webv1/src/features/prompt/PromptTriggerSelect.tsx:23 — PromptTriggerSelect.PromptTriggerSelect has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 5, loops 1 (nesting depth added 5). None of this is in the body itself: all 23 points belong to 8 function literals inside it that branch (lines 67, 100, 35, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · onModelInstallError.buildOnModelInstallError.<returned closure> (cognitive 23) · ×1
  • onModelInstallError.buildOnModelInstallError.<returned closure> (cognitive 23) invokeai/frontend/webv1/src/services/events/onModelInstallError.tsx:55 — onModelInstallError.buildOnModelInstallError.<returned closure> has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15 (23 pts) (nesting depth added 8). Of this number, 21 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · baseGenerationPolicies.getBaseComponentSectionPolicy (cognitive 23) · ×1
  • baseGenerationPolicies.getBaseComponentSectionPolicy (cognitive 23) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:1041 — baseGenerationPolicies.getBaseComponentSectionPolicy has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 8 (18 pts), boolean chains 3, if/else 1, match/switch 1 (nesting depth added 10). Of this number, 19 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelSettingsMenuItems.ModelSettingsMenuItems (cognitive 23) · ×1
  • ModelSettingsMenuItems.ModelSettingsMenuItems (cognitive 23) invokeai/frontend/webv2/src/features/models/ui/detail/ModelSettingsMenuItems.tsx:21 — ModelSettingsMenuItems.ModelSettingsMenuItems has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (16 pts), error handling 2 (4 pts), boolean chains 2, ternaries 1 (nesting depth added 4). None of this is in the body itself: all 23 points belong to 3 function items inside it that branch (a function literal at line 59, handleExport, handleFileChange). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · runtime.createQueueRuntime.routeRunResults (cognitive 23) · ×1
  • runtime.createQueueRuntime.routeRunResults (cognitive 23) invokeai/frontend/webv2/src/features/queue/runtime.ts:1134 — runtime.createQueueRuntime.routeRunResults has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 2 (5 pts), boolean chains 3, error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utilityGraph.submitUtilityGraph (cognitive 23) · ×1
  • utilityGraph.submitUtilityGraph (cognitive 23) invokeai/frontend/webv2/src/features/queue/runtime/utilityGraph.ts:427 — utilityGraph.submitUtilityGraph has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (13 pts), error handling 4 (5 pts), ternaries 2 (4 pts), loops 1 (nesting depth added 6). Of this number, 15 points are the body's own statements and 8 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkflowSelectionRequestRuntime.WorkflowSelectionRequestRuntime (cognitive 23) · ×1
  • WorkflowSelectionRequestRuntime.WorkflowSelectionRequestRuntime (cognitive 23) invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowSelectionRequestRuntime.tsx:97 — WorkflowSelectionRequestRuntime.WorkflowSelectionRequestRuntime has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 6, ternaries 5 (6 pts) (nesting depth added 2). None of this is in the body itself: all 23 points belong to 6 function items inside it that branch (a function literal at line 171, a function literal at line 149, a function literal at line 111, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · draftStore.isProjectDraftCandidate (cognitive 23) · ×1
  • draftStore.isProjectDraftCandidate (cognitive 23) invokeai/frontend/webv2/src/workbench/projects/draftStore.ts:452 — draftStore.isProjectDraftCandidate has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 20, if/else 3. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · draftStore.createMemoryProjectDraftStore.reconcileUnloadJournal (cognitive 23) · ×1
  • draftStore.createMemoryProjectDraftStore.reconcileUnloadJournal (cognitive 23) invokeai/frontend/webv2/src/workbench/projects/draftStore.ts:1244 — draftStore.createMemoryProjectDraftStore.reconcileUnloadJournal has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 4 (10 pts), boolean chains 2, loops 1 (nesting depth added 11). Of this number, 22 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · canvasProjectMutations.applyMoves (cognitive 23) · ×1
  • canvasProjectMutations.applyMoves (cognitive 23) invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts:368 — canvasProjectMutations.applyMoves has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 6, ternaries 3, loops 1 (nesting depth added 1). Most of this is not in the body itself: 10 of the 23 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 409, a function literal at line 434, namesMoving, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · controlModelResolution.resolveControlModel (cognitive 23) · ×1
  • controlModelResolution.resolveControlModel (cognitive 23) invokeai/frontend/webv2/src/workbench/controlModelResolution.ts:100 — controlModelResolution.resolveControlModel has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 8 (11 pts), if/else 7, boolean chains 5 (nesting depth added 3). Of this number, 17 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · layerExportActions.saveLayerToBoard (cognitive 23) · ×1
  • layerExportActions.saveLayerToBoard (cognitive 23) invokeai/frontend/webv2/src/workbench/widgets/layers/layerExportActions.ts:76 — layerExportActions.saveLayerToBoard has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 3, ternaries 1 (3 pts), error handling 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PixelEditController.beginMaterialized (cognitive 23) · ×1
  • PixelEditController.beginMaterialized (cognitive 23) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/controlPixelController.ts:351 — PixelEditController.beginMaterialized has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (10 pts), ternaries 5 (6 pts), error handling 3 (4 pts), boolean chains 3 (nesting depth added 3). Of this number, 13 points are the body's own statements and 10 belong to 4 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SelectObjectCoordinator.createSelectObjectOperationCoordinator.save (cognitive 23) · ×1
  • SelectObjectCoordinator.createSelectObjectOperationCoordinator.save (cognitive 23) invokeai/frontend/webv2/src/workbench/canvas-operations/SelectObjectCoordinator.ts:320 — SelectObjectCoordinator.createSelectObjectOperationCoordinator.save has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 2, ternaries 1 (2 pts), error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · imageRecall.getMetadataConcepts (cognitive 23) · ×1
  • imageRecall.getMetadataConcepts (cognitive 23) invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:982 — imageRecall.getMetadataConcepts has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 4 (8 pts), boolean chains 4, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ImageStorageSettings.ImageStorageEditor (cognitive 23) · ×1
  • ImageStorageSettings.ImageStorageEditor (cognitive 23) invokeai/frontend/webv2/src/workbench/settings/ImageStorageSettings.tsx:106 — ImageStorageSettings.ImageStorageEditor has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 13, boolean chains 7, if/else 3. Of this number, 12 points are the body's own statements and 11 belong to 7 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · QueueCluster.QueueTooltip (cognitive 23) · ×1
  • QueueCluster.QueueTooltip (cognitive 23) invokeai/frontend/webv2/src/workbench/shell/topbar/QueueCluster.tsx:307 — QueueCluster.QueueTooltip has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 10 (14 pts), if/else 5, boolean chains 4 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · video_recall.apply_media_precedence (cognitive 22) · ×1
  • video_recall.apply_media_precedence (cognitive 22) invokeai/app/api/routers/video_recall.py:374 — video_recall.apply_media_precedence has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 3 (7 pts), boolean chains 1, ternaries 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChildDependencyRecord._record_completion (cognitive 22) · ×1
  • ChildDependencyRecord._record_completion (cognitive 22) invokeai/app/services/shared/execution_engine/child.py:638 — ChildDependencyRecord._record_completion has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 5 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · execution_state_migration._compact_effects (cognitive 22) · ×1
  • execution_state_migration._compact_effects (cognitive 22) invokeai/app/services/shared/execution_state_migration.py:42 — execution_state_migration._compact_effects has cognitive complexity 22 (threshold 15). Drivers by points: if/else 3 (8 pts), ternaries 2 (6 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _ExecutionNodeBuilder.create_for_body_iteration (cognitive 22) · ×1
  • _ExecutionNodeBuilder.create_for_body_iteration (cognitive 22) invokeai/app/services/shared/graph_materializer.py:460 — _ExecutionNodeBuilder.create_for_body_iteration has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Graph._get_upstream_collector_ids (cognitive 22) · ×1
  • Graph._get_upstream_collector_ids (cognitive 22) invokeai/app/services/shared/graph_validation.py:737 — Graph._get_upstream_collector_ids has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (18 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.
D2 · Cognitive Complexity · media_references.extract_media_references (cognitive 22) · ×1
  • media_references.extract_media_references (cognitive 22) invokeai/app/services/shared/media_references.py:45 — media_references.extract_media_references has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkingMemoryCalibrationService.get_status (cognitive 22) · ×1
  • WorkingMemoryCalibrationService.get_status (cognitive 22) invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py:1370 — WorkingMemoryCalibrationService.get_status has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (11 pts), ternaries 4 (7 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · model_cache._run_deferred_work (cognitive 22) · ×1
  • model_cache._run_deferred_work (cognitive 22) invokeai/backend/model_manager/load/model_cache/model_cache.py:181 — model_cache._run_deferred_work has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (16 pts), error handling 2 (5 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · QwenVLEncoderCheckpointLoader._load_text_encoder_from_singlefile (cognitive 22) · ×1
  • QwenVLEncoderCheckpointLoader._load_text_encoder_from_singlefile (cognitive 22) invokeai/backend/model_manager/load/model_loaders/qwen_image.py:442 — QwenVLEncoderCheckpointLoader._load_text_encoder_from_singlefile has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (15 pts), error handling 2 (4 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.
D2 · Cognitive Complexity · ModelOnDisk.load_state_dict (cognitive 22) · ×1
  • ModelOnDisk.load_state_dict (cognitive 22) invokeai/backend/model_manager/model_on_disk.py:182 — ModelOnDisk.load_state_dict has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (19 pts), error handling 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelSearch._walk_directory (cognitive 22) · ×1
  • ModelSearch._walk_directory (cognitive 22) invokeai/backend/model_manager/search.py:107 — ModelSearch._walk_directory has cognitive complexity 22 (threshold 15). Drivers by points: error handling 4 (10 pts), if/else 7 (8 pts), boolean chains 2, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LQProjection2D.__init__ (cognitive 22) · ×1
  • LQProjection2D.__init__ (cognitive 22) invokeai/backend/pid/_src/networks/lq_projection_2d.py:145 — LQProjection2D.__init__ has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (12 pts), loops 3 (6 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · sage_attention._ineligible (cognitive 22) · ×1
  • sage_attention._ineligible (cognitive 22) invokeai/backend/util/sage_attention.py:186 — sage_attention._ineligible has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13, boolean chains 9. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · fit.entry_fit (cognitive 22) · ×1
  • fit.entry_fit (cognitive 22) invokeai/backend/working_memory/fit.py:647 — fit.entry_fit has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 pts), error handling 2 (4 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.
D2 · Cognitive Complexity · promptAttention.adjustPromptAttention (cognitive 22) · ×1
  • promptAttention.adjustPromptAttention (cognitive 22) invokeai/frontend/webv1/src/common/util/promptAttention.ts:113 — promptAttention.adjustPromptAttention has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (20 pts), error handling 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GalleryImage.buildOnClick.<returned closure> (cognitive 22) · ×1
  • GalleryImage.buildOnClick.<returned closure> (cognitive 22) invokeai/frontend/webv1/src/features/gallery/components/ImageGrid/GalleryImage.tsx:42 — GalleryImage.buildOnClick.<returned closure> has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · buildSD1Graph.buildSD1Graph (cognitive 22) · ×1
  • buildSD1Graph.buildSD1Graph (cognitive 22) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildSD1Graph.ts:30 — buildSD1Graph.buildSD1Graph has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16 (18 pts), ternaries 3, boolean chains 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · buildSD3Graph.buildSD3Graph (cognitive 22) · ×1
  • buildSD3Graph.buildSD3Graph (cognitive 22) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildSD3Graph.ts:32 — buildSD3Graph.buildSD3Graph has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · galleryStateView.getGallerySelectedImageQuery (cognitive 22) · ×1
  • galleryStateView.getGallerySelectedImageQuery (cognitive 22) invokeai/frontend/webv2/src/features/gallery/ui/galleryStateView.ts:336 — galleryStateView.getGallerySelectedImageQuery has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 11 (12 pts), boolean chains 10 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · GalleryProgressSection.GalleryProgressTile (cognitive 22) · ×1
  • GalleryProgressSection.GalleryProgressTile (cognitive 22) invokeai/frontend/webv2/src/features/gallery/ui/GalleryProgressSection.tsx:193 — GalleryProgressSection.GalleryProgressTile has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 13 (17 pts), if/else 3, boolean chains 2 (nesting depth added 4). Of this number, 19 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · graph.buildFlux2Graph (cognitive 22) · ×1
  • graph.buildFlux2Graph (cognitive 22) invokeai/frontend/webv2/src/features/generation/core/graph.ts:755 — graph.buildFlux2Graph has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 13 (16 pts), boolean chains 5, if/else 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · highlight.forEachTokenAnnotation (cognitive 22) · ×1
  • highlight.forEachTokenAnnotation (cognitive 22) invokeai/frontend/webv2/src/features/generation/core/prompt/highlight.ts:115 — highlight.forEachTokenAnnotation has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 4 (7 pts), boolean chains 3 (nesting depth added 11). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExternalSizeSelect.ExternalSizeSelect (cognitive 22) · ×1
  • ExternalSizeSelect.ExternalSizeSelect (cognitive 22) invokeai/frontend/webv2/src/features/generation/ui/shared/ExternalSizeSelect.tsx:44 — ExternalSizeSelect.ExternalSizeSelect has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 9 (11 pts), if/else 5 (6 pts), boolean chains 5 (nesting depth added 3). Of this number, 16 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · PromptTemplateEditor.PromptTemplateEditor (cognitive 22) · ×1
  • PromptTemplateEditor.PromptTemplateEditor (cognitive 22) invokeai/frontend/webv2/src/features/generation/ui/promptFields/PromptTemplateEditor.tsx:58 — PromptTemplateEditor.PromptTemplateEditor has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9, ternaries 8 (9 pts), boolean chains 3, error handling 1 (nesting depth added 1). Most of this is not in the body itself: 7 of the 22 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 103, 216, 81, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · DefaultSettingsSection.FieldControl (cognitive 22) · ×1
  • DefaultSettingsSection.FieldControl (cognitive 22) invokeai/frontend/webv2/src/features/models/ui/detail/DefaultSettingsSection.tsx:62 — DefaultSettingsSection.FieldControl has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 6 (11 pts), if/else 6 (8 pts), boolean chains 3 (nesting depth added 7). Of this number, 14 points are the body's own statements and 8 belong to 5 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InstallProgressCell.useInstallProgressCaption (cognitive 22) · ×1
  • InstallProgressCell.useInstallProgressCaption (cognitive 22) invokeai/frontend/webv2/src/features/models/ui/install-queue/InstallProgressCell.tsx:38 — InstallProgressCell.useInstallProgressCaption has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 8 (16 pts), if/else 2 (3 pts), boolean chains 2, match/switch 1 (nesting depth added 9). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · InstallQueueBar.InstallQueueBar (cognitive 22) · ×1
  • InstallQueueBar.InstallQueueBar (cognitive 22) invokeai/frontend/webv2/src/features/models/ui/install-queue/InstallQueueBar.tsx:59 — InstallQueueBar.InstallQueueBar has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 8 (12 pts), if/else 6 (7 pts), boolean chains 3 (nesting depth added 5). Of this number, 14 points are the body's own statements and 8 belong to 5 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · formFieldSettings.applyNodeFieldFormSettings (cognitive 22) · ×1
  • formFieldSettings.applyNodeFieldFormSettings (cognitive 22) invokeai/frontend/webv2/src/features/workflow/core/formFieldSettings.ts:224 — formFieldSettings.applyNodeFieldFormSettings has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 6 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · layerWorkflow.buildLayerWorkflowGraph (cognitive 22) · ×1
  • layerWorkflow.buildLayerWorkflowGraph (cognitive 22) invokeai/frontend/webv2/src/features/workflow/core/layerWorkflow.ts:204 — layerWorkflow.buildLayerWorkflowGraph has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 4, loops 2, ternaries 2 (nesting depth added 2). Of this number, 20 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · WorkflowLibraryCard.WorkflowLibraryCard (cognitive 22) · ×1
  • WorkflowLibraryCard.WorkflowLibraryCard (cognitive 22) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryCard.tsx:86 — WorkflowLibraryCard.WorkflowLibraryCard has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 16 (18 pts), boolean chains 4 (nesting depth added 2). Of this number, 20 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · normalize.serializeErrorAtDepth (cognitive 22) · ×1
  • normalize.serializeErrorAtDepth (cognitive 22) invokeai/frontend/webv2/src/platform/logging/normalize.ts:296 — normalize.serializeErrorAtDepth has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 5, ternaries 4 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ColorPicker.ColorPicker (cognitive 22) · ×1
  • ColorPicker.ColorPicker (cognitive 22) invokeai/frontend/webv2/src/platform/ui/ColorPicker.tsx:151 — ColorPicker.ColorPicker has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 10 (11 pts), if/else 8 (10 pts), boolean chains 1 (nesting depth added 3). Of this number, 16 points are the body's own statements and 6 belong to 4 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · MergeLayerController.mergeVisible · ×1
  • MergeLayerController.mergeVisible::drawMerged (cognitive 22) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:502 — MergeLayerController.mergeVisible::drawMerged has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (13 pts), ternaries 2 (7 pts), boolean chains 1, loops 1 (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (MergeLayerController.mergeVisible) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · exportRasterComposite.exportRasterComposite (cognitive 22) · ×1
  • exportRasterComposite.exportRasterComposite (cognitive 22) invokeai/frontend/webv2/src/workbench/canvas-engine/exportRasterComposite.ts:47 — exportRasterComposite.exportRasterComposite has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 3, ternaries 2, error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · prepareCanvasInvocation.resolveRegionalReferenceImages (cognitive 22) · ×1
  • prepareCanvasInvocation.resolveRegionalReferenceImages (cognitive 22) invokeai/frontend/webv2/src/workbench/widgets/canvas/invoke/prepareCanvasInvocation.ts:203 — prepareCanvasInvocation.resolveRegionalReferenceImages has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (11 pts), ternaries 2 (6 pts), boolean chains 4, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · groupSurfaceCache.createGroupSurfaceCache.drawRange (cognitive 22) · ×1
  • groupSurfaceCache.createGroupSurfaceCache.drawRange (cognitive 22) invokeai/frontend/webv2/src/workbench/canvas-engine/render/groupSurfaceCache.ts:453 — groupSurfaceCache.createGroupSurfaceCache.drawRange has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 3 (6 pts), boolean chains 3, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · paletteQueryModel.derivePaletteQueryModel (cognitive 22) · ×1
  • paletteQueryModel.derivePaletteQueryModel (cognitive 22) invokeai/frontend/webv2/src/workbench/palette/paletteQueryModel.ts:31 — paletteQueryModel.derivePaletteQueryModel has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 13 (14 pts), boolean chains 8 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · queueRunJournal.createIndexedDbQueueRunJournal.record (cognitive 22) · ×1
  • queueRunJournal.createIndexedDbQueueRunJournal.record (cognitive 22) invokeai/frontend/webv2/src/workbench/queue-integration/queueRunJournal.ts:381 — queueRunJournal.createIndexedDbQueueRunJournal.record has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (10 pts), error handling 4 (5 pts), boolean chains 4, ternaries 2 (3 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · queueRecall.buildQueueRecallValues (cognitive 22) · ×1
  • queueRecall.buildQueueRecallValues (cognitive 22) invokeai/frontend/webv2/src/workbench/queue-integration/queueRecall.ts:52 — queueRecall.buildQueueRecallValues has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 7 (13 pts), if/else 7 (8 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · videos.ingest_uploaded_video (cognitive 21) · ×1
  • videos.ingest_uploaded_video (cognitive 21) invokeai/app/api/routers/videos.py:431 — videos.ingest_uploaded_video has cognitive complexity 21 (threshold 15). Drivers by points: error handling 7 (10 pts), if/else 6 (7 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · videos._parse_range_header (cognitive 21) · ×1
  • videos._parse_range_header (cognitive 21) invokeai/app/api/routers/videos.py:786 — videos._parse_range_header has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (12 pts), error handling 3 (7 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Flux2DevLoRACollectionLoader.invoke (cognitive 21) · ×1
  • Flux2DevLoRACollectionLoader.invoke (cognitive 21) invokeai/app/invocations/flux2/flux2_dev_lora_loader.py:145 — Flux2DevLoRACollectionLoader.invoke has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MossImageDenoiseInvocation._run_diffusion (cognitive 21) · ×1
  • MossImageDenoiseInvocation._run_diffusion (cognitive 21) invokeai/app/invocations/moss_image/moss_image_denoise.py:95 — MossImageDenoiseInvocation._run_diffusion has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 2, loops 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · gemini._iter_response_parts (cognitive 21) · ×1
  • gemini._iter_response_parts (cognitive 21) invokeai/app/services/external_generation/providers/gemini.py:181 — gemini._iter_response_parts has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GalleryMaintenanceService._scan_archive_untracked (cognitive 21) · ×1
  • GalleryMaintenanceService._scan_archive_untracked (cognitive 21) invokeai/app/services/gallery_maintenance/gallery_maintenance_default.py:330 — GalleryMaintenanceService._scan_archive_untracked has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 4 (6 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DiskImageFileStorage.save (cognitive 21) · ×1
  • DiskImageFileStorage.save (cognitive 21) invokeai/app/services/image_files/image_files_disk.py:239 — DiskImageFileStorage.save has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (12 pts), error handling 2 (5 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ImageMoveService.preflight_moves (cognitive 21) · ×1
  • ImageMoveService.preflight_moves (cognitive 21) invokeai/app/services/image_moves/image_moves_default.py:402 — ImageMoveService.preflight_moves has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IntermediatesService._resolve_scope (cognitive 21) · ×1
  • IntermediatesService._resolve_scope (cognitive 21) invokeai/app/services/intermediates/intermediates_default.py:330 — IntermediatesService._resolve_scope has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelInstallService._move_with_retries (cognitive 21) · ×1
  • ModelInstallService._move_with_retries (cognitive 21) invokeai/app/services/model_install/model_install_default.py:899 — ModelInstallService._move_with_retries has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (11 pts), error handling 2 (7 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelInstallService.resume_and_wait_for_job (cognitive 21) · ×1
  • ModelInstallService.resume_and_wait_for_job (cognitive 21) invokeai/app/services/model_install/model_install_default.py:1217 — ModelInstallService.resume_and_wait_for_job has cognitive complexity 21 (threshold 15). Drivers by points: error handling 3 (9 pts), if/else 4 (9 pts), boolean chains 1, loops 1, ternaries 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelInstallService._staging_has_recoverable_data (cognitive 21) · ×1
  • ModelInstallService._staging_has_recoverable_data (cognitive 21) invokeai/app/services/model_install/model_install_default.py:2533 — ModelInstallService._staging_has_recoverable_data has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 4, error handling 1 (3 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GraphExecutionState._value_from_object (cognitive 21) · ×1
  • GraphExecutionState._value_from_object (cognitive 21) invokeai/app/services/shared/graph.py:2374 — GraphExecutionState._value_from_object has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · graph_if_dependencies._get_fresh_if_branch_sources (cognitive 21) · ×1
  • graph_if_dependencies._get_fresh_if_branch_sources (cognitive 21) invokeai/app/services/shared/graph_if_dependencies.py:316 — graph_if_dependencies._get_fresh_if_branch_sources has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 4 (6 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · graph_if_runtime._get_reopened_source_axes (cognitive 21) · ×1
  • graph_if_runtime._get_reopened_source_axes (cognitive 21) invokeai/app/services/shared/graph_if_runtime.py:149 — graph_if_runtime._get_reopened_source_axes has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (15 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Graph._validate_special_nodes (cognitive 21) · ×1
  • Graph._validate_special_nodes (cognitive 21) invokeai/app/services/shared/graph_validation.py:945 — Graph._validate_special_nodes has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · workflow_call_compatibility._get_placeholder_for_annotation (cognitive 21) · ×1
  • workflow_call_compatibility._get_placeholder_for_annotation (cognitive 21) invokeai/app/services/shared/workflow_call_compatibility.py:56 — workflow_call_compatibility._get_placeholder_for_annotation has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DiskVideoFileStorage.__recover_staged_deletes (cognitive 21) · ×1
  • DiskVideoFileStorage.__recover_staged_deletes (cognitive 21) invokeai/app/services/video_files/video_files_disk.py:406 — DiskVideoFileStorage.__recover_staged_deletes has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (11 pts), error handling 2 (6 pts), loops 2 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkingMemoryCalibrationService._attempt_blocks (cognitive 21) · ×1
  • WorkingMemoryCalibrationService._attempt_blocks (cognitive 21) invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py:962 — WorkingMemoryCalibrationService._attempt_blocks has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 4, loops 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · aac_splice.splice_soundtrack (cognitive 21) · ×1
  • aac_splice.splice_soundtrack (cognitive 21) invokeai/app/util/aac_splice.py:364 — aac_splice.splice_soundtrack has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 6, error handling 1, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · h264_splice.read_h264_layout (cognitive 21) · ×1
  • h264_splice.read_h264_layout (cognitive 21) invokeai/app/util/h264_splice.py:124 — h264_splice.read_h264_layout has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 3, ternaries 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · video_thumbnails.extract_representative_video_frame (cognitive 21) · ×1
  • video_thumbnails.extract_representative_video_frame (cognitive 21) invokeai/app/util/video_thumbnails.py:548 — video_thumbnails.extract_representative_video_frame has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 2, error handling 1, loops 1, ternaries 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LLLiteModuleDiT.forward (cognitive 21) · ×1
  • LLLiteModuleDiT.forward (cognitive 21) invokeai/backend/anima/control_net_lllite.py:287 — LLLiteModuleDiT.forward has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 3 (6 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Krea2MemoryEfficientAttnProcessor.__call__ (cognitive 21) · ×1
  • Krea2MemoryEfficientAttnProcessor.__call__ (cognitive 21) invokeai/backend/krea2/attention.py:127 — Krea2MemoryEfficientAttnProcessor.__call__ has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (14 pts), ternaries 3 (4 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelConfigFactory.from_model_on_disk (cognitive 21) · ×1
  • ModelConfigFactory.from_model_on_disk (cognitive 21) invokeai/backend/model_manager/configs/factory.py:935 — ModelConfigFactory.from_model_on_disk has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (10 pts), error handling 4 (8 pts), boolean chains 1, loops 1, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelCache._log_cache_state (cognitive 21) · ×1
  • ModelCache._log_cache_state (cognitive 21) invokeai/backend/model_manager/load/model_cache/model_cache.py:2694 — ModelCache._log_cache_state has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 6 (12 pts), if/else 4, boolean chains 3, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelCache._reconcile_budget_if_pending (cognitive 21) · ×1
  • ModelCache._reconcile_budget_if_pending (cognitive 21) invokeai/backend/model_manager/load/model_cache/model_cache.py:2954 — ModelCache._reconcile_budget_if_pending has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FluxSDNQDiffusersModel._convert_diffusers_sd_to_bfl (cognitive 21) · ×1
  • FluxSDNQDiffusersModel._convert_diffusers_sd_to_bfl (cognitive 21) invokeai/backend/model_manager/load/model_loaders/flux.py:2134 — FluxSDNQDiffusersModel._convert_diffusers_sd_to_bfl has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 6 (8 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · flux2_state_dict_utils._convert_flux2_weight_keys (cognitive 21) · ×1
  • flux2_state_dict_utils._convert_flux2_weight_keys (cognitive 21) invokeai/backend/model_manager/load/model_loaders/flux2_state_dict_utils.py:158 — flux2_state_dict_utils._convert_flux2_weight_keys has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ZImageCheckpointModel._load_from_singlefile (cognitive 21) · ×1
  • ZImageCheckpointModel._load_from_singlefile (cognitive 21) invokeai/backend/model_manager/load/model_loaders/z_image.py:482 — ZImageCheckpointModel._load_from_singlefile has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 3, ternaries 1 (2 pts), loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · int8_convrot.reject_unmarked_int8_weights (cognitive 21) · ×1
  • int8_convrot.reject_unmarked_int8_weights (cognitive 21) invokeai/backend/quantization/int8_convrot.py:736 — int8_convrot.reject_unmarked_int8_weights has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 7, if/else 5 (7 pts), ternaries 4 (6 pts), loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · calibrate_qwen_vae_working_memory.run_grid (cognitive 21) · ×1
  • calibrate_qwen_vae_working_memory.run_grid (cognitive 21) scripts/calibrate_qwen_vae_working_memory.py:202 — calibrate_qwen_vae_working_memory.run_grid has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 4 (6 pts), error handling 1 (3 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · check_platform_locks.has_wheel (cognitive 21) · ×1
  • check_platform_locks.has_wheel (cognitive 21) scripts/check_platform_locks.py:141 — check_platform_locks.has_wheel has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (13 pts), boolean chains 3, loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · wanComponentSync.getWanComponentUpdates (cognitive 21) · ×1
  • wanComponentSync.getWanComponentUpdates (cognitive 21) invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/wanComponentSync.ts:59 — wanComponentSync.getWanComponentUpdates has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · workflowHasImageField.workflowHasImageField (cognitive 21) · ×1
  • workflowHasImageField.workflowHasImageField (cognitive 21) invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/workflowHasImageField.tsx:20 — workflowHasImageField.workflowHasImageField has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RasterLayerCurvesAdjustmentsGraph.RasterLayerCurvesAdjustmentsGraph (cognitive 21) · ×1
  • RasterLayerCurvesAdjustmentsGraph.RasterLayerCurvesAdjustmentsGraph (cognitive 21) invokeai/frontend/webv1/src/features/controlLayers/components/RasterLayer/RasterLayerCurvesAdjustmentsGraph.tsx:240 — RasterLayerCurvesAdjustmentsGraph.RasterLayerCurvesAdjustmentsGraph has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11, error handling 3 (5 pts), boolean chains 4, ternaries 1 (nesting depth added 2). None of this is in the body itself: all 21 points belong to 9 function literals inside it that branch (lines 260, 306, 335, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Editor.exportImage (cognitive 21) · ×1
  • Editor.exportImage (cognitive 21) invokeai/frontend/webv1/src/features/cropper/lib/editor.ts:1138 — Editor.exportImage has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (16 pts), error handling 3 (5 pts) (nesting depth added 6). None of this is in the body itself: all 21 points belong to 2 function literals inside it that branch (lines 1143, 1215). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · getFirstValidConnection.getSourceCandidateFields (cognitive 21) · ×1
  • getFirstValidConnection.getSourceCandidateFields (cognitive 21) invokeai/frontend/webv1/src/features/nodes/store/util/getFirstValidConnection.ts:156 — getFirstValidConnection.getSourceCandidateFields has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 3 (6 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · QueueItemDetail.QueueItemComponent (cognitive 21) · ×1
  • QueueItemDetail.QueueItemComponent (cognitive 21) invokeai/frontend/webv1/src/features/queue/components/QueueList/QueueItemDetail.tsx:24 — QueueItemDetail.QueueItemComponent has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 11, ternaries 4 (7 pts), if/else 3 (nesting depth added 3). Of this number, 11 points are the body's own statements and 10 belong to 3 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · QueueItemComponent.QueueItemComponent (cognitive 21) · ×1
  • QueueItemComponent.QueueItemComponent (cognitive 21) invokeai/frontend/webv1/src/features/queue/components/QueueList/QueueItemComponent.tsx:34 — QueueItemComponent.QueueItemComponent has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9, boolean chains 8, ternaries 4. Most of this is not in the body itself: 10 of the 21 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 53, 109, 40, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · useGalleryGridSelection.useGalleryGridSelection.selectItemRange (cognitive 21) · ×1
  • useGalleryGridSelection.useGalleryGridSelection.selectItemRange (cognitive 21) invokeai/frontend/webv2/src/features/gallery/ui/useGalleryGridSelection.ts:98 — useGalleryGridSelection.useGalleryGridSelection.selectItemRange has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 5, error handling 1 (nesting depth added 1). Of this number, 13 points are the body's own statements and 8 belong to 4 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · addControlLayers.addControlLayers (cognitive 21) · ×1
  • addControlLayers.addControlLayers (cognitive 21) invokeai/frontend/webv2/src/features/generation/core/canvas/addControlLayers.ts:161 — addControlLayers.addControlLayers has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 2 (7 pts), boolean chains 1, loops 1 (nesting depth added 7). Of this number, 19 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · promptFocus.getActiveTriggerQuery (cognitive 21) · ×1
  • promptFocus.getActiveTriggerQuery (cognitive 21) invokeai/frontend/webv2/src/features/generation/ui/promptFields/promptFocus.ts:170 — promptFocus.getActiveTriggerQuery has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 2 (6 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.
D2 · Cognitive Complexity · ConceptRow.ConceptRowContent (cognitive 21) · ×1
  • ConceptRow.ConceptRowContent (cognitive 21) invokeai/frontend/webv2/src/features/generation/ui/shared/ConceptRow.tsx:170 — ConceptRow.ConceptRowContent has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 14 (17 pts), boolean chains 3, if/else 1 (nesting depth added 3). Of this number, 18 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · referenceImage.resolveRatioDrag (cognitive 21) · ×1
  • referenceImage.resolveRatioDrag (cognitive 21) invokeai/frontend/webv2/src/features/generation/core/referenceImage.ts:361 — referenceImage.resolveRatioDrag has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 10 (13 pts), boolean chains 4, if/else 4 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · attention.unifyEqualWeights (cognitive 21) · ×1
  • attention.unifyEqualWeights (cognitive 21) invokeai/frontend/webv2/src/features/generation/core/prompt/attention.ts:169 — attention.unifyEqualWeights has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 3 (6 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · fields.isWorkflowFieldValueValid (cognitive 21) · ×1
  • fields.isWorkflowFieldValueValid (cognitive 21) invokeai/frontend/webv2/src/features/workflow/core/fields.ts:384 — fields.isWorkflowFieldValueValid has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 14, if/else 4 (6 pts), match/switch 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · NodeFieldControl.NodeFieldControl (cognitive 21) · ×1
  • NodeFieldControl.NodeFieldControl (cognitive 21) invokeai/frontend/webv2/src/features/workflow/ui/linear/NodeFieldControl.tsx:57 — NodeFieldControl.NodeFieldControl has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 10 (13 pts), boolean chains 6, if/else 2 (nesting depth added 3). Of this number, 18 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · WorkflowFieldInput.WorkflowFieldSnapshot (cognitive 21) · ×1
  • WorkflowFieldInput.WorkflowFieldSnapshot (cognitive 21) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:2112 — WorkflowFieldInput.WorkflowFieldSnapshot has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 5 (11 pts), if/else 5 (6 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · normalize.normalizeValue (cognitive 21) · ×1
  • normalize.normalizeValue (cognitive 21) invokeai/frontend/webv2/src/platform/logging/normalize.ts:123 — normalize.normalizeValue has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (12 pts), ternaries 3 (6 pts), boolean chains 2, match/switch 1 (nesting depth added 4). Of this number, 18 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · http.getApiErrorMessage (cognitive 21) · ×1
  • http.getApiErrorMessage (cognitive 21) invokeai/frontend/webv2/src/platform/transport/http.ts:264 — http.getApiErrorMessage has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 5, error handling 1 (2 pts), ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ManagerQueue.ManagerQueueFooter (cognitive 21) · ×1
  • ManagerQueue.ManagerQueueFooter (cognitive 21) invokeai/frontend/webv2/src/platform/ui/ManagerQueue.tsx:92 — ManagerQueue.ManagerQueueFooter has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 12 (19 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · persistenceRuntime.createWorkbenchPersistenceRuntime.load (cognitive 21) · ×1
  • persistenceRuntime.createWorkbenchPersistenceRuntime.load (cognitive 21) invokeai/frontend/webv2/src/workbench/persistenceRuntime.ts:562 — persistenceRuntime.createWorkbenchPersistenceRuntime.load has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 6, error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · canvasProjectMutations.applyLayerStackMutation (cognitive 21) · ×1
  • canvasProjectMutations.applyLayerStackMutation (cognitive 21) invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts:457 — canvasProjectMutations.applyLayerStackMutation has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5, loops 2 (3 pts), ternaries 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · invocationSubmit.submitResolvedInvocation (cognitive 21) · ×1
  • invocationSubmit.submitResolvedInvocation (cognitive 21) invokeai/frontend/webv2/src/workbench/invocationSubmit.ts:209 — invocationSubmit.submitResolvedInvocation has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 4 (7 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SelectionImageController.replace (cognitive 21) · ×1
  • SelectionImageController.replace (cognitive 21) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/selectionImageController.ts:30 — SelectionImageController.replace has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 4, ternaries 2 (4 pts), error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · bitmapStore.createBitmapStore.uploadWithRetry (cognitive 21) · ×1
  • bitmapStore.createBitmapStore.uploadWithRetry (cognitive 21) invokeai/frontend/webv2/src/workbench/canvas-engine/document/bitmapStore.ts:285 — bitmapStore.createBitmapStore.uploadWithRetry has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (18 pts), error handling 1 (2 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · alphaBounds.alphaBounds (cognitive 21) · ×1
  • alphaBounds.alphaBounds (cognitive 21) invokeai/frontend/webv2/src/workbench/canvas-engine/render/alphaBounds.ts:47 — alphaBounds.alphaBounds has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 3 (5 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HotkeysSettingsSection.HotkeyListRow (cognitive 21) · ×1
  • HotkeysSettingsSection.HotkeyListRow (cognitive 21) invokeai/frontend/webv2/src/workbench/settings/HotkeysSettingsSection.tsx:299 — HotkeysSettingsSection.HotkeyListRow has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 10 (16 pts), boolean chains 4, if/else 1 (nesting depth added 6). Of this number, 19 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ImageMapVocabularySettings.ImageMapVocabularySettings (cognitive 21) · ×1
  • ImageMapVocabularySettings.ImageMapVocabularySettings (cognitive 21) invokeai/frontend/webv2/src/workbench/settings/ImageMapVocabularySettings.tsx:46 — ImageMapVocabularySettings.ImageMapVocabularySettings has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 6 (8 pts), boolean chains 1 (nesting depth added 4). Most of this is not in the body itself: 8 of the 21 points are its own statements and the rest belongs to 6 function items inside it that branch (addTerms, a function literal at line 52, a function literal at line 62, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · ClusterStrengthField.ClusterStrengthField (cognitive 21) · ×1
  • ClusterStrengthField.ClusterStrengthField (cognitive 21) invokeai/frontend/webv2/src/workbench/widgets/image-map/ClusterStrengthField.tsx:40 — ClusterStrengthField.ClusterStrengthField has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10, ternaries 9, boolean chains 2. Most of this is not in the body itself: 9 of the 21 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 144, 72, 115, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · SocketIO._handle_user_access_changed (cognitive 20) · ×1
  • SocketIO._handle_user_access_changed (cognitive 20) invokeai/app/api/sockets.py:720 — SocketIO._handle_user_access_changed has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (18 pts), error handling 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InvokeImageBlendInvocation.image_convert_with_xform (cognitive 20) · ×1
  • InvokeImageBlendInvocation.image_convert_with_xform (cognitive 20) invokeai/app/invocations/composition-nodes.py:449 — InvokeImageBlendInvocation.image_convert_with_xform has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 9 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SDXLLoRACollectionLoader.invoke (cognitive 20) · ×1
  • SDXLLoRACollectionLoader.invoke (cognitive 20) invokeai/app/invocations/model.py:690 — SDXLLoRACollectionLoader.invoke has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ImageIndexService._process_batch (cognitive 20) · ×1
  • ImageIndexService._process_batch (cognitive 20) invokeai/app/services/image_index/image_index_default.py:1388 — ImageIndexService._process_batch has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), error handling 3 (4 pts), loops 2, boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · workflow_call_compatibility._build_compatibility_workflow_inputs (cognitive 20) · ×1
  • workflow_call_compatibility._build_compatibility_workflow_inputs (cognitive 20) invokeai/app/services/shared/workflow_call_compatibility.py:89 — workflow_call_compatibility._build_compatibility_workflow_inputs has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · working_memory_calibration_store._os_lock (cognitive 20) · ×1
  • working_memory_calibration_store._os_lock (cognitive 20) invokeai/app/services/working_memory_calibration/working_memory_calibration_store.py:79 — working_memory_calibration_store._os_lock has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (10 pts), error handling 2 (6 pts), loops 2 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · denoise_working_memory._sidecar_residual_bytes (cognitive 20) · ×1
  • denoise_working_memory._sidecar_residual_bytes (cognitive 20) invokeai/backend/krea2/denoise_working_memory.py:302 — denoise_working_memory._sidecar_residual_bytes has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (9 pts), error handling 1 (3 pts), loops 2 (3 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · style_reference.parse_block_spec (cognitive 20) · ×1
  • style_reference.parse_block_spec (cognitive 20) invokeai/backend/krea2/style_reference.py:123 — style_reference.parse_block_spec has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 2 (6 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · denoise.build_denoise_state (cognitive 20) · ×1
  • denoise.build_denoise_state (cognitive 20) invokeai/backend/ltx2/denoise.py:278 — denoise.build_denoise_state has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 4, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · reference_conditioning.normalize_reference_video_frames_streaming (cognitive 20) · ×1
  • reference_conditioning.normalize_reference_video_frames_streaming (cognitive 20) invokeai/backend/minimax_h3/reference_conditioning.py:164 — reference_conditioning.normalize_reference_video_frames_streaming has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · qwen3_vl_encoder._has_complete_pretrained_weights (cognitive 20) · ×1
  • qwen3_vl_encoder._has_complete_pretrained_weights (cognitive 20) invokeai/backend/model_manager/configs/qwen3_vl_encoder.py:56 — qwen3_vl_encoder._has_complete_pretrained_weights has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelLoader._load_and_cache (cognitive 20) · ×1
  • ModelLoader._load_and_cache (cognitive 20) invokeai/backend/model_manager/load/load_default.py:355 — ModelLoader._load_and_cache has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 3 (5 pts), boolean chains 3, error handling 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelCache._make_room_internal (cognitive 20) · ×1
  • ModelCache._make_room_internal (cognitive 20) invokeai/backend/model_manager/load/model_cache/model_cache.py:2779 — ModelCache._make_room_internal has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 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.
D2 · Cognitive Complexity · flux2_state_dict_utils._convert_flux2_double_block_key (cognitive 20) · ×1
  • flux2_state_dict_utils._convert_flux2_double_block_key (cognitive 20) invokeai/backend/model_manager/load/model_loaders/flux2_state_dict_utils.py:61 — flux2_state_dict_utils._convert_flux2_double_block_key has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HuggingFaceMetadataFetch.from_id (cognitive 20) · ×1
  • HuggingFaceMetadataFetch.from_id (cognitive 20) invokeai/backend/model_manager/metadata/fetch/huggingface.py:121 — HuggingFaceMetadataFetch.from_id has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (6 pts), ternaries 3 (5 pts), boolean chains 4, error handling 2 (4 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · krea2_lora_conversion_utils.lora_model_from_krea2_state_dict (cognitive 20) · ×1
  • krea2_lora_conversion_utils.lora_model_from_krea2_state_dict (cognitive 20) invokeai/backend/patches/lora_conversions/krea2_lora_conversion_utils.py:184 — krea2_lora_conversion_utils.lora_model_from_krea2_state_dict has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 3 (6 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sdxl_lora_conversion_utils._make_sdxl_unet_conversion_map (cognitive 20) · ×1
  • sdxl_lora_conversion_utils._make_sdxl_unet_conversion_map (cognitive 20) invokeai/backend/patches/lora_conversions/sdxl_lora_conversion_utils.py:67 — sdxl_lora_conversion_utils._make_sdxl_unet_conversion_map has cognitive complexity 20 (threshold 15). Drivers by points: loops 8 (12 pts), if/else 4 (8 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.
D2 · Cognitive Complexity · fp8_scaled.extract_fp8_scaled_layers (cognitive 20) · ×1
  • fp8_scaled.extract_fp8_scaled_layers (cognitive 20) invokeai/backend/quantization/fp8_scaled.py:581 — fp8_scaled.extract_fp8_scaled_layers has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, loops 3, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · attention._report_unpinned_call (cognitive 20) · ×1
  • attention._report_unpinned_call (cognitive 20) invokeai/backend/util/attention.py:764 — attention._report_unpinned_call has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 5, ternaries 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · bounds.line_bounds (cognitive 20) · ×1
  • bounds.line_bounds (cognitive 20) invokeai/backend/working_memory/bounds.py:332 — bounds.line_bounds has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 5, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TranslationCleaner._search_codebase (cognitive 20) · ×1
  • TranslationCleaner._search_codebase (cognitive 20) invokeai/frontend/webv1/scripts/clean_translations.py:36 — TranslationCleaner._search_codebase has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · calibrate_wan_vae_working_memory._measure (cognitive 20) · ×1
  • calibrate_wan_vae_working_memory._measure (cognitive 20) scripts/calibrate_wan_vae_working_memory.py:91 — calibrate_wan_vae_working_memory._measure has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 5, loops 1 (2 pts), ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · generate_docs_json._parse_docstring (cognitive 20) · ×1
  • generate_docs_json._parse_docstring (cognitive 20) scripts/generate_docs_json.py:242 — generate_docs_json._parse_docstring has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 2, boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CanvasEntityGroupList.CanvasEntityGroupList (cognitive 20) · ×1
  • CanvasEntityGroupList.CanvasEntityGroupList (cognitive 20) invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/CanvasEntityGroupList.tsx:31 — CanvasEntityGroupList.CanvasEntityGroupList has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10, ternaries 5 (7 pts), boolean chains 3 (nesting depth added 2). Most of this is not in the body itself: 8 of the 20 points are its own statements and the rest belongs to one function literal inside it that branches (line 37). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · CanvasCompositorModule.getGrayscaleMaskCompositeImageDTO (cognitive 20) · ×1
  • CanvasCompositorModule.getGrayscaleMaskCompositeImageDTO (cognitive 20) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasCompositorModule.ts:501 — CanvasCompositorModule.getGrayscaleMaskCompositeImageDTO has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (3 pts), ternaries 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CanvasBrushToolModule.onStagePointerDown (cognitive 20) · ×1
  • CanvasBrushToolModule.onStagePointerDown (cognitive 20) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasBrushToolModule.ts:259 — CanvasBrushToolModule.onStagePointerDown has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 6, ternaries 2 (4 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LoRASelect.LoRASelect (cognitive 20) · ×1
  • LoRASelect.LoRASelect (cognitive 20) invokeai/frontend/webv1/src/features/lora/components/LoRASelect.tsx:19 — LoRASelect.LoRASelect has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8, ternaries 4 (8 pts), boolean chains 4 (nesting depth added 4). Most of this is not in the body itself: 1 of the 20 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 33, 88, 29, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · validateConnectionTypes.validateConnectionTypes (cognitive 20) · ×1
  • validateConnectionTypes.validateConnectionTypes (cognitive 20) invokeai/frontend/webv1/src/features/nodes/store/util/validateConnectionTypes.ts:10 — validateConnectionTypes.validateConnectionTypes has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 18, if/else 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · buildExternalGraph.buildExternalGraph (cognitive 20) · ×1
  • buildExternalGraph.buildExternalGraph (cognitive 20) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildExternalGraph.ts:33 — buildExternalGraph.buildExternalGraph has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (19 pts), ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · buildKrea2Graph.buildKrea2Graph (cognitive 20) · ×1
  • buildKrea2Graph.buildKrea2Graph (cognitive 20) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildKrea2Graph.ts:29 — buildKrea2Graph.buildKrea2Graph has cognitive complexity 20 (threshold 15). Drivers by points: if/else 16, boolean chains 4. Of this number, 16 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · readiness.getReasonsWhyCannotEnqueueUpscaleTab (cognitive 20) · ×1
  • readiness.getReasonsWhyCannotEnqueueUpscaleTab (cognitive 20) invokeai/frontend/webv1/src/features/queue/store/readiness.ts:726 — readiness.getReasonsWhyCannotEnqueueUpscaleTab has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SettingsGenerationDevices.SettingsGenerationDevices (cognitive 20) · ×1
  • SettingsGenerationDevices.SettingsGenerationDevices (cognitive 20) invokeai/frontend/webv1/src/features/system/components/SettingsModal/SettingsGenerationDevices.tsx:39 — SettingsGenerationDevices.SettingsGenerationDevices has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (7 pts), ternaries 5 (6 pts), boolean chains 3, loops 3, error handling 1 (nesting depth added 2). Most of this is not in the body itself: 4 of the 20 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 79, 114, 128, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · SettingsImageStorageMaintenance.SettingsImageStorageMaintenance (cognitive 20) · ×1
  • SettingsImageStorageMaintenance.SettingsImageStorageMaintenance (cognitive 20) invokeai/frontend/webv1/src/features/system/components/SettingsModal/SettingsImageStorageMaintenance.tsx:48 — SettingsImageStorageMaintenance.SettingsImageStorageMaintenance has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 9, if/else 7, error handling 2, ternaries 2. Most of this is not in the body itself: 9 of the 20 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 92, 70, 66, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · images.bulkDownloadQueryFn (cognitive 20) · ×1
  • images.bulkDownloadQueryFn (cognitive 20) invokeai/frontend/webv1/src/services/api/endpoints/images.ts:502 — images.bulkDownloadQueryFn has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReferenceImageControls.IPAdapterControls (cognitive 20) · ×1
  • ReferenceImageControls.IPAdapterControls (cognitive 20) invokeai/frontend/webv2/src/features/generation/ui/reference-images/ReferenceImageControls.tsx:116 — ReferenceImageControls.IPAdapterControls has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 8 (9 pts), if/else 6, boolean chains 5 (nesting depth added 1). Most of this is not in the body itself: 6 of the 20 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 167, 153, 183, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · graph.buildSDGraph (cognitive 20) · ×1
  • graph.buildSDGraph (cognitive 20) invokeai/frontend/webv2/src/features/generation/core/graph.ts:323 — graph.buildSDGraph has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 11 (12 pts), if/else 6, boolean chains 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · GenerateConditioningRebalanceField.GenerateConditioningRebalanceField (cognitive 20) · ×1
  • GenerateConditioningRebalanceField.GenerateConditioningRebalanceField (cognitive 20) invokeai/frontend/webv2/src/features/generation/ui/GenerateConditioningRebalanceField.tsx:61 — GenerateConditioningRebalanceField.GenerateConditioningRebalanceField has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 10 (13 pts), boolean chains 4, if/else 3 (nesting depth added 3). Of this number, 14 points are the body's own statements and 6 belong to 6 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · GenerateRenderSection.GenerateRenderSection · ×1
  • GenerateRenderSection.GenerateRenderSection::renderFields (cognitive 20) invokeai/frontend/webv2/src/features/generation/ui/GenerateRenderSection.tsx:637 — GenerateRenderSection.GenerateRenderSection::renderFields has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 16 (17 pts), boolean chains 3 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · RelatedModelsSection.RelatedModelsForModel (cognitive 20) · ×1
  • RelatedModelsSection.RelatedModelsForModel (cognitive 20) invokeai/frontend/webv2/src/features/models/ui/detail/RelatedModelsSection.tsx:35 — RelatedModelsSection.RelatedModelsForModel has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 5 (8 pts), boolean chains 2, error handling 2 (nesting depth added 5). Most of this is not in the body itself: 5 of the 20 points are its own statements and the rest belongs to 4 function items inside it that branch (handleAdd, handleRemove, a function literal at line 45, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · modelDraftsStore.syncWithLibrary (cognitive 20) · ×1
  • modelDraftsStore.syncWithLibrary (cognitive 20) invokeai/frontend/webv2/src/features/models/ui/modelDraftsStore.ts:202 — modelDraftsStore.syncWithLibrary has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VideoModelField.VideoModelField (cognitive 20) · ×1
  • VideoModelField.VideoModelField (cognitive 20) invokeai/frontend/webv2/src/features/video/ui/VideoModelField.tsx:68 — VideoModelField.VideoModelField has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 9 (12 pts), if/else 6, boolean chains 2 (nesting depth added 3). Of this number, 12 points are the body's own statements and 8 belong to 4 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · flowAdapters.toFlowNodes (cognitive 20) · ×1
  • flowAdapters.toFlowNodes (cognitive 20) invokeai/frontend/webv2/src/features/workflow/ui/editor/flowAdapters.ts:204 — flowAdapters.toFlowNodes has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 3 (6 pts), boolean chains 4 (nesting depth added 6). None of this is in the body itself: all 20 points belong to one function literal inside it that branches (line 219). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · api.settleProjectCreate (cognitive 20) · ×1
  • api.settleProjectCreate (cognitive 20) invokeai/frontend/webv2/src/workbench/projects/api.ts:437 — api.settleProjectCreate has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (9 pts), error handling 4 (5 pts), boolean chains 3, ternaries 2 (3 pts) (nesting depth added 5). Of this number, 10 points are the body's own statements and 10 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · assetTransport.createAssetResponseReader.<returned closure> (cognitive 20) · ×1
  • assetTransport.createAssetResponseReader.<returned closure> (cognitive 20) invokeai/frontend/webv2/src/workbench/projects/invk/assetTransport.ts:140 — assetTransport.createAssetResponseReader.<returned closure> has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 2, error handling 2, loops 1 (nesting depth added 5). Of this number, 19 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · projectHalves.findRepeatedWorkflowItem (cognitive 20) · ×1
  • projectHalves.findRepeatedWorkflowItem (cognitive 20) invokeai/frontend/webv2/src/workbench/projects/projectHalves.ts:135 — projectHalves.findRepeatedWorkflowItem has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 5 (12 pts), if/else 2 (4 pts), boolean chains 3, loops 1 (nesting depth added 9). Of this number, 15 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · runLayerWorkflow.runLayerWorkflow (cognitive 20) · ×1
  • runLayerWorkflow.runLayerWorkflow (cognitive 20) invokeai/frontend/webv2/src/workbench/widgets/layers/runLayerWorkflow.ts:119 — runLayerWorkflow.runLayerWorkflow has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15 (16 pts), error handling 2 (3 pts), boolean chains 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · TransformPane.ConnectedTransform (cognitive 20) · ×1
  • TransformPane.ConnectedTransform (cognitive 20) invokeai/frontend/webv2/src/workbench/widgets/layers/panes/TransformPane.tsx:56 — TransformPane.ConnectedTransform has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 11, boolean chains 6, if/else 3. Of this number, 13 points are the body's own statements and 7 belong to 3 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · shapeRasterizer.buildParametricShapePath (cognitive 20) · ×1
  • shapeRasterizer.buildParametricShapePath (cognitive 20) invokeai/frontend/webv2/src/workbench/canvas-engine/render/rasterizers/shapeRasterizer.ts:22 — shapeRasterizer.buildParametricShapePath has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 3 (7 pts), loops 1 (2 pts) (nesting depth added 8). Of this number, 17 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · workbenchStore.recordDiagnosticForAction (cognitive 20) · ×1
  • workbenchStore.recordDiagnosticForAction (cognitive 20) invokeai/frontend/webv2/src/workbench/workbenchStore.ts:786 — workbenchStore.recordDiagnosticForAction has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 5 (11 pts), if/else 4 (8 pts), match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · PixelEditController.begin (cognitive 20) · ×1
  • PixelEditController.begin (cognitive 20) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/controlPixelController.ts:130 — PixelEditController.begin has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 9, if/else 6, ternaries 4 (5 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · TransformEditingController.apply (cognitive 20) · ×1
  • TransformEditingController.apply (cognitive 20) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/transformEditingController.ts:267 — TransformEditingController.apply has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8, boolean chains 7, ternaries 5. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · MaskLayerController.invert (cognitive 20) · ×1
  • MaskLayerController.invert (cognitive 20) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/maskLayerController.ts:98 — MaskLayerController.invert has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11, ternaries 5 (6 pts), boolean chains 2, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · StructuralLayerController.beginPreview (cognitive 20) · ×1
  • StructuralLayerController.beginPreview (cognitive 20) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/structuralLayerController.ts:191 — StructuralLayerController.beginPreview has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11, boolean chains 6, ternaries 3. Most of this is not in the body itself: 1 of the 20 points is its own statement and the rest belongs to 7 function items inside it that branch (a function literal at line 225, a function literal at line 257, flushPending, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · StagedResultController.commit (cognitive 20) · ×1
  • StagedResultController.commit (cognitive 20) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/stagedResultController.ts:78 — StagedResultController.commit has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 7, if/else 7, ternaries 5, error handling 1. Of this number, 13 points are the body's own statements and 7 belong to 6 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · engine.createCanvasEngine · ×1
  • engine.createCanvasEngine::getDuplicateRasterPlan (cognitive 20) invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts:2325 — engine.createCanvasEngine::getDuplicateRasterPlan has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 8, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · resolve.getScopePriority (cognitive 20) · ×1
  • resolve.getScopePriority (cognitive 20) invokeai/frontend/webv2/src/workbench/hotkeys/resolve.ts:18 — resolve.getScopePriority has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 4 (9 pts), if/else 5 (6 pts), boolean chains 5 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · executeImageRecall.executeImageRecall (cognitive 20) · ×1
  • executeImageRecall.executeImageRecall (cognitive 20) invokeai/frontend/webv2/src/workbench/image-actions/executeImageRecall.ts:273 — executeImageRecall.executeImageRecall has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 5, boolean chains 2, error handling 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ProjectsBrowser.ProjectsBrowser (cognitive 20) · ×1
  • ProjectsBrowser.ProjectsBrowser (cognitive 20) invokeai/frontend/webv2/src/workbench/launchpad/projects/ProjectsBrowser.tsx:71 — ProjectsBrowser.ProjectsBrowser has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 8 (12 pts), if/else 2 (5 pts), boolean chains 3 (nesting depth added 7). Of this number, 13 points are the body's own statements and 7 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · entries.buildProviderSectionRows (cognitive 20) · ×1
  • entries.buildProviderSectionRows (cognitive 20) invokeai/frontend/webv2/src/workbench/palette/entries.ts:697 — entries.buildProviderSectionRows has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 3 (7 pts), if/else 3 (6 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · importProject.readInvkArchive (cognitive 20) · ×1
  • importProject.readInvkArchive (cognitive 20) invokeai/frontend/webv2/src/workbench/projects/invk/importProject.ts:104 — importProject.readInvkArchive has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 4, loops 2 (3 pts), boolean chains 1, error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · unloadJournal.scenarios.createUnloadJournalServer (cognitive 20) · ×1
  • unloadJournal.scenarios.createUnloadJournalServer (cognitive 20) invokeai/frontend/webv2/src/workbench/projects/unloadJournal.scenarios.ts:25 — unloadJournal.scenarios.createUnloadJournalServer has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (12 pts), ternaries 6, boolean chains 2 (nesting depth added 1). None of this is in the body itself: all 20 points belong to 6 function items inside it that branch (a function literal at line 124, a function literal at line 50, a function literal at line 97, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · SettingsEntryView.SettingsEntryView (cognitive 20) · ×1
  • SettingsEntryView.SettingsEntryView (cognitive 20) invokeai/frontend/webv2/src/workbench/settings/SettingsEntryView.tsx:96 — SettingsEntryView.SettingsEntryView has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 10 (13 pts), boolean chains 7 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · QueueCluster.QueueCluster (cognitive 20) · ×1
  • QueueCluster.QueueCluster (cognitive 20) invokeai/frontend/webv2/src/workbench/shell/topbar/QueueCluster.tsx:54 — QueueCluster.QueueCluster has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 8 (11 pts), boolean chains 5, if/else 3 (4 pts) (nesting depth added 4). Of this number, 18 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · custom_nodes._import_workflows_from_pack (cognitive 19) · ×1
  • custom_nodes._import_workflows_from_pack (cognitive 19) invokeai/app/api/routers/custom_nodes.py:460 — custom_nodes._import_workflows_from_pack has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 1 (3 pts), error handling 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · recall_parameters._assert_recall_image_access (cognitive 19) · ×1
  • recall_parameters._assert_recall_image_access (cognitive 19) invokeai/app/api/routers/recall_parameters.py:349 — recall_parameters._assert_recall_image_access has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 4 (7 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utilities.list_user_fonts (cognitive 19) · ×1
  • utilities.list_user_fonts (cognitive 19) invokeai/app/api/routers/utilities.py:281 — utilities.list_user_fonts has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · workflows.list_workflows (cognitive 19) · ×1
  • workflows.list_workflows (cognitive 19) invokeai/app/api/routers/workflows.py:245 — workflows.list_workflows has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 4, ternaries 2 (3 pts), error handling 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SlidingWindowTokenMiddleware.dispatch (cognitive 19) · ×1
  • SlidingWindowTokenMiddleware.dispatch (cognitive 19) invokeai/app/api_app.py:163 — SlidingWindowTokenMiddleware.dispatch has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (15 pts), error handling 1 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · WanLoRACollectionLoader.invoke (cognitive 19) · ×1
  • WanLoRACollectionLoader.invoke (cognitive 19) invokeai/app/invocations/wan/wan_lora_loader.py:245 — WanLoRACollectionLoader.invoke has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AlibabaCloudProvider._parse_sync_response (cognitive 19) · ×1
  • AlibabaCloudProvider._parse_sync_response (cognitive 19) invokeai/app/services/external_generation/providers/alibabacloud.py:213 — AlibabaCloudProvider._parse_sync_response has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ImageIndexService._process_projection (cognitive 19) · ×1
  • ImageIndexService._process_projection (cognitive 19) invokeai/app/services/image_index/image_index_default.py:1611 — ImageIndexService._process_projection has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6, error handling 5, ternaries 3 (5 pts), boolean chains 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · WorkflowCallQueueLifecycle.apply_execution_effects (cognitive 19) · ×1
  • WorkflowCallQueueLifecycle.apply_execution_effects (cognitive 19) invokeai/app/services/session_processor/workflow_call_runtime.py:150 — WorkflowCallQueueLifecycle.apply_execution_effects has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ContinuationRecord.transition (cognitive 19) · ×1
  • ContinuationRecord.transition (cognitive 19) invokeai/app/services/shared/execution_engine/primitives.py:470 — ContinuationRecord.transition has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GraphExecutionState._update_prepared_for_index (cognitive 19) · ×1
  • GraphExecutionState._update_prepared_for_index (cognitive 19) invokeai/app/services/shared/graph.py:3331 — GraphExecutionState._update_prepared_for_index has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · users_common.validate_email_with_special_domains (cognitive 19) · ×1
  • users_common.validate_email_with_special_domains (cognitive 19) invokeai/app/services/users/users_common.py:12 — users_common.validate_email_with_special_domains has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 3, error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Main_SDNQ_Diffusers_Flux2_Config._get_submodels (cognitive 19) · ×1
  • Main_SDNQ_Diffusers_Flux2_Config._get_submodels (cognitive 19) invokeai/backend/model_manager/configs/main.py:4001 — Main_SDNQ_Diffusers_Flux2_Config._get_submodels has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Main_SDNQ_Diffusers_ZImage_Config._get_submodels) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Main_SDNQ_Diffusers_ZImage_Config._get_submodels (cognitive 19) · ×1
  • Main_SDNQ_Diffusers_ZImage_Config._get_submodels (cognitive 19) invokeai/backend/model_manager/configs/main.py:4155 — Main_SDNQ_Diffusers_ZImage_Config._get_submodels has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Main_SDNQ_Diffusers_Flux2_Config._get_submodels) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · qwen3_encoder._has_qwen3_keys (cognitive 19) · ×1
  • qwen3_encoder._has_qwen3_keys (cognitive 19) invokeai/backend/model_manager/configs/qwen3_encoder.py:27 — qwen3_encoder._has_qwen3_keys has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 3 (7 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · layout._compile_draft_item (cognitive 19) · ×1
  • layout._compile_draft_item (cognitive 19) invokeai/backend/moss_image/layout.py:233 — layout._compile_draft_item has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 5, ternaries 1 (2 pts), loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · flux_onetrainer_bfl_lora_conversion_utils.lora_model_from_flux_onetrainer_bfl_state_dict (cognitive 19) · ×1
  • flux_onetrainer_bfl_lora_conversion_utils.lora_model_from_flux_onetrainer_bfl_state_dict (cognitive 19) invokeai/backend/patches/lora_conversions/flux_onetrainer_bfl_lora_conversion_utils.py:95 — flux_onetrainer_bfl_lora_conversion_utils.lora_model_from_flux_onetrainer_bfl_state_dict has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 5 (6 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · krea2_lora_conversion_utils._get_lora_layer_values (cognitive 19) · ×1
  • krea2_lora_conversion_utils._get_lora_layer_values (cognitive 19) invokeai/backend/patches/lora_conversions/krea2_lora_conversion_utils.py:242 — krea2_lora_conversion_utils._get_lora_layer_values has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · z_image_lora_conversion_utils.lora_model_from_z_image_state_dict (cognitive 19) · ×1
  • z_image_lora_conversion_utils.lora_model_from_z_image_state_dict (cognitive 19) invokeai/backend/patches/lora_conversions/z_image_lora_conversion_utils.py:74 — z_image_lora_conversion_utils.lora_model_from_z_image_state_dict has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 3 (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.
D2 · Cognitive Complexity · sidecar_working_memory.lora_sidecar_bytes (cognitive 19) · ×1
  • sidecar_working_memory.lora_sidecar_bytes (cognitive 19) invokeai/backend/patches/sidecar_working_memory.py:57 — sidecar_working_memory.lora_sidecar_bytes has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (4 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UNetAttentionPatcher._prepare_attention_processors (cognitive 19) · ×1
  • UNetAttentionPatcher._prepare_attention_processors (cognitive 19) invokeai/backend/stable_diffusion/diffusion/unet_attention_patcher.py:25 — UNetAttentionPatcher._prepare_attention_processors has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 3 (8 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sage_attention.install_sage_attention (cognitive 19) · ×1
  • sage_attention.install_sage_attention (cognitive 19) invokeai/backend/util/sage_attention.py:280 — sage_attention.install_sage_attention has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 3, error handling 3, loops 1, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · LoginPage.LoginPage (cognitive 19) · ×1
  • LoginPage.LoginPage (cognitive 19) invokeai/frontend/webv1/src/features/auth/components/LoginPage.tsx:25 — LoginPage.LoginPage has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 11, if/else 4, ternaries 2 (3 pts), error handling 1 (nesting depth added 1). Of this number, 11 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · RefImageImage.RefImageImage (cognitive 19) · ×1
  • RefImageImage.RefImageImage (cognitive 19) invokeai/frontend/webv1/src/features/controlLayers/components/RefImage/RefImageImage.tsx:35 — RefImageImage.RefImageImage has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 11, if/else 7, ternaries 1. Most of this is not in the body itself: 6 of the 19 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 82, 59, 106, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · shared.getOutputImageNames (cognitive 19) · ×1
  • shared.getOutputImageNames (cognitive 19) invokeai/frontend/webv1/src/features/controlLayers/components/StagingArea/shared.ts:19 — shared.getOutputImageNames has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (7 pts), ternaries 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · dnd.canMoveFromSourceBoard (cognitive 19) · ×1
  • dnd.canMoveFromSourceBoard (cognitive 19) invokeai/frontend/webv1/src/features/dnd/dnd.ts:513 — dnd.canMoveFromSourceBoard has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · GalleryVideoItem.buildOnClick.<returned closure> (cognitive 19) · ×1
  • GalleryVideoItem.buildOnClick.<returned closure> (cognitive 19) invokeai/frontend/webv1/src/features/gallery/components/ImageGrid/GalleryVideoItem.tsx:44 — GalleryVideoItem.buildOnClick.<returned closure> has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CurrentImagePreview.CurrentImagePreview (cognitive 19) · ×1
  • CurrentImagePreview.CurrentImagePreview (cognitive 19) invokeai/frontend/webv1/src/features/gallery/components/ImageViewer/CurrentImagePreview.tsx:30 — CurrentImagePreview.CurrentImagePreview has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 12, if/else 7. Most of this is not in the body itself: 8 of the 19 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 68, 143, 80). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · MainModelDefaultSettings.MainModelDefaultSettings (cognitive 19) · ×1
  • MainModelDefaultSettings.MainModelDefaultSettings (cognitive 19) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/MainModelDefaultSettings/MainModelDefaultSettings.tsx:50 — MainModelDefaultSettings.MainModelDefaultSettings has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 10, boolean chains 7, if/else 2. Most of this is not in the body itself: 7 of the 19 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 84, 115). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · use-collapsible-gridview-panel.useCollapsibleGridviewPanel (cognitive 19) · ×1
  • use-collapsible-gridview-panel.useCollapsibleGridviewPanel (cognitive 19) invokeai/frontend/webv1/src/features/ui/layouts/use-collapsible-gridview-panel.ts:19 — use-collapsible-gridview-panel.useCollapsibleGridviewPanel has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13, boolean chains 6. None of this is in the body itself: all 19 points belong to 4 function literals inside it that branch (lines 49, 29, 72, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · workflowExecutionState.transitionWorkflowExecutionState (cognitive 19) · ×1
  • workflowExecutionState.transitionWorkflowExecutionState (cognitive 19) invokeai/frontend/webv1/src/services/events/workflowExecutionState.ts:47 — workflowExecutionState.transitionWorkflowExecutionState has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GalleryUiAdapter.GalleryUiAdapterProvider (cognitive 19) · ×1
  • GalleryUiAdapter.GalleryUiAdapterProvider (cognitive 19) invokeai/frontend/webv2/src/app/GalleryUiAdapter.tsx:65 — GalleryUiAdapter.GalleryUiAdapterProvider has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (12 pts), ternaries 5, boolean chains 2 (nesting depth added 1). None of this is in the body itself: all 19 points belong to 8 function literals inside it that branch (lines 161, 112, 129, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · GenerationUiAdapter.getQueueInsights (cognitive 19) · ×1
  • GenerationUiAdapter.getQueueInsights (cognitive 19) invokeai/frontend/webv2/src/app/GenerationUiAdapter.tsx:91 — GenerationUiAdapter.getQueueInsights has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (6 pts), loops 3 (5 pts), boolean chains 4, ternaries 3 (4 pts) (nesting depth added 6). Of this number, 15 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · tsSourceAnalysis.collectTypographyLiterals · ×1
  • tsSourceAnalysis.collectTypographyLiterals::collectValue (cognitive 19) invokeai/frontend/webv2/src/architecture/tsSourceAnalysis.ts:329 — tsSourceAnalysis.collectTypographyLiterals::collectValue has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · generationMeta.extractGenerationMeta (cognitive 19) · ×1
  • generationMeta.extractGenerationMeta (cognitive 19) invokeai/frontend/webv2/src/features/queue/core/generationMeta.ts:19 — generationMeta.extractGenerationMeta has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 6, loops 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · settings.syncUpscaleWidgetValuesWithModels (cognitive 19) · ×1
  • settings.syncUpscaleWidgetValuesWithModels (cognitive 19) invokeai/frontend/webv2/src/features/upscale/core/settings.ts:861 — settings.syncUpscaleWidgetValuesWithModels has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 13 (15 pts), boolean chains 3, if/else 1 (nesting depth added 2). Of this number, 15 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · validation.validateConnectionTypes (cognitive 19) · ×1
  • validation.validateConnectionTypes (cognitive 19) invokeai/frontend/webv2/src/features/workflow/core/validation.ts:40 — validation.validateConnectionTypes has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 17, if/else 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · fields.getWorkflowFieldInvalidReason (cognitive 19) · ×1
  • fields.getWorkflowFieldInvalidReason (cognitive 19) invokeai/frontend/webv2/src/features/workflow/core/fields.ts:465 — fields.getWorkflowFieldInvalidReason has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9, boolean chains 5, ternaries 3 (5 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · useWorkflowPublication.useWorkflowPublication.settle (cognitive 19) · ×1
  • useWorkflowPublication.useWorkflowPublication.settle (cognitive 19) invokeai/frontend/webv2/src/features/workflow/ui/library/useWorkflowPublication.ts:144 — useWorkflowPublication.useWorkflowPublication.settle has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 3 (8 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NodeContextMenu.NodeContextMenu (cognitive 19) · ×1
  • NodeContextMenu.NodeContextMenu (cognitive 19) invokeai/frontend/webv2/src/features/workflow/ui/editor/NodeContextMenu.tsx:43 — NodeContextMenu.NodeContextMenu has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 7 (18 pts), if/else 1 (nesting depth added 11). Of this number, 17 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · WorkflowFieldInput.BoardInput (cognitive 19) · ×1
  • WorkflowFieldInput.BoardInput (cognitive 19) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:517 — WorkflowFieldInput.BoardInput has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 10 (13 pts), boolean chains 5, if/else 1 (nesting depth added 3). Of this number, 10 points are the body's own statements and 9 belong to 6 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · NumericInput.NumericInput (cognitive 19) · ×1
  • NumericInput.NumericInput (cognitive 19) invokeai/frontend/webv2/src/features/workflow/ui/fields/NumericInput.tsx:79 — NumericInput.NumericInput has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 6 (9 pts), boolean chains 5, if/else 5 (nesting depth added 3). Of this number, 13 points are the body's own statements and 6 belong to 3 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · http.getValidationIssueMessage (cognitive 19) · ×1
  • http.getValidationIssueMessage (cognitive 19) invokeai/frontend/webv2/src/platform/transport/http.ts:124 — http.getValidationIssueMessage has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (9 pts), boolean chains 5, if/else 4 (5 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkbenchUnavailableScreen.WorkbenchUnavailableScreen (cognitive 19) · ×1
  • WorkbenchUnavailableScreen.WorkbenchUnavailableScreen (cognitive 19) invokeai/frontend/webv2/src/workbench/components/WorkbenchUnavailableScreen.tsx:18 — WorkbenchUnavailableScreen.WorkbenchUnavailableScreen has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 7 (11 pts), if/else 5 (6 pts), boolean chains 1, error handling 1 (nesting depth added 5). Most of this is not in the body itself: 8 of the 19 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 57, 40, 75, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · layerPanelState.selectLayerInPanel (cognitive 19) · ×1
  • layerPanelState.selectLayerInPanel (cognitive 19) invokeai/frontend/webv2/src/workbench/layerPanelState.ts:269 — layerPanelState.selectLayerInPanel has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (11 pts), if/else 5 (6 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · indexedDbDraftStore.createIndexedDbProjectDraftStore.readRetargetedCopy (cognitive 19) · ×1
  • indexedDbDraftStore.createIndexedDbProjectDraftStore.readRetargetedCopy (cognitive 19) invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:196 — indexedDbDraftStore.createIndexedDbProjectDraftStore.readRetargetedCopy has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7, ternaries 4 (7 pts), boolean chains 5 (nesting depth added 3). None of this is in the body itself: all 19 points belong to one function literal inside it that branches (line 200). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · indexedDbDraftStore.createIndexedDbProjectDraftStore.deleteCorrupt (cognitive 19) · ×1
  • indexedDbDraftStore.createIndexedDbProjectDraftStore.deleteCorrupt (cognitive 19) invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:557 — indexedDbDraftStore.createIndexedDbProjectDraftStore.deleteCorrupt has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 12, ternaries 6, if/else 1. None of this is in the body itself: all 19 points belong to one function literal inside it that branches (line 559). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · projectHalves.joinProjectDocument (cognitive 19) · ×1
  • projectHalves.joinProjectDocument (cognitive 19) invokeai/frontend/webv2/src/workbench/projects/projectHalves.ts:157 — projectHalves.joinProjectDocument has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 12, boolean chains 5, if/else 2. Of this number, 14 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · canvasStagingView.getCanvasStagingSlotsForQueueItem (cognitive 19) · ×1
  • canvasStagingView.getCanvasStagingSlotsForQueueItem (cognitive 19) invokeai/frontend/webv2/src/workbench/canvasStagingView.ts:184 — canvasStagingView.getCanvasStagingSlotsForQueueItem has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StagingBar.StagingBar · ×1
  • StagingBar.StagingBar::handleKeyDown (cognitive 19) invokeai/frontend/webv2/src/workbench/widgets/canvas/StagingBar.tsx:219 — StagingBar.StagingBar::handleKeyDown has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 5, ternaries 3 (5 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (StagingBar.StagingBar) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · layerTreeRows.buildLayerStackRows (cognitive 19) · ×1
  • layerTreeRows.buildLayerStackRows (cognitive 19) invokeai/frontend/webv2/src/workbench/widgets/layers/layerTreeRows.ts:69 — layerTreeRows.buildLayerStackRows has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 4, ternaries 2, loops 1 (nesting depth added 6). Of this number, 18 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · compositor.drawCachedLayer (cognitive 19) · ×1
  • compositor.drawCachedLayer (cognitive 19) invokeai/frontend/webv2/src/workbench/canvas-engine/render/compositor.ts:388 — compositor.drawCachedLayer has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 5, boolean chains 4 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · focusRegions.createWorkbenchFocusController.focusAdjacentRegion (cognitive 19) · ×1
  • focusRegions.createWorkbenchFocusController.focusAdjacentRegion (cognitive 19) invokeai/frontend/webv2/src/workbench/focusRegions.tsx:220 — focusRegions.createWorkbenchFocusController.focusAdjacentRegion has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 8, boolean chains 6, if/else 4 (5 pts) (nesting depth added 1). Of this number, 14 points are the body's own statements and 5 belong to 3 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · groupSurfaceCache.createGroupSurfaceCache.drawnEntries (cognitive 19) · ×1
  • groupSurfaceCache.createGroupSurfaceCache.drawnEntries (cognitive 19) invokeai/frontend/webv2/src/workbench/canvas-engine/render/groupSurfaceCache.ts:415 — groupSurfaceCache.createGroupSurfaceCache.drawnEntries has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (11 pts), if/else 2 (4 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · groupSurfaceCache.createGroupSurfaceCache.showSpatial (cognitive 19) · ×1
  • groupSurfaceCache.createGroupSurfaceCache.showSpatial (cognitive 19) invokeai/frontend/webv2/src/workbench/canvas-engine/render/groupSurfaceCache.ts:642 — groupSurfaceCache.createGroupSurfaceCache.showSpatial has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 5, ternaries 4 (5 pts) (nesting depth added 4). Of this number, 15 points are the body's own statements and 4 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · guidedFilter.boxMean (cognitive 19) · ×1
  • guidedFilter.boxMean (cognitive 19) invokeai/frontend/webv2/src/workbench/canvas-engine/render/spatial/guidedFilter.ts:69 — guidedFilter.boxMean has cognitive complexity 19 (threshold 15). Drivers by points: loops 7 (14 pts), if/else 3 (5 pts) (nesting depth added 9). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · importGalleryImages.importGalleryImagesToCanvas (cognitive 19) · ×1
  • importGalleryImages.importGalleryImagesToCanvas (cognitive 19) invokeai/frontend/webv2/src/workbench/canvas-operations/importGalleryImages.ts:236 — importGalleryImages.importGalleryImagesToCanvas has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 5, ternaries 2 (nesting depth added 2). Of this number, 18 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · firstPartyCommands.useRegisterFirstPartyCommands (cognitive 19) · ×1
  • firstPartyCommands.useRegisterFirstPartyCommands (cognitive 19) invokeai/frontend/webv2/src/workbench/hotkeys/firstPartyCommands.ts:103 — firstPartyCommands.useRegisterFirstPartyCommands has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 3, loops 3, ternaries 3, error handling 1 (nesting depth added 1). None of this is in the body itself: all 19 points belong to 9 function items inside it that branch (recallSelectedImage, a function literal at line 252, loadSelectedItemWorkflow, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · executeVideoRecall.placeVideoImage (cognitive 19) · ×1
  • executeVideoRecall.placeVideoImage (cognitive 19) invokeai/frontend/webv2/src/workbench/image-actions/executeVideoRecall.ts:677 — executeVideoRecall.placeVideoImage has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 7, ternaries 3 (4 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · MaxQueueHistorySettings.MaxQueueHistorySettings (cognitive 19) · ×1
  • MaxQueueHistorySettings.MaxQueueHistorySettings (cognitive 19) invokeai/frontend/webv2/src/workbench/settings/MaxQueueHistorySettings.tsx:31 — MaxQueueHistorySettings.MaxQueueHistorySettings has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 6 (7 pts), boolean chains 6, if/else 5, error handling 1 (nesting depth added 1). Of this number, 12 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · notificationToasts.startNotificationToasts (cognitive 19) · ×1
  • notificationToasts.startNotificationToasts (cognitive 19) invokeai/frontend/webv2/src/workbench/shell/notifications/notificationToasts.ts:58 — notificationToasts.startNotificationToasts has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 5 (6 pts), boolean chains 2, loops 2 (nesting depth added 5). None of this is in the body itself: all 19 points belong to 5 function items inside it that branch (show, a function literal at line 111, a function literal at line 93, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · LayoutPresetStrip.PresetTab (cognitive 19) · ×1
  • LayoutPresetStrip.PresetTab (cognitive 19) invokeai/frontend/webv2/src/workbench/shell/topbar/LayoutPresetStrip.tsx:349 — LayoutPresetStrip.PresetTab has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 11, if/else 5, boolean chains 3. Most of this is not in the body itself: 7 of the 19 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 429, 372, 391, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · board_images.add_images_to_board (cognitive 18) · ×1
  • board_images.add_images_to_board (cognitive 18) invokeai/app/api/routers/board_images.py:205 — board_images.add_images_to_board has cognitive complexity 18 (threshold 15). Drivers by points: error handling 7 (11 pts), if/else 1 (3 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · model_manager.get_starter_models (cognitive 18) · ×1
  • model_manager.get_starter_models (cognitive 18) invokeai/app/api/routers/model_manager.py:1535 — model_manager.get_starter_models has cognitive complexity 18 (threshold 15). Drivers by points: loops 5 (9 pts), if/else 2 (7 pts), boolean chains 2 (nesting depth added 9). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · Krea2LoRALoaderInvocation.invoke (cognitive 18) · ×1
  • Krea2LoRALoaderInvocation.invoke (cognitive 18) invokeai/app/invocations/krea2/krea2_lora_loader.py:57 — Krea2LoRALoaderInvocation.invoke has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9, boolean chains 5, ternaries 3 (4 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · load_custom_nodes.load_custom_nodes (cognitive 18) · ×1
  • load_custom_nodes.load_custom_nodes (cognitive 18) invokeai/app/invocations/load_custom_nodes.py:9 — load_custom_nodes.load_custom_nodes has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 2, error handling 1 (2 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IntermediatesService._summary_rows (cognitive 18) · ×1
  • IntermediatesService._summary_rows (cognitive 18) invokeai/app/services/intermediates/intermediates_default.py:221 — IntermediatesService._summary_rows has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 6 (11 pts), if/else 4 (6 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IntermediatesService._run (cognitive 18) · ×1
  • IntermediatesService._run (cognitive 18) invokeai/app/services/intermediates/intermediates_default.py:552 — IntermediatesService._run has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (9 pts), error handling 1 (3 pts), loops 2 (3 pts), ternaries 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IntermediatesSizeMeasurer.measure_once (cognitive 18) · ×1
  • IntermediatesSizeMeasurer.measure_once (cognitive 18) invokeai/app/services/intermediates/intermediates_measurement.py:49 — IntermediatesSizeMeasurer.measure_once has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (7 pts), error handling 2 (4 pts), loops 2 (3 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelInstallService._restart_remote_download (cognitive 18) · ×1
  • ModelInstallService._restart_remote_download (cognitive 18) invokeai/app/services/model_install/model_install_default.py:1364 — ModelInstallService._restart_remote_download has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 5, ternaries 3, error handling 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ExecutionScheduler.complete (cognitive 18) · ×1
  • ExecutionScheduler.complete (cognitive 18) invokeai/app/services/shared/execution_engine/scheduler.py:397 — ExecutionScheduler.complete has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 2, boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExecutionScheduler.rebuild_ready (cognitive 18) · ×1
  • ExecutionScheduler.rebuild_ready (cognitive 18) invokeai/app/services/shared/execution_engine/scheduler.py:431 — ExecutionScheduler.rebuild_ready has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 3, loops 2, ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GraphExecutionState._register_generic_child_dependency (cognitive 18) · ×1
  • GraphExecutionState._register_generic_child_dependency (cognitive 18) invokeai/app/services/shared/graph.py:2126 — GraphExecutionState._register_generic_child_dependency has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · graph_iterate_planner._prepare_body_iterate_collect_fan_in_unchecked (cognitive 18) · ×1
  • graph_iterate_planner._prepare_body_iterate_collect_fan_in_unchecked (cognitive 18) invokeai/app/services/shared/graph_iterate_planner.py:387 — graph_iterate_planner._prepare_body_iterate_collect_fan_in_unchecked has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 6 (8 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _ExecutionNodeBuilder._matches_sibling_if_collect_context (cognitive 18) · ×1
  • _ExecutionNodeBuilder._matches_sibling_if_collect_context (cognitive 18) invokeai/app/services/shared/graph_materializer.py:1516 — _ExecutionNodeBuilder._matches_sibling_if_collect_context has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), ternaries 2 (4 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _ExecutionNodeBuilder._has_admitted_source_mapping (cognitive 18) · ×1
  • _ExecutionNodeBuilder._has_admitted_source_mapping (cognitive 18) invokeai/app/services/shared/graph_materializer.py:1676 — _ExecutionNodeBuilder._has_admitted_source_mapping has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _ExecutionNodeBuilder._get_if_condition_iteration_mappings (cognitive 18) · ×1
  • _ExecutionNodeBuilder._get_if_condition_iteration_mappings (cognitive 18) invokeai/app/services/shared/graph_materializer.py:1740 — _ExecutionNodeBuilder._get_if_condition_iteration_mappings has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 4, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Migration26Callback.__call__ (cognitive 18) · ×1
  • Migration26Callback.__call__ (cognitive 18) invokeai/app/services/shared/sqlite_migrator/migrations/migration_26.py:44 — Migration26Callback.__call__ has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), error handling 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · workflow_graph_builder.apply_workflow_inputs_to_workflow (cognitive 18) · ×1
  • workflow_graph_builder.apply_workflow_inputs_to_workflow (cognitive 18) invokeai/app/services/shared/workflow_graph_builder.py:127 — workflow_graph_builder.apply_workflow_inputs_to_workflow has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DiskVideoFileStorage.save (cognitive 18) · ×1
  • DiskVideoFileStorage.save (cognitive 18) invokeai/app/services/video_files/video_files_disk.py:65 — DiskVideoFileStorage.save has cognitive complexity 18 (threshold 15). Drivers by points: error handling 5 (10 pts), if/else 7, boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkingMemoryCalibrationService._identify (cognitive 18) · ×1
  • WorkingMemoryCalibrationService._identify (cognitive 18) invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py:633 — WorkingMemoryCalibrationService._identify has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 2 (4 pts), loops 3, boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · KontextExtension._prepare_kontext (cognitive 18) · ×1
  • KontextExtension._prepare_kontext (cognitive 18) invokeai/backend/flux/extensions/kontext_extension.py:105 — KontextExtension._prepare_kontext has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), error handling 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · main._is_flux2_model (cognitive 18) · ×1
  • main._is_flux2_model (cognitive 18) invokeai/backend/model_manager/configs/main.py:437 — main._is_flux2_model has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2, boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mistral_encoder._count_mistral_layers (cognitive 18) · ×1
  • mistral_encoder._count_mistral_layers (cognitive 18) invokeai/backend/model_manager/configs/mistral_encoder.py:151 — mistral_encoder._count_mistral_layers has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 2, loops 1, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · qwen3_encoder._get_qwen3_variant_from_state_dict (cognitive 18) · ×1
  • qwen3_encoder._get_qwen3_variant_from_state_dict (cognitive 18) invokeai/backend/model_manager/configs/qwen3_encoder.py:211 — qwen3_encoder._get_qwen3_variant_from_state_dict has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelCache._load_locked_model (cognitive 18) · ×1
  • ModelCache._load_locked_model (cognitive 18) invokeai/backend/model_manager/load/model_cache/model_cache.py:2118 — ModelCache._load_locked_model has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 5, ternaries 4 (5 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ModelCache._offload_unlocked_models (cognitive 18) · ×1
  • ModelCache._offload_unlocked_models (cognitive 18) invokeai/backend/model_manager/load/model_cache/model_cache.py:2629 — ModelCache._offload_unlocked_models has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · flux2_state_dict_utils.convert_flux2_bfl_to_diffusers (cognitive 18) · ×1
  • flux2_state_dict_utils.convert_flux2_bfl_to_diffusers (cognitive 18) invokeai/backend/model_manager/load/model_loaders/flux2_state_dict_utils.py:402 — flux2_state_dict_utils.convert_flux2_bfl_to_diffusers has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 3 (5 pts), ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · gemma2_encoder.load_gemma2_model_from_gguf (cognitive 18) · ×1
  • gemma2_encoder.load_gemma2_model_from_gguf (cognitive 18) invokeai/backend/model_manager/load/model_loaders/gemma2_encoder.py:150 — gemma2_encoder.load_gemma2_model_from_gguf has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (4 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · select_hf_files.filter_files (cognitive 18) · ×1
  • select_hf_files.filter_files (cognitive 18) invokeai/backend/model_manager/util/select_hf_files.py:22 — select_hf_files.filter_files has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 1, loops 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · flux3_lora_constants.read_flux3_lora_keys (cognitive 18) · ×1
  • flux3_lora_constants.read_flux3_lora_keys (cognitive 18) invokeai/backend/patches/lora_conversions/flux3_lora_constants.py:272 — flux3_lora_constants.read_flux3_lora_keys has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2, ternaries 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · flux_diffusers_lora_conversion_utils.is_state_dict_likely_in_flux_diffusers_format (cognitive 18) · ×1
  • flux_diffusers_lora_conversion_utils.is_state_dict_likely_in_flux_diffusers_format (cognitive 18) invokeai/backend/patches/lora_conversions/flux_diffusers_lora_conversion_utils.py:17 — flux_diffusers_lora_conversion_utils.is_state_dict_likely_in_flux_diffusers_format has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 4, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _Window._close (cognitive 18) · ×1
  • _Window._close (cognitive 18) invokeai/backend/working_memory/probe.py:444 — _Window._close has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 4, ternaries 2 (3 pts), loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · benchmark_database._seed (cognitive 18) · ×1
  • benchmark_database._seed (cognitive 18) scripts/benchmark_database.py:219 — benchmark_database._seed has cognitive complexity 18 (threshold 15). Drivers by points: loops 10, if/else 2 (4 pts), ternaries 2 (4 pts) (nesting depth added 4). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · calibrate_flux2_working_memory.main (cognitive 18) · ×1
  • calibrate_flux2_working_memory.main (cognitive 18) scripts/calibrate_flux2_working_memory.py:228 — calibrate_flux2_working_memory.main has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · calibrate_flux3_denoise_working_memory.plan (cognitive 18) · ×1
  • calibrate_flux3_denoise_working_memory.plan (cognitive 18) scripts/calibrate_flux3_denoise_working_memory.py:299 — calibrate_flux3_denoise_working_memory.plan has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 3, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · check_pins.check_pins (cognitive 18) · ×1
  • check_pins.check_pins (cognitive 18) scripts/check_pins.py:275 — check_pins.check_pins has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 6 (9 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · build_shipped.review_lines (cognitive 18) · ×1
  • build_shipped.review_lines (cognitive 18) scripts/working_memory/build_shipped.py:643 — build_shipped.review_lines has cognitive complexity 18 (threshold 15). Drivers by points: loops 5 (9 pts), if/else 2 (7 pts), boolean chains 2 (nesting depth added 9). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · addArchivedOrDeletedBoardListener.addArchivedOrDeletedBoardListener (cognitive 18) · ×1
  • addArchivedOrDeletedBoardListener.addArchivedOrDeletedBoardListener (cognitive 18) invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/addArchivedOrDeletedBoardListener.ts:19 — addArchivedOrDeletedBoardListener.addArchivedOrDeletedBoardListener has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 9. None of this is in the body itself: all 18 points belong to 4 function literals inside it that branch (lines 64, 26, 103, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · GalleryImageGrid.useStarImageHotkey (cognitive 18) · ×1
  • GalleryImageGrid.useStarImageHotkey (cognitive 18) invokeai/frontend/webv1/src/features/gallery/components/GalleryImageGrid.tsx:337 — GalleryImageGrid.useStarImageHotkey has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 4, boolean chains 1 (nesting depth added 4). Most of this is not in the body itself: 5 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 351). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · fieldValidators.getFieldErrors (cognitive 18) · ×1
  • fieldValidators.getFieldErrors (cognitive 18) invokeai/frontend/webv1/src/features/nodes/store/util/fieldValidators.ts:214 — fieldValidators.getFieldErrors has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 8 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SettingsGenerationDevices.DeviceTag (cognitive 18) · ×1
  • SettingsGenerationDevices.DeviceTag (cognitive 18) invokeai/frontend/webv1/src/features/system/components/SettingsModal/SettingsGenerationDevices.tsx:208 — SettingsGenerationDevices.DeviceTag has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (7 pts), ternaries 7, boolean chains 4 (nesting depth added 1). Of this number, 11 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · workflowExecutionCoordinator.createWorkflowExecutionCoordinator.onQueueItemStatusChanged (cognitive 18) · ×1
  • workflowExecutionCoordinator.createWorkflowExecutionCoordinator.onQueueItemStatusChanged (cognitive 18) invokeai/frontend/webv1/src/services/events/workflowExecutionCoordinator.ts:256 — workflowExecutionCoordinator.createWorkflowExecutionCoordinator.onQueueItemStatusChanged has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · performance-budgets.checkBrowserRouteBudget (cognitive 18) · ×1
  • performance-budgets.checkBrowserRouteBudget (cognitive 18) invokeai/frontend/webv2/scripts/performance-budgets.mjs:902 — performance-budgets.checkBrowserRouteBudget has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 3 (5 pts), boolean chains 2, loops 2 (nesting depth added 5). Of this number, 17 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkflowUiAdapter.selectProjectPersistence (cognitive 18) · ×1
  • WorkflowUiAdapter.selectProjectPersistence (cognitive 18) invokeai/frontend/webv2/src/app/WorkflowUiAdapter.tsx:74 — WorkflowUiAdapter.selectProjectPersistence has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 6 (16 pts), boolean chains 2 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · queries.ensureLifecycle (cognitive 18) · ×1
  • queries.ensureLifecycle (cognitive 18) invokeai/frontend/webv2/src/features/gallery/data/queries.ts:396 — queries.ensureLifecycle has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 11, if/else 4 (5 pts), loops 2 (nesting depth added 1). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 418, seedExistingPages, pruneListing, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · installsStore.handleModelInstallSocketEvent (cognitive 18) · ×1
  • installsStore.handleModelInstallSocketEvent (cognitive 18) invokeai/frontend/webv2/src/features/models/data/installsStore.ts:455 — installsStore.handleModelInstallSocketEvent has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 6 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · coordinator.createQueueCoordinator.handleStatusChanged (cognitive 18) · ×1
  • coordinator.createQueueCoordinator.handleStatusChanged (cognitive 18) invokeai/frontend/webv2/src/features/queue/runtime/coordinator.ts:808 — coordinator.createQueueCoordinator.handleStatusChanged has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utilityGraph.reconcileUtilityCompletedOutput (cognitive 18) · ×1
  • utilityGraph.reconcileUtilityCompletedOutput (cognitive 18) invokeai/frontend/webv2/src/features/queue/runtime/utilityGraph.ts:174 — utilityGraph.reconcileUtilityCompletedOutput has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (11 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · outputFields.formatOutputValue (cognitive 18) · ×1
  • outputFields.formatOutputValue (cognitive 18) invokeai/frontend/webv2/src/features/workflow/core/outputFields.ts:62 — outputFields.formatOutputValue has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 2 (4 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkflowLibraryGrid.WorkflowLibraryGrid (cognitive 18) · ×1
  • WorkflowLibraryGrid.WorkflowLibraryGrid (cognitive 18) invokeai/frontend/webv2/src/features/workflow/ui/library/WorkflowLibraryGrid.tsx:54 — WorkflowLibraryGrid.WorkflowLibraryGrid has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 7 (10 pts), boolean chains 5, if/else 3 (nesting depth added 3). Of this number, 10 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · clipboard.getBridgingConnectorIds (cognitive 18) · ×1
  • clipboard.getBridgingConnectorIds (cognitive 18) invokeai/frontend/webv2/src/features/workflow/ui/editor/clipboard.ts:57 — clipboard.getBridgingConnectorIds has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 7, loops 2 (nesting depth added 3). Most of this is not in the body itself: 4 of the 18 points are its own statements and the rest belongs to 3 function items inside it that branch (reachesCopiedNode, startsAtCopiedNode, isConnectorId). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · Picker.PickerListbox (cognitive 18) · ×1
  • Picker.PickerListbox (cognitive 18) invokeai/frontend/webv2/src/platform/ui/Picker.tsx:374 — Picker.PickerListbox has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 10 (14 pts), if/else 3, loops 1 (nesting depth added 4). Most of this is not in the body itself: 3 of the 18 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 512, a function literal at line 408, a function literal at line 413, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · ResizableTextarea.ResizableTextarea (cognitive 18) · ×1
  • ResizableTextarea.ResizableTextarea (cognitive 18) invokeai/frontend/webv2/src/platform/ui/ResizableTextarea.tsx:63 — ResizableTextarea.ResizableTextarea has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 8 (17 pts), if/else 1 (nesting depth added 9). Most of this is not in the body itself: 2 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 119). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · draftStore.decideUnloadJournalEntry (cognitive 18) · ×1
  • draftStore.decideUnloadJournalEntry (cognitive 18) invokeai/frontend/webv2/src/workbench/projects/draftStore.ts:802 — draftStore.decideUnloadJournalEntry has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7, ternaries 5 (7 pts), boolean chains 4 (nesting depth added 2). Of this number, 17 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · draftStore.createMemoryProjectDraftStore.stage (cognitive 18) · ×1
  • draftStore.createMemoryProjectDraftStore.stage (cognitive 18) invokeai/frontend/webv2/src/workbench/projects/draftStore.ts:1554 — draftStore.createMemoryProjectDraftStore.stage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, ternaries 1 (3 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · indexedDbDraftStore.createIndexedDbProjectDraftStore.settleAcknowledgement (cognitive 18) · ×1
  • indexedDbDraftStore.createIndexedDbProjectDraftStore.settleAcknowledgement (cognitive 18) invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:1125 — indexedDbDraftStore.createIndexedDbProjectDraftStore.settleAcknowledgement has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 4, ternaries 3 (4 pts) (nesting depth added 2). Most of this is not in the body itself: 6 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 1135). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · projectAssets.createOpenProjectsHeldMediaReader · ×1
  • projectAssets.createOpenProjectsHeldMediaReader::collectParts (cognitive 18) invokeai/frontend/webv2/src/workbench/projects/projectAssets.ts:188 — projectAssets.createOpenProjectsHeldMediaReader::collectParts has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 4, loops 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · projectDocument.applyAuthoritativeProjectBoard (cognitive 18) · ×1
  • projectDocument.applyAuthoritativeProjectBoard (cognitive 18) invokeai/frontend/webv2/src/workbench/projects/projectDocument.ts:302 — projectDocument.applyAuthoritativeProjectBoard has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 4 (9 pts), if/else 3 (5 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · useStagedResultGallerySave.useStagedResultGallerySave.save · ×1
  • useStagedResultGallerySave.useStagedResultGallerySave.save::run (cognitive 18) invokeai/frontend/webv2/src/workbench/widgets/canvas/useStagedResultGallerySave.ts:51 — useStagedResultGallerySave.useStagedResultGallerySave.save::run has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 5 (8 pts), if/else 6 (7 pts), boolean chains 2, error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · layerChildRows.projectLayerChildRows (cognitive 18) · ×1
  • layerChildRows.projectLayerChildRows (cognitive 18) invokeai/frontend/webv2/src/workbench/widgets/layers/layerChildRows.ts:233 — layerChildRows.projectLayerChildRows has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 5, ternaries 2 (4 pts) (nesting depth added 2). Of this number, 17 points are the body's own statements and 1 belongs to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · layerChildRows.getLayerChildItem (cognitive 18) · ×1
  • layerChildRows.getLayerChildItem (cognitive 18) invokeai/frontend/webv2/src/workbench/widgets/layers/layerChildRows.ts:308 — layerChildRows.getLayerChildItem has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 5, ternaries 2 (4 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LayerSection.resolveChildEditor (cognitive 18) · ×1
  • LayerSection.resolveChildEditor (cognitive 18) invokeai/frontend/webv2/src/workbench/widgets/layers/panes/LayerSection.tsx:82 — LayerSection.resolveChildEditor has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · QueueStatusWidgetView.QueueStatusWidgetView (cognitive 18) · ×1
  • QueueStatusWidgetView.QueueStatusWidgetView (cognitive 18) invokeai/frontend/webv2/src/workbench/widgets/queue-status/QueueStatusWidgetView.tsx:12 — QueueStatusWidgetView.QueueStatusWidgetView has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 10 (16 pts), boolean chains 1, if/else 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LayerMutationController.duplicate (cognitive 18) · ×1
  • LayerMutationController.duplicate (cognitive 18) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/layerMutationController.ts:147 — LayerMutationController.duplicate has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · layerStacks.moveSelectedIds (cognitive 18) · ×1
  • layerStacks.moveSelectedIds (cognitive 18) invokeai/frontend/webv2/src/workbench/canvas-engine/document/layerStacks.ts:91 — layerStacks.moveSelectedIds has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 2 (4 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · workbenchState.removeGalleryItemsFromAllProjects (cognitive 18) · ×1
  • workbenchState.removeGalleryItemsFromAllProjects (cognitive 18) invokeai/frontend/webv2/src/workbench/workbenchState.ts:3432 — workbenchState.removeGalleryItemsFromAllProjects has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 10, boolean chains 5, if/else 3. Most of this is not in the body itself: 2 of the 18 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 3456, 3494, 3441, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ThumbnailController.draw (cognitive 18) · ×1
  • ThumbnailController.draw (cognitive 18) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/thumbnailController.ts:74 — ThumbnailController.draw has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9, boolean chains 6, ternaries 3. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · psdExport.executePsdExport (cognitive 18) · ×1
  • psdExport.executePsdExport (cognitive 18) invokeai/frontend/webv2/src/workbench/canvas-engine/export/psdExport.ts:459 — psdExport.executePsdExport has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 3 (5 pts), loops 2, boolean chains 1 (nesting depth added 7). Most of this is not in the body itself: 4 of the 18 points are its own statements and the rest belongs to 2 function items inside it that branch (drawPreview, a function literal at line 493). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · selectionState.createSelectionState.commit (cognitive 18) · ×1
  • selectionState.createSelectionState.commit (cognitive 18) invokeai/frontend/webv2/src/workbench/canvas-engine/selection/selectionState.ts:264 — selectionState.createSelectionState.commit has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 6, ternaries 3, match/switch 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · layerImageResult.processSelectObjectSource (cognitive 18) · ×1
  • layerImageResult.processSelectObjectSource (cognitive 18) invokeai/frontend/webv2/src/workbench/canvas-operations/layerImageResult.ts:128 — layerImageResult.processSelectObjectSource has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 3 (9 pts), if/else 6 (7 pts), boolean chains 1, error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · videoRecall.getReferences (cognitive 18) · ×1
  • videoRecall.getReferences (cognitive 18) invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts:315 — videoRecall.getReferences has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 5 (10 pts), boolean chains 5, if/else 3 (nesting depth added 5). None of this is in the body itself: all 18 points belong to one function literal inside it that branches (line 318). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · queueRecall.buildVideoQueueRecallPatch (cognitive 18) · ×1
  • queueRecall.buildVideoQueueRecallPatch (cognitive 18) invokeai/frontend/webv2/src/workbench/queue-integration/queueRecall.ts:121 — queueRecall.buildVideoQueueRecallPatch has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 3 (6 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · invokeIssueActions.useInvokeIssueActions (cognitive 18) · ×1
  • invokeIssueActions.useInvokeIssueActions (cognitive 18) invokeai/frontend/webv2/src/workbench/shell/topbar/invokeIssueActions.ts:43 — invokeIssueActions.useInvokeIssueActions has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), ternaries 2 (5 pts), boolean chains 1, match/switch 1 (nesting depth added 9). None of this is in the body itself: all 18 points belong to 4 function literals inside it that branch (lines 53, 77, 98, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · widgetDnd.widgetCollisionDetection (cognitive 18) · ×1
  • widgetDnd.widgetCollisionDetection (cognitive 18) invokeai/frontend/webv2/src/workbench/widgetDnd.ts:347 — widgetDnd.widgetCollisionDetection has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 2, ternaries 2 (nesting depth added 8). Of this number, 16 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AdjustmentSettings.CurvesEditor (cognitive 18) · ×1
  • AdjustmentSettings.CurvesEditor (cognitive 18) invokeai/frontend/webv2/src/workbench/widgets/layers/AdjustmentSettings.tsx:710 — AdjustmentSettings.CurvesEditor has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9, boolean chains 6, ternaries 2, loops 1. None of this is in the body itself: all 18 points belong to 8 function literals inside it that branch (lines 810, 784, 840, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · image_map.get_image_map_points (cognitive 17) · ×1
  • image_map.get_image_map_points (cognitive 17) invokeai/app/api/routers/image_map.py:418 — image_map.get_image_map_points has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 4 (6 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SocketIO._handle_queue_event (cognitive 17) · ×1
  • SocketIO._handle_queue_event (cognitive 17) invokeai/app/api/sockets.py:972 — SocketIO._handle_queue_event has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3, error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DownloadQueueService._download_next_item (cognitive 17) · ×1
  • DownloadQueueService._download_next_item (cognitive 17) invokeai/app/services/download/download_default.py:389 — DownloadQueueService._download_next_item has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), error handling 3 (6 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DownloadQueueService._mfd_error (cognitive 17) · ×1
  • DownloadQueueService._mfd_error (cognitive 17) invokeai/app/services/download/download_default.py:858 — DownloadQueueService._mfd_error has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ImageMoveService._complete_partial_filesystem_move (cognitive 17) · ×1
  • ImageMoveService._complete_partial_filesystem_move (cognitive 17) invokeai/app/services/image_moves/image_moves_default.py:463 — ImageMoveService._complete_partial_filesystem_move has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, if/else 7 (8 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · WorkflowCallQueueLifecycle._resume_parent_from_completed_child (cognitive 17) · ×1
  • WorkflowCallQueueLifecycle._resume_parent_from_completed_child (cognitive 17) invokeai/app/services/session_processor/workflow_call_runtime.py:295 — WorkflowCallQueueLifecycle._resume_parent_from_completed_child has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), error handling 2 (3 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Batch.validate_types (cognitive 17) · ×1
  • Batch.validate_types (cognitive 17) invokeai/app/services/session_queue/session_queue_common.py:146 — Batch.validate_types has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (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.
D2 · Cognitive Complexity · copy.find_oversized (cognitive 17) · ×1
  • copy.find_oversized (cognitive 17) invokeai/app/services/shared/database/copy.py:147 — copy.find_oversized has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), ternaries 1 (4 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · images._conditions (cognitive 17) · ×1
  • images._conditions (cognitive 17) invokeai/app/services/shared/database/queries/images.py:196 — images._conditions has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 3 (5 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ExecutionScheduler.discard (cognitive 17) · ×1
  • ExecutionScheduler.discard (cognitive 17) invokeai/app/services/shared/execution_engine/scheduler.py:354 — ExecutionScheduler.discard has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 2, boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GraphExecutionState._validate_output_owner (cognitive 17) · ×1
  • GraphExecutionState._validate_output_owner (cognitive 17) invokeai/app/services/shared/graph.py:2531 — GraphExecutionState._validate_output_owner has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 5 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _ExecutionNodeBuilder._get_parent_iteration_mappings_without_iterators (cognitive 17) · ×1
  • _ExecutionNodeBuilder._get_parent_iteration_mappings_without_iterators (cognitive 17) invokeai/app/services/shared/graph_materializer.py:1408 — _ExecutionNodeBuilder._get_parent_iteration_mappings_without_iterators has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _ExecutionNodeBuilder._get_parent_iteration_mappings (cognitive 17) · ×1
  • _ExecutionNodeBuilder._get_parent_iteration_mappings (cognitive 17) invokeai/app/services/shared/graph_materializer.py:1551 — _ExecutionNodeBuilder._get_parent_iteration_mappings has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _ExecutionNodeBuilder._get_unexecuted_root_collect_if_descendants (cognitive 17) · ×1
  • _ExecutionNodeBuilder._get_unexecuted_root_collect_if_descendants (cognitive 17) invokeai/app/services/shared/graph_materializer.py:2348 — _ExecutionNodeBuilder._get_unexecuted_root_collect_if_descendants has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 4, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · graph_nested_iterate_planner._get_exact_nested_iterate_body (cognitive 17) · ×1
  • graph_nested_iterate_planner._get_exact_nested_iterate_body (cognitive 17) invokeai/app/services/shared/graph_nested_iterate_planner.py:21 — graph_nested_iterate_planner._get_exact_nested_iterate_body has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, ternaries 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · _GenericGraphSchedulerAdapter.complete (cognitive 17) · ×1
  • _GenericGraphSchedulerAdapter.complete (cognitive 17) invokeai/app/services/shared/graph_scheduler.py:605 — _GenericGraphSchedulerAdapter.complete has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (12 pts), loops 4, boolean chains 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · StoreEmbeddingsFp16Callback._convert_table (cognitive 17) · ×1
  • StoreEmbeddingsFp16Callback._convert_table (cognitive 17) invokeai/app/services/shared/sqlite_migrator/migrations/migration_2026_09_30_store_embeddings_fp16.py:69 — StoreEmbeddingsFp16Callback._convert_table has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), error handling 1 (3 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Migration24Callback._normalize_model_storage (cognitive 17) · ×1
  • Migration24Callback._normalize_model_storage (cognitive 17) invokeai/app/services/shared/sqlite_migrator/migrations/migration_24.py:79 — Migration24Callback._normalize_model_storage has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (12 pts), error handling 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · WorkingMemoryCalibrationService.get_model_summary (cognitive 17) · ×1
  • WorkingMemoryCalibrationService.get_model_summary (cognitive 17) invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py:1806 — WorkingMemoryCalibrationService.get_model_summary has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (7 pts), ternaries 5, boolean chains 3, loops 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ssrf._parse_ipv4_literal (cognitive 17) · ×1
  • ssrf._parse_ipv4_literal (cognitive 17) invokeai/app/util/ssrf.py:136 — ssrf._parse_ipv4_literal has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 3, error handling 2 (3 pts), loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · video_audio._probe_audio_sample_rate (cognitive 17) · ×1
  • video_audio._probe_audio_sample_rate (cognitive 17) invokeai/app/util/video_audio.py:213 — video_audio._probe_audio_sample_rate has cognitive complexity 17 (threshold 15). Drivers by points: error handling 2 (6 pts), if/else 2 (6 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mediapipe_face_common.draw_pupils (cognitive 17) · ×1
  • mediapipe_face_common.draw_pupils (cognitive 17) invokeai/backend/image_util/mediapipe_face/mediapipe_face_common.py:50 — mediapipe_face_common.draw_pupils has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 4, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PiDiNet.__init__ (cognitive 17) · ×1
  • PiDiNet.__init__ (cognitive 17) invokeai/backend/image_util/pidi/model.py:497 — PiDiNet.__init__ has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), loops 4 (8 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SegmentAnything2Pipeline.segment (cognitive 17) · ×1
  • SegmentAnything2Pipeline.segment (cognitive 17) invokeai/backend/image_util/segment_anything/segment_anything_2_pipeline.py:37 — SegmentAnything2Pipeline.segment has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (4 pts), ternaries 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SegmentAnythingPipeline.segment (cognitive 17) · ×1
  • SegmentAnythingPipeline.segment (cognitive 17) invokeai/backend/image_util/segment_anything/segment_anything_pipeline.py:31 — SegmentAnythingPipeline.segment has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (4 pts), ternaries 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AutoencoderKLMiniMaxH3._decode (cognitive 17) · ×1
  • AutoencoderKLMiniMaxH3._decode (cognitive 17) invokeai/backend/minimax_h3/autoencoder_kl_minimax_h3.py:795 — AutoencoderKLMiniMaxH3._decode has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (3 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 7). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
D2 · Cognitive Complexity · main._sdnq_component_declared_classes (cognitive 17) · ×1
  • main._sdnq_component_declared_classes (cognitive 17) invokeai/backend/model_manager/configs/main.py:3797 — main._sdnq_component_declared_classes has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AnimaCheckpointModel._load_from_singlefile (cognitive 17) · ×1
  • AnimaCheckpointModel._load_from_singlefile (cognitive 17) invokeai/backend/model_manager/load/model_loaders/anima.py:95 — AnimaCheckpointModel._load_from_singlefile has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Flux2CheckpointModel._dequantize_fp8_weights (cognitive 17) · ×1
  • Flux2CheckpointModel._dequantize_fp8_weights (cognitive 17) invokeai/backend/model_manager/load/model_loaders/flux.py:1551 — Flux2CheckpointModel._dequantize_fp8_weights has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 5, boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · QwenImage21DiffusersModel._load_model (cognitive 17) · ×1
  • QwenImage21DiffusersModel._load_model (cognitive 17) invokeai/backend/model_manager/load/model_loaders/qwen_image_2_1.py:90 — QwenImage21DiffusersModel._load_model has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (13 pts), ternaries 2, boolean chains 1, error handling 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · model_util.lora_token_vector_length (cognitive 17) · ×1
  • model_util.lora_token_vector_length (cognitive 17) invokeai/backend/model_manager/util/model_util.py:87 — model_util.lora_token_vector_length has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 5, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelPatcher.apply_ti (cognitive 17) · ×1
  • ModelPatcher.apply_ti (cognitive 17) REDACTED:44 — ModelPatcher.apply_ti has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 4 (6 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MOSSImageTransformer.forward (cognitive 17) · ×1
  • MOSSImageTransformer.forward (cognitive 17) invokeai/backend/moss_image/pipeline_moss_image.py:218 — MOSSImageTransformer.forward has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 3, loops 2 (3 pts), ternaries 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LayerPatcher.apply_smart_model_patch (cognitive 17) · ×1
  • LayerPatcher.apply_smart_model_patch (cognitive 17) invokeai/backend/patches/layer_patcher.py:113 — LayerPatcher.apply_smart_model_patch has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · minimax_h3_lora_conversion_utils.lora_model_from_minimax_h3_state_dict (cognitive 17) · ×1
  • minimax_h3_lora_conversion_utils.lora_model_from_minimax_h3_state_dict (cognitive 17) invokeai/backend/patches/lora_conversions/minimax_h3_lora_conversion_utils.py:86 — minimax_h3_lora_conversion_utils.lora_model_from_minimax_h3_state_dict has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (4 pts), error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PidDistillModel.load_state_dict (cognitive 17) · ×1
  • PidDistillModel.load_state_dict (cognitive 17) invokeai/backend/pid/_src/models/pid_distill_model.py:293 — PidDistillModel.load_state_dict has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 3, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ProbeScope.open_window (cognitive 17) · ×1
  • ProbeScope.open_window (cognitive 17) invokeai/backend/working_memory/probe.py:514 — ProbeScope.open_window has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 4, error handling 2, ternaries 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · calibrate_flux3_denoise_working_memory.main (cognitive 17) · ×1
  • calibrate_flux3_denoise_working_memory.main (cognitive 17) scripts/calibrate_flux3_denoise_working_memory.py:803 — calibrate_flux3_denoise_working_memory.main has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 2, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · calibrate_krea2_working_memory.main (cognitive 17) · ×1
  • calibrate_krea2_working_memory.main (cognitive 17) scripts/calibrate_krea2_working_memory.py:688 — calibrate_krea2_working_memory.main has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, ternaries 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · check_platform_locks.walk_closure (cognitive 17) · ×1
  • check_platform_locks.walk_closure (cognitive 17) scripts/check_platform_locks.py:243 — check_platform_locks.walk_closure has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (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.
D2 · Cognitive Complexity · build_shipped._fragmented_attempts (cognitive 17) · ×1
  • build_shipped._fragmented_attempts (cognitive 17) scripts/working_memory/build_shipped.py:322 — build_shipped._fragmented_attempts has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 4 (10 pts), loops 3 (5 pts), boolean chains 1, if/else 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CanvasEntityAdapterInpaintMask.sync (cognitive 17) · ×1
  • CanvasEntityAdapterInpaintMask.sync (cognitive 17) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityAdapterInpaintMask.ts:31 — CanvasEntityAdapterInpaintMask.sync has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, boolean chains 8. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · CanvasEntityAdapterRasterLayer.sync (cognitive 17) · ×1
  • CanvasEntityAdapterRasterLayer.sync (cognitive 17) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityAdapterRasterLayer.ts:56 — CanvasEntityAdapterRasterLayer.sync has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, boolean chains 8. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · CanvasEntityAdapterRegionalGuidance.sync (cognitive 17) · ×1
  • CanvasEntityAdapterRegionalGuidance.sync (cognitive 17) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityAdapterRegionalGuidance.ts:31 — CanvasEntityAdapterRegionalGuidance.sync has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, boolean chains 8. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · needsPixelBbox.objectStateNeedsPixelBbox (cognitive 17) · ×1
  • needsPixelBbox.objectStateNeedsPixelBbox (cognitive 17) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasObject/needsPixelBbox.ts:3 — needsPixelBbox.objectStateNeedsPixelBbox has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 6 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CanvasEraserToolModule.onStagePointerDown (cognitive 17) · ×1
  • CanvasEraserToolModule.onStagePointerDown (cognitive 17) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasEraserToolModule.ts:222 — CanvasEraserToolModule.onStagePointerDown has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CanvasToolModule.getCanDraw (cognitive 17) · ×1
  • CanvasToolModule.getCanDraw (cognitive 17) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasToolModule.ts:458 — CanvasToolModule.getCanDraw has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (17 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · pressure.buildPressureStrokeRenderOps (cognitive 17) · ×1
  • pressure.buildPressureStrokeRenderOps (cognitive 17) invokeai/frontend/webv1/src/features/controlLayers/konva/pressure.ts:594 — pressure.buildPressureStrokeRenderOps has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · paramsSlice.applyParamsVersionMigrations (cognitive 17) · ×1
  • paramsSlice.applyParamsVersionMigrations (cognitive 17) invokeai/frontend/webv1/src/features/controlLayers/store/paramsSlice.ts:1080 — paramsSlice.applyParamsVersionMigrations has cognitive complexity 17 (threshold 15). Drivers by points: if/else 15 (16 pts), boolean chains 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · validators.getControlLayerWarnings (cognitive 17) · ×1
  • validators.getControlLayerWarnings (cognitive 17) invokeai/frontend/webv1/src/features/controlLayers/store/validators.ts:266 — validators.getControlLayerWarnings has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 5 (nesting depth added 3). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Editor.createKonvaCropInteractionHandle (cognitive 17) · ×1
  • Editor.createKonvaCropInteractionHandle (cognitive 17) invokeai/frontend/webv1/src/features/cropper/lib/editor.ts:418 — Editor.createKonvaCropInteractionHandle has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 4, ternaries 1 (nesting depth added 1). None of this is in the body itself: all 17 points belong to 4 function literals inside it that branch (lines 446, 434, 466, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · selectedItemReveal.createSelectedItemRevealMachine.sync (cognitive 17) · ×1
  • selectedItemReveal.createSelectedItemRevealMachine.sync (cognitive 17) invokeai/frontend/webv1/src/features/gallery/components/ImageViewer/selectedItemReveal.ts:131 — selectedItemReveal.createSelectedItemRevealMachine.sync has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AddNodeCmdk.useAddNode.addNode (cognitive 17) · ×1
  • AddNodeCmdk.useAddNode.addNode (cognitive 17) invokeai/frontend/webv1/src/features/nodes/components/flow/AddNodeCmdk/AddNodeCmdk.tsx:68 — AddNodeCmdk.useAddNode.addNode has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 4 (8 pts), boolean chains 1 (nesting depth added 5). Of this number, 15 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AddNodeCmdk.filter (cognitive 17) · ×1
  • AddNodeCmdk.filter (cognitive 17) invokeai/frontend/webv1/src/features/nodes/components/flow/AddNodeCmdk/AddNodeCmdk.tsx:304 — AddNodeCmdk.filter has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 7, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · getCollectItemType.getCollectItemType (cognitive 17) · ×1
  • getCollectItemType.getCollectItemType (cognitive 17) invokeai/frontend/webv1/src/features/nodes/store/util/getCollectItemType.ts:25 — getCollectItemType.getCollectItemType has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 3 (nesting depth added 3). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 3 function items inside it that branch (getCollectItemTypeInternal, a function literal at line 37, a function literal at line 55). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · workflow.validateFormStructure (cognitive 17) · ×1
  • workflow.validateFormStructure (cognitive 17) invokeai/frontend/webv1/src/features/nodes/types/workflow.ts:310 — workflow.validateFormStructure has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3 (nesting depth added 5). Most of this is not in the body itself: 2 of the 17 points are its own statements and the rest belongs to one function item inside it that branches (findChildren). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · ParamPositivePrompt.ParamPositivePrompt (cognitive 17) · ×1
  • ParamPositivePrompt.ParamPositivePrompt (cognitive 17) invokeai/frontend/webv1/src/features/parameters/components/Core/ParamPositivePrompt.tsx:147 — ParamPositivePrompt.ParamPositivePrompt has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 7, loops 1 (nesting depth added 1). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 199, 291, 163, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · readiness.pushWanReasons (cognitive 17) · ×1
  • readiness.pushWanReasons (cognitive 17) invokeai/frontend/webv1/src/features/queue/store/readiness.ts:308 — readiness.pushWanReasons has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 6 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · settings.getGallerySettings (cognitive 17) · ×1
  • settings.getGallerySettings (cognitive 17) invokeai/frontend/webv2/src/features/gallery/core/settings.ts:205 — settings.getGallerySettings has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 15, boolean chains 2. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · galleryStateView.getGalleryStateView (cognitive 17) · ×1
  • galleryStateView.getGalleryStateView (cognitive 17) invokeai/frontend/webv2/src/features/gallery/ui/galleryStateView.ts:478 — galleryStateView.getGalleryStateView has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 8 (9 pts), boolean chains 8 (nesting depth added 1). Of this number, 15 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · settings.normalizeReferenceImageConfig (cognitive 17) · ×1
  • settings.normalizeReferenceImageConfig (cognitive 17) invokeai/frontend/webv2/src/features/generation/core/settings.ts:413 — settings.normalizeReferenceImageConfig has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (10 pts), boolean chains 4, if/else 2, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · settings.cloneGenerateWidgetValues (cognitive 17) · ×1
  • settings.cloneGenerateWidgetValues (cognitive 17) invokeai/frontend/webv2/src/features/generation/core/settings.ts:654 — settings.cloneGenerateWidgetValues has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 17. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ast.serializeInto (cognitive 17) · ×1
  • ast.serializeInto (cognitive 17) invokeai/frontend/webv2/src/features/generation/core/prompt/ast.ts:776 — ast.serializeInto has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (5 pts), match/switch 1 (2 pts) (nesting depth added 10). Of this number, 14 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConditioningRebalanceBars.ConditioningRebalanceBars (cognitive 17) · ×1
  • ConditioningRebalanceBars.ConditioningRebalanceBars (cognitive 17) invokeai/frontend/webv2/src/features/generation/ui/shared/ConditioningRebalanceBars.tsx:100 — ConditioningRebalanceBars.ConditioningRebalanceBars has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 7, boolean chains 5, if/else 5. None of this is in the body itself: all 17 points belong to 4 function literals inside it that branch (lines 219, 162, 115, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · GenerateSettingsForm.GenerateSettingsForm (cognitive 17) · ×1
  • GenerateSettingsForm.GenerateSettingsForm (cognitive 17) invokeai/frontend/webv2/src/features/generation/ui/GenerateSettingsForm.tsx:53 — GenerateSettingsForm.GenerateSettingsForm has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (14 pts), ternaries 3 (nesting depth added 1). None of this is in the body itself: all 17 points belong to 10 function items inside it that branch (a function literal at line 101, a function literal at line 264, a function literal at line 205, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · WorkingMemorySection.WorkingMemorySection (cognitive 17) · ×1
  • WorkingMemorySection.WorkingMemorySection (cognitive 17) invokeai/frontend/webv2/src/features/models/ui/detail/WorkingMemorySection.tsx:70 — WorkingMemorySection.WorkingMemorySection has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (9 pts), if/else 6, boolean chains 2 (nesting depth added 4). Of this number, 16 points are the body's own statements and 1 belongs to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NodeInstallQueue.NodeInstallRow (cognitive 17) · ×1
  • NodeInstallQueue.NodeInstallRow (cognitive 17) invokeai/frontend/webv2/src/features/nodes/ui/install-queue/NodeInstallQueue.tsx:185 — NodeInstallQueue.NodeInstallRow has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 9 (14 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · runtime.createQueueRuntime.deliverResultVideos (cognitive 17) · ×1
  • runtime.createQueueRuntime.deliverResultVideos (cognitive 17) invokeai/frontend/webv2/src/features/queue/runtime.ts:1013 — runtime.createQueueRuntime.deliverResultVideos has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7, error handling 4, boolean chains 3, ternaries 2 (3 pts) (nesting depth added 1). Of this number, 16 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · runtime.createQueueRuntime.loadProjectJournal (cognitive 17) · ×1
  • runtime.createQueueRuntime.loadProjectJournal (cognitive 17) invokeai/frontend/webv2/src/features/queue/runtime.ts:2371 — runtime.createQueueRuntime.loadProjectJournal has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 4). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 2379, 2398). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · LayerEditorPanes.LayerPaneBlock (cognitive 17) · ×1
  • LayerEditorPanes.LayerPaneBlock (cognitive 17) invokeai/frontend/webv2/src/workbench/widgets/layers/panes/LayerEditorPanes.tsx:48 — LayerEditorPanes.LayerPaneBlock has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 12 (16 pts), if/else 1 (nesting depth added 4). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · rect.mergeDirtyRects (cognitive 17) · ×1
  • rect.mergeDirtyRects (cognitive 17) invokeai/frontend/webv2/src/workbench/canvas-engine/math/rect.ts:101 — rect.mergeDirtyRects has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 5, loops 3 (4 pts) (nesting depth added 5). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 2 function items inside it that branch (findMergeablePair, a function literal at line 135). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · MaskLayerController.clear (cognitive 17) · ×1
  • MaskLayerController.clear (cognitive 17) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/maskLayerController.ts:41 — MaskLayerController.clear has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7, boolean chains 5, ternaries 5. Of this number, 14 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · compositeFrame.createCompositeFrame.draw (cognitive 17) · ×1
  • compositeFrame.createCompositeFrame.draw (cognitive 17) invokeai/frontend/webv2/src/workbench/canvas-engine/render/compositeFrame.ts:211 — compositeFrame.createCompositeFrame.draw has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 10, boolean chains 5, if/else 1, loops 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · psdExport.planPsdExport · ×1
  • psdExport.planPsdExport::buildTree (cognitive 17) invokeai/frontend/webv2/src/workbench/canvas-engine/export/psdExport.ts:276 — psdExport.planPsdExport::buildTree has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 pts), ternaries 1 (4 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · paintTool.createPaintTool.onPointerDown (cognitive 17) · ×1
  • paintTool.createPaintTool.onPointerDown (cognitive 17) invokeai/frontend/webv2/src/workbench/canvas-engine/tools/paintTool.ts:322 — paintTool.createPaintTool.onPointerDown has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 6, if/else 5 (6 pts), ternaries 4, error handling 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · executeVideoRecall.resolveVideoRecallMedia (cognitive 17) · ×1
  • executeVideoRecall.resolveVideoRecallMedia (cognitive 17) invokeai/frontend/webv2/src/workbench/image-actions/executeVideoRecall.ts:83 — executeVideoRecall.resolveVideoRecallMedia has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (6 pts), ternaries 4 (5 pts), loops 3, boolean chains 2, error handling 1 (nesting depth added 4). Of this number, 10 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · entries.buildSettingsEntries (cognitive 17) · ×1
  • entries.buildSettingsEntries (cognitive 17) invokeai/frontend/webv2/src/workbench/palette/entries.ts:409 — entries.buildSettingsEntries has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 10 (12 pts), boolean chains 3, if/else 2 (nesting depth added 2). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 417, 509, 508). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · OpenProjectDialog.OpenProjectDialog (cognitive 17) · ×1
  • OpenProjectDialog.OpenProjectDialog (cognitive 17) invokeai/frontend/webv2/src/workbench/projects/components/OpenProjectDialog.tsx:47 — OpenProjectDialog.OpenProjectDialog has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 4 (6 pts), boolean chains 1, error handling 1 (nesting depth added 3). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 63, 120, 137, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · fonts.readEmbeddedFonts (cognitive 17) · ×1
  • fonts.readEmbeddedFonts (cognitive 17) invokeai/frontend/webv2/src/workbench/projects/invk/fonts.ts:109 — fonts.readEmbeddedFonts has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 4, loops 2, ternaries 1 (nesting depth added 4). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HotkeysSettingsSection.canScopesOverlap (cognitive 17) · ×1
  • HotkeysSettingsSection.canScopesOverlap (cognitive 17) invokeai/frontend/webv2/src/workbench/settings/HotkeysSettingsSection.tsx:99 — HotkeysSettingsSection.canScopesOverlap has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, if/else 6 (7 pts), ternaries 1 (2 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · CenterArea.CenterArea (cognitive 17) · ×1
  • CenterArea.CenterArea (cognitive 17) invokeai/frontend/webv2/src/workbench/shell/CenterArea.tsx:86 — CenterArea.CenterArea has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 8 (10 pts), boolean chains 6, if/else 1 (nesting depth added 2). Of this number, 13 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · invokeIssueTargets.getInvocationIssueTarget (cognitive 17) · ×1
  • invokeIssueTargets.getInvocationIssueTarget (cognitive 17) invokeai/frontend/webv2/src/workbench/shell/topbar/invokeIssueTargets.ts:31 — invokeIssueTargets.getInvocationIssueTarget has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 2 (7 pts), boolean chains 1 (nesting depth added 9). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · InvokePopoverBody.InvokePopoverBody (cognitive 17) · ×1
  • InvokePopoverBody.InvokePopoverBody (cognitive 17) invokeai/frontend/webv2/src/workbench/shell/topbar/InvokePopoverBody.tsx:20 — InvokePopoverBody.InvokePopoverBody has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 10 (16 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LayoutPresetStrip.LayoutPresetStrip (cognitive 17) · ×1
  • LayoutPresetStrip.LayoutPresetStrip (cognitive 17) invokeai/frontend/webv2/src/workbench/shell/topbar/LayoutPresetStrip.tsx:86 — LayoutPresetStrip.LayoutPresetStrip has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 7 (8 pts), if/else 7, boolean chains 2 (nesting depth added 1). Most of this is not in the body itself: 6 of the 17 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 207, 109, 146, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ProjectSwitcher.ProjectSwitcher (cognitive 17) · ×1
  • ProjectSwitcher.ProjectSwitcher (cognitive 17) invokeai/frontend/webv2/src/workbench/shell/topbar/ProjectSwitcher.tsx:64 — ProjectSwitcher.ProjectSwitcher has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 8 (10 pts), if/else 6, error handling 1 (nesting depth added 2). Most of this is not in the body itself: 7 of the 17 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 116, 136, 87, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · GenerateCanvasRenderSize.GenerateCanvasRenderSize (cognitive 17) · ×1
  • GenerateCanvasRenderSize.GenerateCanvasRenderSize (cognitive 17) invokeai/frontend/webv2/src/workbench/widgets/canvas/GenerateCanvasRenderSize.tsx:71 — GenerateCanvasRenderSize.GenerateCanvasRenderSize has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 9, boolean chains 4, if/else 4. Most of this is not in the body itself: 6 of the 17 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 140, 114, 88, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · custom_nodes._install_pack (cognitive 16) · ×1
  • custom_nodes._install_pack (cognitive 16) invokeai/app/api/routers/custom_nodes.py:211 — custom_nodes._install_pack has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 2, ternaries 2, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · images.delete_images_from_list (cognitive 16) · ×1
  • images.delete_images_from_list (cognitive 16) invokeai/app/api/routers/images.py:590 — images.delete_images_from_list has cognitive complexity 16 (threshold 15). Drivers by points: error handling 6 (9 pts), if/else 1 (3 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SocketIO._revalidate_socket_users (cognitive 16) · ×1
  • SocketIO._revalidate_socket_users (cognitive 16) invokeai/app/api/sockets.py:464 — SocketIO._revalidate_socket_users has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 4, boolean chains 2, error handling 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FluxDenoiseInvocation._prep_controlnet_extensions (cognitive 16) · ×1
  • FluxDenoiseInvocation._prep_controlnet_extensions (cognitive 16) invokeai/app/invocations/flux/flux_denoise.py:737 — FluxDenoiseInvocation._prep_controlnet_extensions 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.
D2 · Cognitive Complexity · MetadataToLorasCollectionInvocation.invoke (cognitive 16) · ×1
  • MetadataToLorasCollectionInvocation.invoke (cognitive 16) invokeai/app/invocations/metadata_linked.py:939 — MetadataToLorasCollectionInvocation.invoke has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2, ternaries 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · metadata_linked.extract_model_key (cognitive 16) · ×1
  • metadata_linked.extract_model_key (cognitive 16) invokeai/app/invocations/metadata_linked.py:192 — metadata_linked.extract_model_key has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (16 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MiniMaxH3DenoiseInvocation._split_pruned_adaln_patches (cognitive 16) · ×1
  • MiniMaxH3DenoiseInvocation._split_pruned_adaln_patches (cognitive 16) invokeai/app/invocations/minimax_h3/minimax_h3_denoise.py:663 — MiniMaxH3DenoiseInvocation._split_pruned_adaln_patches has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), ternaries 2 (5 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LoRACollectionLoader.invoke (cognitive 16) · ×1
  • LoRACollectionLoader.invoke (cognitive 16) invokeai/app/invocations/model.py:530 — LoRACollectionLoader.invoke has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 2, loops 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DenoiseLatentsInvocation._concat_regional_text_embeddings (cognitive 16) · ×1
  • DenoiseLatentsInvocation._concat_regional_text_embeddings (cognitive 16) invokeai/app/invocations/sd/denoise_latents.py:301 — DenoiseLatentsInvocation._concat_regional_text_embeddings has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IPAdapterInvocation.invoke (cognitive 16) · ×1
  • IPAdapterInvocation.invoke (cognitive 16) invokeai/app/invocations/sd/ip_adapter.py:123 — IPAdapterInvocation.invoke has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (16 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WanRefImageEncoderInvocation.invoke (cognitive 16) · ×1
  • WanRefImageEncoderInvocation.invoke (cognitive 16) invokeai/app/invocations/wan/wan_ref_image_encoder.py:108 — WanRefImageEncoderInvocation.invoke has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (7 pts), ternaries 4 (5 pts), boolean chains 4 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · GalleryMaintenanceService._archive_file (cognitive 16) · ×1
  • GalleryMaintenanceService._archive_file (cognitive 16) invokeai/app/services/gallery_maintenance/gallery_maintenance_default.py:838 — GalleryMaintenanceService._archive_file has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), error handling 4 (7 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · IntermediatesService._worker_loop (cognitive 16) · ×1
  • IntermediatesService._worker_loop (cognitive 16) invokeai/app/services/intermediates/intermediates_default.py:528 — IntermediatesService._worker_loop has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), error handling 2 (5 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InstallStagingLedger.recoverable_installs (cognitive 16) · ×1
  • InstallStagingLedger.recoverable_installs (cognitive 16) invokeai/app/services/model_install/install_staging_ledger.py:822 — InstallStagingLedger.recoverable_installs has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), error handling 1 (2 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelInstallService._download_complete_callback (cognitive 16) · ×1
  • ModelInstallService._download_complete_callback (cognitive 16) invokeai/app/services/model_install/model_install_default.py:2504 — ModelInstallService._download_complete_callback has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelManagerService.reidentify_model (cognitive 16) · ×1
  • ModelManagerService.reidentify_model (cognitive 16) invokeai/app/services/model_manager/model_manager_default.py:72 — ModelManagerService.reidentify_model has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · workflow_call_batch._resolve_float_generator (cognitive 16) · ×1
  • workflow_call_batch._resolve_float_generator (cognitive 16) invokeai/app/services/session_processor/workflow_call_batch.py:235 — workflow_call_batch._resolve_float_generator has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · copy.copy_rows (cognitive 16) · ×1
  • copy.copy_rows (cognitive 16) invokeai/app/services/shared/database/copy.py:38 — copy.copy_rows has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 3 (4 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · gallery._conditions (cognitive 16) · ×1
  • gallery._conditions (cognitive 16) invokeai/app/services/shared/database/queries/gallery.py:153 — gallery._conditions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (14 pts), ternaries 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · GraphExecutionState._get_for_parent (cognitive 16) · ×1
  • GraphExecutionState._get_for_parent (cognitive 16) invokeai/app/services/shared/graph.py:890 — GraphExecutionState._get_for_parent has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _IteratorAncestry.get_frame_iterators (cognitive 16) · ×1
  • _IteratorAncestry.get_frame_iterators (cognitive 16) invokeai/app/services/shared/graph_iterator_ancestry.py:113 — _IteratorAncestry.get_frame_iterators has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · _ExecutionNodeBuilder._get_iteration_axes (cognitive 16) · ×1
  • _ExecutionNodeBuilder._get_iteration_axes (cognitive 16) invokeai/app/services/shared/graph_materializer.py:66 — _ExecutionNodeBuilder._get_iteration_axes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · graph_nested_iterate_planner._prepare_nested_iterate_sequence (cognitive 16) · ×1
  • graph_nested_iterate_planner._prepare_nested_iterate_sequence (cognitive 16) invokeai/app/services/shared/graph_nested_iterate_planner.py:394 — graph_nested_iterate_planner._prepare_nested_iterate_sequence has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Graph._validate_for_loop_linkages (cognitive 16) · ×1
  • Graph._validate_for_loop_linkages (cognitive 16) invokeai/app/services/shared/graph_validation.py:981 — Graph._validate_for_loop_linkages has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 3, boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · migration_2026_10_10_board_roles._board_roles (cognitive 16) · ×1
  • migration_2026_10_10_board_roles._board_roles (cognitive 16) invokeai/app/services/shared/sqlite_migrator/migrations/migration_2026_10_10_board_roles.py:78 — migration_2026_10_10_board_roles._board_roles has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · WorkingMemoryCalibrationService._held_back (cognitive 16) · ×1
  • WorkingMemoryCalibrationService._held_back (cognitive 16) invokeai/app/services/working_memory_calibration/working_memory_calibration_default.py:1568 — WorkingMemoryCalibrationService._held_back has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (6 pts), ternaries 2 (4 pts), boolean chains 3, loops 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · working_memory_calibration_fits.exclusions (cognitive 16) · ×1
  • working_memory_calibration_fits.exclusions (cognitive 16) invokeai/app/services/working_memory_calibration/working_memory_calibration_fits.py:74 — working_memory_calibration_fits.exclusions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 2 (4 pts), loops 3, boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · controlnet_utils.heuristic_resize (cognitive 16) · ×1
  • controlnet_utils.heuristic_resize (cognitive 16) invokeai/app/util/controlnet_utils.py:150 — controlnet_utils.heuristic_resize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · PromptFormatter.normalize_prompt (cognitive 16) · ×1
  • PromptFormatter.normalize_prompt (cognitive 16) invokeai/backend/image_util/pngwriter.py:87 — PromptFormatter.normalize_prompt has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 8. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · Qwen3VLEncoderCheckpointLoader._load_text_encoder (cognitive 16) · ×1
  • Qwen3VLEncoderCheckpointLoader._load_text_encoder (cognitive 16) invokeai/backend/model_manager/load/model_loaders/krea2.py:1082 — Qwen3VLEncoderCheckpointLoader._load_text_encoder has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 5 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · MiniMaxH3CheckpointModel._load_transformer_from_singlefile (cognitive 16) · ×1
  • MiniMaxH3CheckpointModel._load_transformer_from_singlefile (cognitive 16) invokeai/backend/model_manager/load/model_loaders/minimax_h3.py:203 — MiniMaxH3CheckpointModel._load_transformer_from_singlefile has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 2 (3 pts), boolean chains 1, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · qwen_image._build_qwen_image_transformer_config (cognitive 16) · ×1
  • qwen_image._build_qwen_image_transformer_config (cognitive 16) invokeai/backend/model_manager/load/model_loaders/qwen_image.py:93 — qwen_image._build_qwen_image_transformer_config has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), error handling 1 (4 pts), boolean chains 2, loops 1, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PixelDiTModel.load_state_dict (cognitive 16) · ×1
  • PixelDiTModel.load_state_dict (cognitive 16) invokeai/backend/pid/_src/models/pixeldit_model.py:249 — PixelDiTModel.load_state_dict has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PixDiT_T2I.__init__ (cognitive 16) · ×1
  • PixDiT_T2I.__init__ (cognitive 16) invokeai/backend/pid/_src/networks/pixeldit_official.py:1168 — PixDiT_T2I.__init__ has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 8 (11 pts), if/else 3 (4 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ggml_tensor.peak_ggml_linear_dequant_transient_bytes (cognitive 16) · ×1
  • ggml_tensor.peak_ggml_linear_dequant_transient_bytes (cognitive 16) invokeai/backend/quantization/gguf/ggml_tensor.py:262 — ggml_tensor.peak_ggml_linear_dequant_transient_bytes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 1 (4 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StableDiffusionGeneratorPipeline._adjust_memory_efficient_attention (cognitive 16) · ×1
  • StableDiffusionGeneratorPipeline._adjust_memory_efficient_attention (cognitive 16) invokeai/backend/stable_diffusion/diffusers_pipeline.py:170 — StableDiffusionGeneratorPipeline._adjust_memory_efficient_attention has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, error handling 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · StableDiffusionGeneratorPipeline.latents_from_embeddings (cognitive 16) · ×1
  • StableDiffusionGeneratorPipeline.latents_from_embeddings (cognitive 16) invokeai/backend/stable_diffusion/diffusers_pipeline.py:274 — StableDiffusionGeneratorPipeline.latents_from_embeddings has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 3, ternaries 1 (2 pts), loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IPAdapterExt.run_adapters (cognitive 16) · ×1
  • IPAdapterExt.run_adapters (cognitive 16) invokeai/backend/stable_diffusion/extensions/ip_adapter.py:223 — IPAdapterExt.run_adapters has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · counters.fdinfo_vram_bytes (cognitive 16) · ×1
  • counters.fdinfo_vram_bytes (cognitive 16) invokeai/backend/working_memory/counters.py:138 — counters.fdinfo_vram_bytes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), error handling 2 (3 pts), ternaries 1 (3 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · fit.upper_envelope (cognitive 16) · ×1
  • fit.upper_envelope (cognitive 16) invokeai/backend/working_memory/fit.py:353 — fit.upper_envelope has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3 (4 pts), boolean chains 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MediaImportProcessor.select_board_option (cognitive 16) · ×1
  • MediaImportProcessor.select_board_option (cognitive 16) invokeai/frontend/install/import_images.py:514 — MediaImportProcessor.select_board_option has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · build_shipped.merge_points (cognitive 16) · ×1
  • build_shipped.merge_points (cognitive 16) scripts/working_memory/build_shipped.py:423 — build_shipped.merge_points has cognitive complexity 16 (threshold 15). Drivers by points: loops 5 (7 pts), if/else 2 (5 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · promptAST.serializeCore (cognitive 16) · ×1
  • promptAST.serializeCore (cognitive 16) invokeai/frontend/webv1/src/common/util/promptAST.ts:801 — promptAST.serializeCore has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · useMediaCookieRefresh.useMediaCookieRefresh (cognitive 16) · ×1
  • useMediaCookieRefresh.useMediaCookieRefresh (cognitive 16) invokeai/frontend/webv1/src/features/auth/hooks/useMediaCookieRefresh.ts:68 — useMediaCookieRefresh.useMediaCookieRefresh has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, boolean chains 3, loops 1. None of this is in the body itself: all 16 points belong to 7 function literals inside it that branch (lines 99, 136, 151, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · RefImagePreview.RefImagePreview (cognitive 16) · ×1
  • RefImagePreview.RefImagePreview (cognitive 16) invokeai/frontend/webv1/src/features/controlLayers/components/RefImage/RefImagePreview.tsx:79 — RefImagePreview.RefImagePreview has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, ternaries 4 (5 pts), if/else 3 (nesting depth added 1). Of this number, 12 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · CanvasToolbarSnapshotMenuButton.CanvasToolbarSnapshotMenuButton (cognitive 16) · ×1
  • CanvasToolbarSnapshotMenuButton.CanvasToolbarSnapshotMenuButton (cognitive 16) invokeai/frontend/webv1/src/features/controlLayers/components/Toolbar/CanvasToolbarSnapshotMenuButton.tsx:80 — CanvasToolbarSnapshotMenuButton.CanvasToolbarSnapshotMenuButton has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 3 (nesting depth added 1). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 6 function literals inside it that branch (lines 139, 93, 105, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · useCanvasProjectLoad.useCanvasProjectLoad.loadCanvasProject (cognitive 16) · ×1
  • useCanvasProjectLoad.useCanvasProjectLoad.loadCanvasProject (cognitive 16) invokeai/frontend/webv1/src/features/controlLayers/hooks/useCanvasProjectLoad.ts:31 — useCanvasProjectLoad.useCanvasProjectLoad.loadCanvasProject has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), error handling 2 (3 pts), boolean chains 1, loops 1 (nesting depth added 3). Of this number, 10 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · CanvasEntityTransformer.syncInteractionState (cognitive 16) · ×1
  • CanvasEntityTransformer.syncInteractionState (cognitive 16) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityTransformer.ts:664 — CanvasEntityTransformer.syncInteractionState has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 3 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · filters.AdjustmentsSimpleFilter (cognitive 16) · ×1
  • filters.AdjustmentsSimpleFilter (cognitive 16) invokeai/frontend/webv1/src/features/controlLayers/konva/filters.ts:33 — filters.AdjustmentsSimpleFilter has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (10 pts), ternaries 3, if/else 2, boolean chains 1 (nesting depth added 6). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · state.handleDeletions (cognitive 16) · ×1
  • state.handleDeletions (cognitive 16) invokeai/frontend/webv1/src/features/deleteVideoModal/store/state.ts:78 — state.handleDeletions has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 3 (7 pts), if/else 4 (5 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · actions.newCanvasFromImage (cognitive 16) · ×1
  • actions.newCanvasFromImage (cognitive 16) invokeai/frontend/webv1/src/features/imageActions/actions.ts:178 — actions.newCanvasFromImage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, match/switch 1 (nesting depth added 5). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelList.ModelList (cognitive 16) · ×1
  • ModelList.ModelList (cognitive 16) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelManagerPanel/ModelList.tsx:40 — ModelList.ModelList has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, boolean chains 3, error handling 2, ternaries 2, loops 1. Most of this is not in the body itself: 4 of the 16 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 99, 153, 63, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · WorkflowListItem.WorkflowListItem (cognitive 16) · ×1
  • WorkflowListItem.WorkflowListItem (cognitive 16) invokeai/frontend/webv1/src/features/nodes/components/sidePanel/workflow/WorkflowLibrary/WorkflowListItem.tsx:36 — WorkflowListItem.WorkflowListItem has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 13, if/else 2, ternaries 1. Of this number, 12 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · fieldValidators.validateStringFieldCollectionValue (cognitive 16) · ×1
  • fieldValidators.validateStringFieldCollectionValue (cognitive 16) invokeai/frontend/webv1/src/features/nodes/store/util/fieldValidators.ts:83 — fieldValidators.validateStringFieldCollectionValue has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 5, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · fieldValidators.syncNodeErrors (cognitive 16) · ×1
  • fieldValidators.syncNodeErrors (cognitive 16) invokeai/frontend/webv1/src/features/nodes/store/util/fieldValidators.ts:305 — fieldValidators.syncNodeErrors has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · resolveBatchValue.resolveBatchValue (cognitive 16) · ×1
  • resolveBatchValue.resolveBatchValue (cognitive 16) invokeai/frontend/webv1/src/features/nodes/util/node/resolveBatchValue.ts:46 — resolveBatchValue.resolveBatchValue has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4 (nesting depth added 4). Of this number, 12 points are the body's own statements and 4 belong to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SettingsModal.SettingsModal (cognitive 16) · ×1
  • SettingsModal.SettingsModal (cognitive 16) invokeai/frontend/webv1/src/features/system/components/SettingsModal/SettingsModal.tsx:79 — SettingsModal.SettingsModal has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 5, if/else 5, ternaries 5, error handling 1. Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 133, 126, 273). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · queries.fetchVerifiedGalleryItemPage (cognitive 16) · ×1
  • queries.fetchVerifiedGalleryItemPage (cognitive 16) invokeai/frontend/webv2/src/features/gallery/data/queries.ts:871 — queries.fetchVerifiedGalleryItemPage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), error handling 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GalleryWidgetContext.createSelectionStarStore.reconcilePatch (cognitive 16) · ×1
  • GalleryWidgetContext.createSelectionStarStore.reconcilePatch (cognitive 16) invokeai/frontend/webv2/src/features/gallery/ui/GalleryWidgetContext.tsx:142 — GalleryWidgetContext.createSelectionStarStore.reconcilePatch has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · baseGenerationPolicies.getDimensionValidationIssues (cognitive 16) · ×1
  • baseGenerationPolicies.getDimensionValidationIssues (cognitive 16) invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:2260 — baseGenerationPolicies.getDimensionValidationIssues has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (8 pts), if/else 3 (4 pts), boolean chains 3, loops 1 (nesting depth added 3). Of this number, 14 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PromptParser.parseUnquotedPromptFunction (cognitive 16) · ×1
  • PromptParser.parseUnquotedPromptFunction (cognitive 16) invokeai/frontend/webv2/src/features/generation/core/prompt/ast.ts:502 — PromptParser.parseUnquotedPromptFunction has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GenerateDimensionFields.GenerateDimensionFields · ×1
  • GenerateDimensionFields.GenerateDimensionFields::renderSection (cognitive 16) invokeai/frontend/webv2/src/features/generation/ui/GenerateDimensionFields.tsx:621 — GenerateDimensionFields.GenerateDimensionFields::renderSection has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 12, boolean chains 4. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · OperationPanel.OperationPanel (cognitive 16) · ×1
  • OperationPanel.OperationPanel (cognitive 16) invokeai/frontend/webv2/src/features/intermediates/ui/OperationPanel.tsx:73 — OperationPanel.OperationPanel has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 10 (14 pts), if/else 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkingMemoryParts.LineStateBadge (cognitive 16) · ×1
  • WorkingMemoryParts.LineStateBadge (cognitive 16) invokeai/frontend/webv2/src/features/models/ui/detail/WorkingMemoryParts.tsx:29 — WorkingMemoryParts.LineStateBadge has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (16 pts) (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · videoPolicies.getVideoDimensions (cognitive 16) · ×1
  • videoPolicies.getVideoDimensions (cognitive 16) invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:580 — videoPolicies.getVideoDimensions has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 8 (15 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · batch.resolveWorkflowGeneratorValue (cognitive 16) · ×1
  • batch.resolveWorkflowGeneratorValue (cognitive 16) invokeai/frontend/webv2/src/features/workflow/core/batch.ts:556 — batch.resolveWorkflowGeneratorValue has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (12 pts), if/else 2, boolean chains 1, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · document.updateWorkflowNodes (cognitive 16) · ×1
  • document.updateWorkflowNodes (cognitive 16) invokeai/frontend/webv2/src/features/workflow/core/document.ts:582 — document.updateWorkflowNodes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2, boolean chains 1, ternaries 1 (nesting depth added 5). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · api.toWorkflowLibraryWriteRefusal (cognitive 16) · ×1
  • api.toWorkflowLibraryWriteRefusal (cognitive 16) invokeai/frontend/webv2/src/features/workflow/data/api.ts:156 — api.toWorkflowLibraryWriteRefusal has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, ternaries 4 (7 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · PendingLibraryWorkflowLoader.PendingWorkflowLoader (cognitive 16) · ×1
  • PendingLibraryWorkflowLoader.PendingWorkflowLoader (cognitive 16) invokeai/frontend/webv2/src/features/workflow/ui/PendingLibraryWorkflowLoader.tsx:28 — PendingLibraryWorkflowLoader.PendingWorkflowLoader has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 3 (5 pts), error handling 1 (nesting depth added 4). None of this is in the body itself: all 16 points belong to one function literal inside it that branches (line 36). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · useEraser.getIntersectingEdgeIds (cognitive 16) · ×1
  • useEraser.getIntersectingEdgeIds (cognitive 16) invokeai/frontend/webv2/src/features/workflow/ui/editor/useEraser.tsx:50 — useEraser.getIntersectingEdgeIds has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (3 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkflowFieldInput.ScalarCollectionInput (cognitive 16) · ×1
  • WorkflowFieldInput.ScalarCollectionInput (cognitive 16) invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:1605 — WorkflowFieldInput.ScalarCollectionInput has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 10 (13 pts), boolean chains 2, if/else 1 (nesting depth added 3). Most of this is not in the body itself: 6 of the 16 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 1633, 1647, 1617, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · DropZone.DropZone (cognitive 16) · ×1
  • DropZone.DropZone (cognitive 16) invokeai/frontend/webv2/src/platform/ui/DropZone.tsx:25 — DropZone.DropZone has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 10 (12 pts), boolean chains 4 (nesting depth added 2). Of this number, 11 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Select.Select (cognitive 16) · ×1
  • Select.Select (cognitive 16) invokeai/frontend/webv2/src/platform/ui/Select.tsx:76 — Select.Select has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 8 (14 pts), boolean chains 2 (nesting depth added 6). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 128, 130, 150). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · indexedDbDraftStore.createIndexedDbProjectDraftStore.adopt (cognitive 16) · ×1
  • indexedDbDraftStore.createIndexedDbProjectDraftStore.adopt (cognitive 16) invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:364 — indexedDbDraftStore.createIndexedDbProjectDraftStore.adopt has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, if/else 6, ternaries 2 (4 pts) (nesting depth added 2). Most of this is not in the body itself: 4 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 370). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · projectWorkflows.normalizeProjectWorkflowCollection (cognitive 16) · ×1
  • projectWorkflows.normalizeProjectWorkflowCollection (cognitive 16) invokeai/frontend/webv2/src/workbench/projectWorkflows.ts:144 — projectWorkflows.normalizeProjectWorkflowCollection has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · useCanvasRecovery.useStagingRecovery (cognitive 16) · ×1
  • useCanvasRecovery.useStagingRecovery (cognitive 16) invokeai/frontend/webv2/src/workbench/widgets/canvas/useCanvasRecovery.ts:139 — useCanvasRecovery.useStagingRecovery has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 3, boolean chains 1, loops 1 (nesting depth added 1). None of this is in the body itself: all 16 points belong to 4 function literals inside it that branch (lines 205, 160, 183, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · mutationContext.createCanvasMutationContext.begin.publish (cognitive 16) · ×1
  • mutationContext.createCanvasMutationContext.begin.publish (cognitive 16) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mutationContext.ts:363 — mutationContext.createCanvasMutationContext.begin.publish has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, error handling 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · floatingWindows.commitChangedAxes (cognitive 16) · ×1
  • floatingWindows.commitChangedAxes (cognitive 16) invokeai/frontend/webv2/src/workbench/floatingWindows.ts:79 — floatingWindows.commitChangedAxes has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (9 pts), boolean chains 7 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FloatingSelectionController.lift (cognitive 16) · ×1
  • FloatingSelectionController.lift (cognitive 16) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/floatingSelectionController.ts:116 — FloatingSelectionController.lift has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, error handling 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ThumbnailController.request (cognitive 16) · ×1
  • ThumbnailController.request (cognitive 16) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/thumbnailController.ts:142 — ThumbnailController.request has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6, boolean chains 5, ternaries 3 (4 pts), error handling 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · fontLoader.createFontLoader.setActiveSources (cognitive 16) · ×1
  • fontLoader.createFontLoader.setActiveSources (cognitive 16) invokeai/frontend/webv2/src/workbench/canvas-engine/render/fontLoader.ts:231 — fontLoader.createFontLoader.setActiveSources has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 5, boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ControlDetectionCoordinator.createControlDetectionCoordinator.reconcileWithDocument (cognitive 16) · ×1
  • ControlDetectionCoordinator.createControlDetectionCoordinator.reconcileWithDocument (cognitive 16) invokeai/frontend/webv2/src/workbench/canvas-operations/ControlDetectionCoordinator.ts:555 — ControlDetectionCoordinator.createControlDetectionCoordinator.reconcileWithDocument has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 4, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · selectObjectSession.createSelectObjectSession.update (cognitive 16) · ×1
  • selectObjectSession.createSelectObjectSession.update (cognitive 16) invokeai/frontend/webv2/src/workbench/canvas-operations/selectObjectSession.ts:535 — selectObjectSession.createSelectObjectSession.update has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, if/else 4, ternaries 3. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · SelectObjectCoordinator.createSelectObjectOperationCoordinator.apply (cognitive 16) · ×1
  • SelectObjectCoordinator.createSelectObjectOperationCoordinator.apply (cognitive 16) invokeai/frontend/webv2/src/workbench/canvas-operations/SelectObjectCoordinator.ts:276 — SelectObjectCoordinator.createSelectObjectOperationCoordinator.apply has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 1 (2 pts), boolean chains 1, error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · OpenProjectsControl.OpenProjectsNavSection (cognitive 16) · ×1
  • OpenProjectsControl.OpenProjectsNavSection (cognitive 16) invokeai/frontend/webv2/src/workbench/launchpad/OpenProjectsControl.tsx:64 — OpenProjectsControl.OpenProjectsNavSection has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 7 (11 pts), boolean chains 3, if/else 2 (nesting depth added 4). Of this number, 10 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · usePaletteNavigation.usePaletteNavigation.onSearchKeyDown (cognitive 16) · ×1
  • usePaletteNavigation.usePaletteNavigation.onSearchKeyDown (cognitive 16) invokeai/frontend/webv2/src/workbench/palette/usePaletteNavigation.ts:157 — usePaletteNavigation.usePaletteNavigation.onSearchKeyDown has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · SettingsDialog.SettingsDialog (cognitive 16) · ×1
  • SettingsDialog.SettingsDialog (cognitive 16) invokeai/frontend/webv2/src/workbench/settings/SettingsDialog.tsx:74 — SettingsDialog.SettingsDialog has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 9 (10 pts), if/else 4, boolean chains 2 (nesting depth added 1). Of this number, 9 points are the body's own statements and 7 belong to 5 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · useInvocationState.useInvocationState (cognitive 16) · ×1
  • useInvocationState.useInvocationState (cognitive 16) invokeai/frontend/webv2/src/workbench/shell/topbar/useInvocationState.ts:135 — useInvocationState.useInvocationState has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 10 (14 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · QueueCluster.QueueProgressAnnouncement (cognitive 16) · ×1
  • QueueCluster.QueueProgressAnnouncement (cognitive 16) invokeai/frontend/webv2/src/workbench/shell/topbar/QueueCluster.tsx:271 — QueueCluster.QueueProgressAnnouncement has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (16 pts) (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · TextOptions.FontAxisSettings (cognitive 16) · ×1
  • TextOptions.FontAxisSettings (cognitive 16) invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/TextOptions.tsx:381 — TextOptions.FontAxisSettings has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, ternaries 5, boolean chains 4. Most of this is not in the body itself: 4 of the 16 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 422, 408, 394, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ControlAdapterRows.ControlAdapterRows (cognitive 16) · ×1
  • ControlAdapterRows.ControlAdapterRows (cognitive 16) invokeai/frontend/webv2/src/workbench/widgets/layers/ControlAdapterRows.tsx:41 — ControlAdapterRows.ControlAdapterRows has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 8 (9 pts), if/else 5, boolean chains 2 (nesting depth added 1). Of this number, 9 points are the body's own statements and 7 belong to 5 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D35 · Change Coupling · Change coupling clique · ×1
  • Change coupling clique: flux_vae_decode.py, latents_to_image.py, sd3_latents_to_image.py invokeai/app/invocations/flux_vae_decode.py — 3 files — `invokeai/app/invocations/flux_vae_decode.py`, `invokeai/app/invocations/latents_to_image.py`, `invokeai/app/invocations/sd3_latents_to_image.py` — all change together with no explicit dependency: a fully-connected co-change clique, not 3 separate couplings. They share one concern (thin parallel siblings over a common abstraction), so extract the shared part into ONE unit and the whole clique's coupling clears at once — you do not need to break each pair individually.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Near-duplicate member family (7 members, 51 shared lines) · ×1
  • Near-duplicate member family (7 members, 51 shared lines) invokeai/app/invocations/pid/flux2_pid_decode.py:103 — invokeai/app/invocations/pid/flux2_pid_decode.py:103-201 | invokeai/app/invocations/pid/flux_pid_decode.py:85-170 | invokeai/app/invocations/pid/pid_upscale.py:106-209 | invokeai/app/invocations/pid/qwen_image_pid_decode.py:101-199 | invokeai/app/invocations/pid/sd3_pid_decode.py:83-164 | invokeai/app/invocations/pid/sdxl_pid_decode.py:96-182 | invokeai/app/invocations/pid/z_image_pid_decode.py:97-192 — These 7 members are variants of one another: a block of 51 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 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication · Near-duplicate member family (3 members, 9 shared lines) · ×1
  • Near-duplicate member family (3 members, 9 shared lines) invokeai/backend/flux/custom_block_processor.py:24 — invokeai/backend/flux/custom_block_processor.py:24-59 | invokeai/backend/flux/ip_adapter/ip_double_stream_block_processor.py:41-93 | invokeai/backend/flux/modules/layers.py:156-188 — These 3 members are variants of one another: a block of 9 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 3 times.
D4 · Code Duplication · Near-duplicate member pair (114 shared lines) · ×1
  • Near-duplicate member pair (114 shared lines) invokeai/app/invocations/wan/wan_denoise.py:425 — invokeai/app/invocations/wan/wan_denoise.py:425-731 | invokeai/app/invocations/wan/wan_video_denoise.py:158-394 — These two members are variants of one another: 114 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (80 shared lines) · ×1
  • Near-duplicate member pair (80 shared lines) invokeai/backend/pid/_src/networks/pid_net.py:290 — invokeai/backend/pid/_src/networks/pid_net.py:290-495 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1413-1532 — These two members are variants of one another: 80 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (59 shared lines) · ×1
  • Near-duplicate member pair (59 shared lines) invokeai/backend/quantization/scripts/load_flux_model_bnb_llm_int8.py:14 — invokeai/backend/quantization/scripts/load_flux_model_bnb_llm_int8.py:14-76 | invokeai/backend/quantization/scripts/load_flux_model_bnb_nf4.py:27-93 — These two members are variants of one another: 59 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (30 shared lines) · ×1
  • Near-duplicate member pair (30 shared lines) invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:82 — invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:82-128 | invokeai/app/invocations/z_image/z_image_lora_loader.py:58-101 — These two members are variants of one another: 30 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (24 shared lines) · ×1
  • Near-duplicate member pair (24 shared lines) scripts/calibrate_flux2_denoise_working_memory.py:425 — scripts/calibrate_flux2_denoise_working_memory.py:425-461 | scripts/calibrate_flux3_denoise_working_memory.py:598-645 — These two members are variants of one another: 24 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (22 shared lines) · ×1
  • Near-duplicate member pair (22 shared lines) invokeai/app/invocations/model.py:531 — invokeai/app/invocations/model.py:531-559 | invokeai/app/invocations/model.py:691-726 — These two members are variants of one another: 22 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Edited copy of a member (23 corresponding lines) · ×1
  • Edited copy of a member (23 corresponding lines) invokeai/backend/wan/extensions/wan_ref_image_extension.py:49 — invokeai/backend/wan/extensions/wan_ref_image_extension.py:49-75 | invokeai/backend/wan/extensions/wan_ref_image_extension.py:86-118 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Members sharing a duplicated core (9 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (9 members, 50+ identical tokens) invokeai/app/invocations/anima/anima_denoise.py:256 — invokeai/app/invocations/anima/anima_denoise.py:256-277 | invokeai/app/invocations/cogview4/cogview4_denoise.py:81-113 | invokeai/app/invocations/flux/flux_denoise.py:697-735 | invokeai/app/invocations/flux2/flux2_denoise.py:588-604 | invokeai/app/invocations/krea2/krea2_denoise.py:229-241 | invokeai/app/invocations/qwen_image/qwen_image_denoise.py:160-174 | invokeai/app/invocations/sd3/sd3_denoise.py:81-113 | invokeai/app/invocations/wan/wan_denoise.py:786-802 | invokeai/app/invocations/z_image/z_image_denoise.py:157-174 — These 9 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 9 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 9 times.
D4 · Code Duplication · Duplicated block (67–70 lines × 2) · ×1
  • Duplicated block (67–70 lines × 2) invokeai/backend/flux/denoise.py:212 — invokeai/backend/flux/denoise.py:212-281 | invokeai/backend/flux2/denoise.py:184-250 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (39–51 lines × 2) · ×1
  • Duplicated block (39–51 lines × 2) invokeai/app/services/shared/invocation_context.py:280 — invokeai/app/services/shared/invocation_context.py:280-330 | invokeai/app/services/shared/invocation_context.py:456-494 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (25–50 lines × 2) · ×1
  • Duplicated block (25–50 lines × 2) invokeai/app/invocations/wan/wan_denoise.py:594 — invokeai/app/invocations/wan/wan_denoise.py:594-643 | invokeai/app/invocations/wan/wan_video_denoise.py:273-297 — before extracting anything, compare `invokeai/app/invocations/wan/wan_denoise.py` and `invokeai/app/invocations/wan/wan_video_denoise.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 150 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/wan/wan_denoise.py:594` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (46–47 lines × 2) · ×1
  • Duplicated block (46–47 lines × 2) invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:153 — invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py:153-199 | invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py:152-197 — before extracting anything, compare `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_large.py` and `invokeai/backend/image_util/mlsd/models/mbv2_mlsd_tiny.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 161 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (43 lines × 2) · ×1
  • Duplicated block (43 lines × 2) invokeai/app/invocations/cogview4/cogview4_denoise.py:239 — invokeai/app/invocations/cogview4/cogview4_denoise.py:239-281 | invokeai/app/invocations/sd3/sd3_denoise.py:229-271 — `invokeai/app/invocations/cogview4/cogview4_denoise.py` and `invokeai/app/invocations/sd3/sd3_denoise.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 126 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (38–42 lines × 7) · ×1
  • Duplicated block (38–42 lines × 7) invokeai/app/invocations/pid/flux2_pid_decode.py:130 — invokeai/app/invocations/pid/flux2_pid_decode.py:130-169 | invokeai/app/invocations/pid/flux_pid_decode.py:100-138 | invokeai/app/invocations/pid/pid_upscale.py:140-177 | invokeai/app/invocations/pid/qwen_image_pid_decode.py:130-167 | invokeai/app/invocations/pid/sd3_pid_decode.py:95-132 | invokeai/app/invocations/pid/sdxl_pid_decode.py:113-150 | invokeai/app/invocations/pid/z_image_pid_decode.py:110-151 — before extracting anything, compare `invokeai/app/invocations/pid/flux2_pid_decode.py` and `invokeai/app/invocations/pid/flux_pid_decode.py` 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. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/pid/flux2_pid_decode.py:130` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (42 lines × 2) · ×1
  • Duplicated block (42 lines × 2) invokeai/backend/image_util/segment_anything/segment_anything_2_pipeline.py:42 — invokeai/backend/image_util/segment_anything/segment_anything_2_pipeline.py:42-83 | invokeai/backend/image_util/segment_anything/segment_anything_pipeline.py:36-77 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (28–39 lines × 2) · ×1
  • Duplicated block (28–39 lines × 2) invokeai/backend/anima/regional_prompting.py:78 — invokeai/backend/anima/regional_prompting.py:78-105 | invokeai/backend/z_image/extensions/regional_prompting_extension.py:67-105 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `regional_text_conditioning` to `AnimaRegionalTextConditioning` in one and `ZImageRegionalTextConditioning` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (38 lines × 2) · ×1
  • Duplicated block (38 lines × 2) invokeai/backend/tiles/tiles.py:233 — invokeai/backend/tiles/tiles.py:233-270 | invokeai/backend/tiles/tiles.py:344-381 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/tiles/tiles.py:233` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `invokeai/backend/tiles/tiles.py:273` calls `linspace`, `expand_dims` and `invokeai/backend/tiles/tiles.py:383` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (25–37 lines × 3) · ×1
  • Duplicated block (25–37 lines × 3) invokeai/backend/patches/lora_conversions/qwen_image_lora_conversion_utils.py:168 — invokeai/backend/patches/lora_conversions/qwen_image_lora_conversion_utils.py:168-193 | invokeai/backend/patches/lora_conversions/wan_lora_conversion_utils.py:219-243 | invokeai/backend/patches/lora_conversions/z_image_lora_conversion_utils.py:214-250 — before extracting anything, compare `invokeai/backend/patches/lora_conversions/qwen_image_lora_conversion_utils.py` and `invokeai/backend/patches/lora_conversions/wan_lora_conversion_utils.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 72 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (31–33 lines × 2) · ×1
  • Duplicated block (31–33 lines × 2) invokeai/backend/minimax_h3/sampling.py:234 — invokeai/backend/minimax_h3/sampling.py:234-264 | invokeai/backend/minimax_h3/sampling.py:394-426 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/minimax_h3/sampling.py:394` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (27–33 lines × 2) · ×1
  • Duplicated block (27–33 lines × 2) invokeai/backend/model_manager/load/model_loaders/krea2.py:688 — invokeai/backend/model_manager/load/model_loaders/krea2.py:688-720 | invokeai/backend/model_manager/load/model_loaders/z_image.py:663-689 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/model_manager/load/model_loaders/krea2.py:688` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (26–32 lines × 2) · ×1
  • Duplicated block (26–32 lines × 2) invokeai/backend/model_manager/load/model_loaders/anima.py:193 — invokeai/backend/model_manager/load/model_loaders/anima.py:193-224 | invokeai/backend/model_manager/load/model_loaders/ideogram4.py:438-463 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/model_manager/load/model_loaders/anima.py:193` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/backend/model_manager/load/model_loaders/anima.py:190` calls `info` and `invokeai/backend/model_manager/load/model_loaders/ideogram4.py:437` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (30–32 lines × 2) · ×1
  • Duplicated block (30–32 lines × 2) invokeai/backend/patches/lora_conversions/flux_bfl_peft_lora_conversion_utils.py:185 — invokeai/backend/patches/lora_conversions/flux_bfl_peft_lora_conversion_utils.py:185-214 | invokeai/backend/patches/lora_conversions/flux_bfl_peft_lora_conversion_utils.py:227-258 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (30–31 lines × 4) · ×1
  • Duplicated block (30–31 lines × 4) invokeai/backend/hidiffusion/hidiffusion.py:1558 — invokeai/backend/hidiffusion/hidiffusion.py:1558-1587 | invokeai/backend/hidiffusion/hidiffusion.py:1692-1722 | invokeai/backend/hidiffusion/hidiffusion.py:1829-1858 | invokeai/backend/hidiffusion/hidiffusion.py:1910-1939 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (31 lines × 2) · ×1
  • Duplicated block (31 lines × 2) invokeai/backend/model_manager/load/model_loaders/flux2_state_dict_utils.py:285 — invokeai/backend/model_manager/load/model_loaders/flux2_state_dict_utils.py:285-315 | invokeai/backend/model_manager/load/model_loaders/flux2_state_dict_utils.py:332-362 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (29–31 lines × 2) · ×1
  • Duplicated block (29–31 lines × 2) invokeai/backend/model_manager/load/model_loaders/z_image.py:361 — invokeai/backend/model_manager/load/model_loaders/z_image.py:361-389 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1708-1738 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/model_manager/load/model_loaders/z_image.py:361` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `invokeai/backend/model_manager/load/model_loaders/z_image.py:1739` calls `info` and `invokeai/backend/model_manager/load/model_loaders/z_image.py:390` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (17–30 lines × 3) · ×1
  • Duplicated block (17–30 lines × 3) invokeai/backend/model_manager/load/model_loaders/anima.py:195 — invokeai/backend/model_manager/load/model_loaders/anima.py:195-224 | invokeai/backend/model_manager/load/model_loaders/ideogram4.py:440-463 | invokeai/backend/model_manager/load/model_loaders/qwen_image_2_1.py:259-275 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/model_manager/load/model_loaders/anima.py:195` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (27–30 lines × 2) · ×1
  • Duplicated block (27–30 lines × 2) invokeai/app/invocations/anima/anima_denoise.py:704 — invokeai/app/invocations/anima/anima_denoise.py:704-733 | invokeai/app/invocations/z_image/z_image_denoise.py:352-378 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/app/invocations/anima/anima_denoise.py:700` calls `unsqueeze` and `invokeai/app/invocations/z_image/z_image_denoise.py:348` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (24–30 lines × 2) · ×1
  • Duplicated block (24–30 lines × 2) invokeai/backend/minimax_h3/packing.py:188 — invokeai/backend/minimax_h3/packing.py:188-211 | invokeai/backend/minimax_h3/presets.py:43-72 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (28–30 lines × 2) · ×1
  • Duplicated block (28–30 lines × 2) invokeai/backend/model_manager/load/model_loaders/flux.py:839 — invokeai/backend/model_manager/load/model_loaders/flux.py:839-866 | invokeai/backend/model_manager/load/model_loaders/flux.py:1230-1259 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (26–29 lines × 2) · ×1
  • Duplicated block (26–29 lines × 2) invokeai/app/invocations/vae/flux_vae_decode.py:121 — invokeai/app/invocations/vae/flux_vae_decode.py:121-146 | invokeai/app/invocations/vae/z_image_latents_to_image.py:130-158 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (24–29 lines × 2) · ×1
  • Duplicated block (24–29 lines × 2) invokeai/backend/minimax_h3/transformer_minimax_h3.py:614 — invokeai/backend/minimax_h3/transformer_minimax_h3.py:614-642 | invokeai/backend/minimax_h3/transformer_minimax_h3_pruned.py:216-239 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (22–28 lines × 3) · ×1
  • Duplicated block (22–28 lines × 3) invokeai/backend/model_manager/configs/main.py:979 — invokeai/backend/model_manager/configs/main.py:979-1000 | invokeai/backend/model_manager/configs/main.py:1051-1078 | invokeai/backend/model_manager/configs/main.py:1415-1438 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/model_manager/configs/main.py:1051` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (19–27 lines × 2) · ×1
  • Duplicated block (19–27 lines × 2) invokeai/app/invocations/vae/flux2_vae_decode.py:102 — invokeai/app/invocations/vae/flux2_vae_decode.py:102-120 | invokeai/app/invocations/vae/z_image_latents_to_image.py:127-153 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/app/invocations/vae/z_image_latents_to_image.py:126` calls `inference_mode` and `invokeai/app/invocations/vae/flux2_vae_decode.py:99` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (22–27 lines × 2) · ×1
  • Duplicated block (22–27 lines × 2) invokeai/backend/flux/extensions/kontext_extension.py:192 — invokeai/backend/flux/extensions/kontext_extension.py:192-218 | invokeai/backend/flux2/ref_image_extension.py:313-334 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (18–26 lines × 3) · ×1
  • Duplicated block (18–26 lines × 3) invokeai/app/invocations/vae/flux2_vae_decode.py:104 — invokeai/app/invocations/vae/flux2_vae_decode.py:104-121 | invokeai/app/invocations/vae/flux_vae_decode.py:120-142 | invokeai/app/invocations/vae/z_image_latents_to_image.py:129-154 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/app/invocations/vae/z_image_latents_to_image.py:126` calls `inference_mode` and `invokeai/app/invocations/vae/flux2_vae_decode.py:99` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (26 lines × 2) · ×1
  • Duplicated block (26 lines × 2) invokeai/app/services/shared/graph_iterate_planner.py:44 — invokeai/app/services/shared/graph_iterate_planner.py:44-69 | invokeai/app/services/shared/graph_iterate_planner.py:94-119 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (15–26 lines × 2) · ×1
  • Duplicated block (15–26 lines × 2) invokeai/backend/flux/extensions/regional_prompting_extension.py:178 — invokeai/backend/flux/extensions/regional_prompting_extension.py:178-203 | invokeai/backend/flux2/extensions/regional_prompting_extension.py:104-118 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/flux/extensions/regional_prompting_extension.py:178` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (24–25 lines × 3) · ×1
  • Duplicated block (24–25 lines × 3) invokeai/backend/model_manager/load/model_loaders/z_image.py:436 — invokeai/backend/model_manager/load/model_loaders/z_image.py:436-459 | invokeai/backend/model_manager/load/model_loaders/z_image.py:781-805 | invokeai/backend/model_manager/load/model_loaders/z_image.py:904-927 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note first that the copies are not typed on the same thing: the declarations holding them bind `config` to `AnyModelConfig` in one and `Main_SDNQ_ZImage_Config` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/backend/model_manager/load/model_loaders/z_image.py:899` calls `detect`, `strip` and `invokeai/backend/model_manager/load/model_loaders/z_image.py:431` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (3–25 lines × 3) · ×1
  • Duplicated block (3–25 lines × 3) invokeai/backend/flux/controlnet/instantx_controlnet_flux.py:64 — invokeai/backend/flux/controlnet/instantx_controlnet_flux.py:64-88 | invokeai/backend/flux/controlnet/xlabs_controlnet_flux.py:44-46 | invokeai/backend/flux/model.py:62-86 — before extracting anything, compare `invokeai/backend/flux/controlnet/instantx_controlnet_flux.py` and `invokeai/backend/flux/controlnet/xlabs_controlnet_flux.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/flux/controlnet/xlabs_controlnet_flux.py:44` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (13–25 lines × 2) · ×1
  • Duplicated block (13–25 lines × 2) invokeai/backend/flux/extensions/regional_prompting_extension.py:271 — invokeai/backend/flux/extensions/regional_prompting_extension.py:271-295 | invokeai/backend/flux2/extensions/regional_prompting_extension.py:162-174 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (24–25 lines × 2) · ×1
  • Duplicated block (24–25 lines × 2) invokeai/backend/minimax_h3/sampling.py:208 — invokeai/backend/minimax_h3/sampling.py:208-232 | invokeai/backend/minimax_h3/sampling.py:365-388 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/minimax_h3/sampling.py:208` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/backend/minimax_h3/sampling.py:364` calls `cat`, `MiniMaxH3Scheduler` and `invokeai/backend/minimax_h3/sampling.py:208` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (22–24 lines × 3) · ×1
  • Duplicated block (22–24 lines × 3) invokeai/backend/model_manager/load/model_loaders/z_image.py:354 — invokeai/backend/model_manager/load/model_loaders/z_image.py:354-375 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1516-1539 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1700-1723 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/model_manager/load/model_loaders/z_image.py:354` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (21–24 lines × 2) · ×1
  • Duplicated block (21–24 lines × 2) invokeai/app/invocations/wan/wan_denoise.py:439 — invokeai/app/invocations/wan/wan_denoise.py:439-459 | invokeai/app/invocations/wan/wan_video_denoise.py:183-206 — before extracting anything, compare `invokeai/app/invocations/wan/wan_denoise.py` and `invokeai/app/invocations/wan/wan_video_denoise.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 150 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (20–23 lines × 3) · ×1
  • Duplicated block (20–23 lines × 3) invokeai/backend/model_manager/load/model_loaders/krea2.py:685 — invokeai/backend/model_manager/load/model_loaders/krea2.py:685-707 | invokeai/backend/model_manager/load/model_loaders/krea2.py:1218-1238 | invokeai/backend/model_manager/load/model_loaders/z_image.py:660-679 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/backend/model_manager/load/model_loaders/z_image.py:640` calls `extract_comfy_quant_hints`, `extract_fp8_scaled_layers`, `_keep_fp8_weights` and `invokeai/backend/model_manager/load/model_loaders/krea2.py:676` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (17–23 lines × 2) · ×1
  • Duplicated block (17–23 lines × 2) invokeai/app/api/routers/images.py:780 — invokeai/app/api/routers/images.py:780-802 | invokeai/app/api/routers/images.py:838-854 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/api/routers/images.py:780` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (20–23 lines × 2) · ×1
  • Duplicated block (20–23 lines × 2) invokeai/backend/model_manager/configs/qwen3_encoder.py:371 — invokeai/backend/model_manager/configs/qwen3_encoder.py:371-393 | invokeai/backend/model_manager/configs/qwen3_vl_encoder.py:143-162 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (22–23 lines × 2) · ×1
  • Duplicated block (22–23 lines × 2) invokeai/backend/model_manager/load/model_loaders/z_image.py:331 — invokeai/backend/model_manager/load/model_loaders/z_image.py:331-353 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1676-1697 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/model_manager/load/model_loaders/z_image.py:331` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (20–22 lines × 2) · ×1
  • Duplicated block (20–22 lines × 2) invokeai/backend/flux/extensions/instantx_controlnet_extension.py:60 — invokeai/backend/flux/extensions/instantx_controlnet_extension.py:60-81 | invokeai/backend/flux/extensions/instantx_controlnet_extension.py:99-118 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (21–22 lines × 2) · ×1
  • Duplicated block (21–22 lines × 2) invokeai/backend/model_manager/load/model_loaders/flux.py:1757 — invokeai/backend/model_manager/load/model_loaders/flux.py:1757-1777 | invokeai/backend/model_manager/load/model_loaders/flux.py:1875-1896 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/backend/model_manager/load/model_loaders/flux.py:1754` calls `get` and `invokeai/backend/model_manager/load/model_loaders/flux.py:1870` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (19–22 lines × 2) · ×1
  • Duplicated block (19–22 lines × 2) invokeai/backend/model_manager/load/model_loaders/z_image.py:1356 — invokeai/backend/model_manager/load/model_loaders/z_image.py:1356-1377 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1562-1580 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (12–21 lines × 3) · ×1
  • Duplicated block (12–21 lines × 3) invokeai/backend/model_manager/load/model_loaders/z_image.py:335 — invokeai/backend/model_manager/load/model_loaders/z_image.py:335-346 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1487-1507 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1680-1691 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (21 lines × 3) · ×1
  • Duplicated block (21 lines × 3) scripts/calibrate_flux2_denoise_working_memory.py:615 — scripts/calibrate_flux2_denoise_working_memory.py:615-635 | scripts/calibrate_flux3_denoise_working_memory.py:867-887 | scripts/calibrate_z_image_working_memory.py:546-566 — before extracting anything, compare `scripts/calibrate_flux2_denoise_working_memory.py` and `scripts/calibrate_flux3_denoise_working_memory.py` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/calibrate_flux2_denoise_working_memory.py:615` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `scripts/calibrate_flux2_denoise_working_memory.py:637` calls `_summarize_large` and `scripts/calibrate_z_image_working_memory.py:567` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (16–21 lines × 2) · ×1
  • Duplicated block (16–21 lines × 2) invokeai/app/services/external_generation/providers/alibabacloud.py:101 — invokeai/app/services/external_generation/providers/alibabacloud.py:101-121 | invokeai/app/services/external_generation/providers/alibabacloud.py:147-162 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (20–21 lines × 2) · ×1
  • Duplicated block (20–21 lines × 2) invokeai/backend/flux/controlnet/state_dict_utils.py:61 — invokeai/backend/flux/controlnet/state_dict_utils.py:61-80 | invokeai/backend/flux/controlnet/state_dict_utils.py:133-153 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/flux/controlnet/state_dict_utils.py:61` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (17–21 lines × 2) · ×1
  • Duplicated block (17–21 lines × 2) invokeai/backend/model_manager/load/model_loaders/z_image.py:1545 — invokeai/backend/model_manager/load/model_loaders/z_image.py:1545-1565 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1732-1748 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (3–21 lines × 3) · ×1
  • Duplicated block (3–21 lines × 3) invokeai/backend/wan/extensions/wan_ref_image_extension.py:49 — invokeai/backend/wan/extensions/wan_ref_image_extension.py:49-69 | invokeai/backend/wan/extensions/wan_ref_image_extension.py:86-101 | invokeai/backend/wan/extensions/wan_ref_image_extension.py:190-192 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/wan/extensions/wan_ref_image_extension.py:49` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14–20 lines × 3) · ×1
  • Duplicated block (14–20 lines × 3) invokeai/app/invocations/anima/anima_denoise.py:712 — invokeai/app/invocations/anima/anima_denoise.py:712-731 | invokeai/app/invocations/flux2/flux2_denoise.py:330-343 | invokeai/app/invocations/z_image/z_image_denoise.py:360-374 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
D4 · Code Duplication · Duplicated block (19–20 lines × 3) · ×1
  • Duplicated block (19–20 lines × 3) invokeai/app/invocations/z_image/z_image_denoise.py:576 — invokeai/app/invocations/z_image/z_image_denoise.py:576-595 | invokeai/backend/flux/denoise.py:226-244 | invokeai/backend/flux2/denoise.py:199-217 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/z_image/z_image_denoise.py:576` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (19–20 lines × 2) · ×1
  • Duplicated block (19–20 lines × 2) invokeai/app/invocations/text_encoder/flux2_klein_text_encoder.py:137 — invokeai/app/invocations/text_encoder/flux2_klein_text_encoder.py:137-156 | invokeai/app/invocations/text_encoder/z_image_text_encoder.py:109-127 — before extracting anything, compare `invokeai/app/invocations/text_encoder/flux2_klein_text_encoder.py` and `invokeai/app/invocations/text_encoder/z_image_text_encoder.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/text_encoder/flux2_klein_text_encoder.py:137` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14–20 lines × 2) · ×1
  • Duplicated block (14–20 lines × 2) invokeai/app/invocations/wan/wan_denoise.py:669 — invokeai/app/invocations/wan/wan_denoise.py:669-688 | invokeai/app/invocations/wan/wan_video_denoise.py:320-333 — before extracting anything, compare `invokeai/app/invocations/wan/wan_denoise.py` and `invokeai/app/invocations/wan/wan_video_denoise.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 150 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (19 lines × 4) · ×1
  • Duplicated block (19 lines × 4) invokeai/app/invocations/metadata_linked.py:640 — invokeai/app/invocations/metadata_linked.py:640-658 | invokeai/app/invocations/metadata_linked.py:703-721 | invokeai/app/invocations/metadata_linked.py:757-775 | invokeai/app/invocations/metadata_linked.py:827-845 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/app/invocations/metadata_linked.py:699` calls `FluxDenoiseLatentsMetaInvocation` and `invokeai/app/invocations/metadata_linked.py:824` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (18–19 lines × 4) · ×1
  • Duplicated block (18–19 lines × 4) scripts/calibrate_flux2_denoise_working_memory.py:615 — scripts/calibrate_flux2_denoise_working_memory.py:615-633 | scripts/calibrate_flux3_denoise_working_memory.py:867-885 | scripts/calibrate_vae_tiling_working_memory.py:696-713 | scripts/calibrate_z_image_working_memory.py:546-564 — before extracting anything, compare `scripts/calibrate_flux2_denoise_working_memory.py` and `scripts/calibrate_flux3_denoise_working_memory.py` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/calibrate_flux2_denoise_working_memory.py:615` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (18 lines × 4) · ×1
  • Duplicated block (18 lines × 4) invokeai/backend/model_manager/load/model_loaders/z_image.py:439 — invokeai/backend/model_manager/load/model_loaders/z_image.py:439-456 | invokeai/backend/model_manager/load/model_loaders/z_image.py:536-553 | invokeai/backend/model_manager/load/model_loaders/z_image.py:785-802 | invokeai/backend/model_manager/load/model_loaders/z_image.py:907-924 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (16–18 lines × 4) · ×1
  • Duplicated block (16–18 lines × 4) invokeai/backend/patches/lora_conversions/anima_lora_conversion_utils.py:249 — invokeai/backend/patches/lora_conversions/anima_lora_conversion_utils.py:249-264 | invokeai/backend/patches/lora_conversions/qwen_image_lora_conversion_utils.py:181-196 | invokeai/backend/patches/lora_conversions/wan_lora_conversion_utils.py:231-246 | invokeai/backend/patches/lora_conversions/z_image_lora_conversion_utils.py:237-254 — before extracting anything, compare `invokeai/backend/patches/lora_conversions/qwen_image_lora_conversion_utils.py` and `invokeai/backend/patches/lora_conversions/wan_lora_conversion_utils.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 72 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (18 lines × 3) · ×1
  • Duplicated block (18 lines × 3) invokeai/app/invocations/anima/anima_lora_loader.py:72 — invokeai/app/invocations/anima/anima_lora_loader.py:72-89 | invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:111-128 | invokeai/app/invocations/z_image/z_image_lora_loader.py:84-101 — before extracting anything, compare `invokeai/app/invocations/anima/anima_lora_loader.py` and `invokeai/app/invocations/flux2/flux2_klein_lora_loader.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (17–18 lines × 3) · ×1
  • Duplicated block (17–18 lines × 3) invokeai/backend/model_manager/load/model_loaders/flux.py:1437 — invokeai/backend/model_manager/load/model_loaders/flux.py:1437-1454 | invokeai/backend/model_manager/load/model_loaders/flux.py:1762-1779 | invokeai/backend/model_manager/load/model_loaders/flux.py:1882-1898 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/backend/model_manager/load/model_loaders/flux.py:1434` calls `reject_unmarked_int8_weights` and `invokeai/backend/model_manager/load/model_loaders/flux.py:1760` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (15–18 lines × 2) · ×1
  • Duplicated block (15–18 lines × 2) invokeai/app/invocations/flux2/flux2_dev_lora_loader.py:156 — invokeai/app/invocations/flux2/flux2_dev_lora_loader.py:156-173 | invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:175-189 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (11–17 lines × 9) · ×1
  • Duplicated block (11–17 lines × 9) invokeai/app/invocations/anima/anima_denoise.py:261 — invokeai/app/invocations/anima/anima_denoise.py:261-274 | invokeai/app/invocations/cogview4/cogview4_denoise.py:95-110 | invokeai/app/invocations/flux/flux_denoise.py:713-729 | invokeai/app/invocations/flux2/flux2_denoise.py:589-601 | invokeai/app/invocations/krea2/krea2_denoise.py:229-239 | invokeai/app/invocations/qwen_image/qwen_image_denoise.py:160-171 | invokeai/app/invocations/sd3/sd3_denoise.py:95-110 | invokeai/app/invocations/wan/wan_denoise.py:791-801 | invokeai/app/invocations/z_image/z_image_denoise.py:158-171 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 9 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 9 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (15–17 lines × 2) · ×1
  • Duplicated block (15–17 lines × 2) invokeai/app/invocations/qwen_image/qwen_image_denoise.py:744 — invokeai/app/invocations/qwen_image/qwen_image_denoise.py:744-758 | invokeai/app/invocations/qwen_image_2_1/qwen_image_2_1_denoise.py:586-602 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/qwen_image/qwen_image_denoise.py:744` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (14–16 lines × 3) · ×1
  • Duplicated block (14–16 lines × 3) invokeai/backend/flux2/denoise.py:304 — invokeai/backend/flux2/denoise.py:304-319 | invokeai/backend/flux3/denoise.py:80-93 | invokeai/backend/moss_image/denoise.py:68-82 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/flux2/denoise.py:304` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (15 lines × 5) · ×1
  • Duplicated block (15 lines × 5) invokeai/app/invocations/pid/flux2_pid_decode.py:185 — invokeai/app/invocations/pid/flux2_pid_decode.py:185-199 | invokeai/app/invocations/pid/flux_pid_decode.py:154-168 | invokeai/app/invocations/pid/qwen_image_pid_decode.py:183-197 | invokeai/app/invocations/pid/sd3_pid_decode.py:148-162 | invokeai/app/invocations/pid/sdxl_pid_decode.py:166-180 — before extracting anything, compare `invokeai/app/invocations/pid/flux2_pid_decode.py` and `invokeai/app/invocations/pid/flux_pid_decode.py` 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. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (15 lines × 4) · ×1
  • Duplicated block (15 lines × 4) invokeai/backend/model_manager/load/model_loaders/z_image.py:314 — invokeai/backend/model_manager/load/model_loaders/z_image.py:314-328 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1178-1192 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1450-1464 | invokeai/backend/model_manager/load/model_loaders/z_image.py:1657-1671 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `invokeai/backend/model_manager/load/model_loaders/z_image.py:1675` calls `ValueError` and `invokeai/backend/model_manager/load/model_loaders/z_image.py:331` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (14–15 lines × 3) · ×1
  • Duplicated block (14–15 lines × 3) invokeai/app/invocations/text_encoder/cogview4_text_encoder.py:75 — invokeai/app/invocations/text_encoder/cogview4_text_encoder.py:75-88 | invokeai/app/invocations/text_encoder/sd3_text_encoder.py:124-137 | invokeai/app/invocations/text_encoder/sd3_text_encoder.py:189-203 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/text_encoder/cogview4_text_encoder.py:75` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8–15 lines × 2) · ×1
  • Duplicated block (8–15 lines × 2) invokeai/backend/model_manager/load/model_loaders/qwen_image.py:224 — invokeai/backend/model_manager/load/model_loaders/qwen_image.py:224-231 | invokeai/backend/model_manager/load/model_loaders/z_image.py:764-778 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (14 lines × 3) · ×1
  • Duplicated block (14 lines × 3) invokeai/app/api/routers/gallery.py:79 — invokeai/app/api/routers/gallery.py:79-92 | invokeai/app/api/routers/gallery.py:131-144 | invokeai/app/api/routers/gallery.py:253-266 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/api/routers/gallery.py:79` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `invokeai/app/api/routers/gallery.py:146` calls `HTTPException` and `invokeai/app/api/routers/gallery.py:95` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (12–14 lines × 3) · ×1
  • Duplicated block (12–14 lines × 3) invokeai/backend/model_manager/configs/main.py:745 — invokeai/backend/model_manager/configs/main.py:745-758 | invokeai/backend/model_manager/configs/main.py:938-951 | invokeai/backend/model_manager/configs/main.py:3680-3691 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (9–14 lines × 3) · ×1
  • Duplicated block (9–14 lines × 3) invokeai/backend/model_manager/load/model_loaders/flux.py:1394 — invokeai/backend/model_manager/load/model_loaders/flux.py:1394-1407 | invokeai/backend/model_manager/load/model_loaders/flux.py:1739-1747 | invokeai/backend/model_manager/load/model_loaders/flux.py:1837-1850 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/backend/model_manager/load/model_loaders/flux.py:1394` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `invokeai/backend/model_manager/load/model_loaders/flux.py:1851` calls `hasattr` and `invokeai/backend/model_manager/load/model_loaders/flux.py:1408` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (11–14 lines × 2) · ×1
  • Duplicated block (11–14 lines × 2) invokeai/app/invocations/vae/wan_latents_to_image.py:53 — invokeai/app/invocations/vae/wan_latents_to_image.py:53-66 | invokeai/app/invocations/wan/wan_denoise.py:517-527 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/vae/wan_latents_to_image.py:53` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13–14 lines × 2) · ×1
  • Duplicated block (13–14 lines × 2) invokeai/app/services/external_generation/providers/openai.py:121 — invokeai/app/services/external_generation/providers/openai.py:121-133 | invokeai/app/services/external_generation/providers/seedream.py:103-116 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (8–14 lines × 2) · ×1
  • Duplicated block (8–14 lines × 2) invokeai/backend/pid/_src/networks/pid_net.py:442 — invokeai/backend/pid/_src/networks/pid_net.py:442-455 | invokeai/backend/pid/_src/networks/pixeldit_official.py:1510-1517 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/backend/pid/_src/networks/pid_net.py:437` calls `_unpatchify_features` and `invokeai/backend/pid/_src/networks/pixeldit_official.py:1507` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (13 lines × 7) · ×1
  • Duplicated block (13 lines × 7) invokeai/app/invocations/pid/flux2_pid_decode.py:171 — invokeai/app/invocations/pid/flux2_pid_decode.py:171-183 | invokeai/app/invocations/pid/flux_pid_decode.py:140-152 | invokeai/app/invocations/pid/pid_upscale.py:179-191 | invokeai/app/invocations/pid/qwen_image_pid_decode.py:169-181 | invokeai/app/invocations/pid/sd3_pid_decode.py:134-146 | invokeai/app/invocations/pid/sdxl_pid_decode.py:152-164 | invokeai/app/invocations/pid/z_image_pid_decode.py:153-165 — before extracting anything, compare `invokeai/app/invocations/pid/flux2_pid_decode.py` and `invokeai/app/invocations/pid/flux_pid_decode.py` 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. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/pid/flux2_pid_decode.py:171` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13 lines × 4) · ×1
  • Duplicated block (13 lines × 4) invokeai/app/services/events/events_common.py:143 — invokeai/app/services/events/events_common.py:143-155 | invokeai/app/services/events/events_common.py:212-224 | invokeai/app/services/events/events_common.py:245-257 | invokeai/app/services/events/events_common.py:281-293 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/events/events_common.py:143` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (10–13 lines × 2) · ×1
  • Duplicated block (10–13 lines × 2) invokeai/app/invocations/ltx2/ltx2_extend_conditioning.py:244 — invokeai/app/invocations/ltx2/ltx2_extend_conditioning.py:244-256 | invokeai/app/invocations/ltx2/ltx2_video_conditioning.py:117-126 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/ltx2/ltx2_extend_conditioning.py:244` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11–12 lines × 3) · ×1
  • Duplicated block (11–12 lines × 3) invokeai/app/invocations/anima/anima_lora_loader.py:155 — invokeai/app/invocations/anima/anima_lora_loader.py:155-166 | invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:202-212 | invokeai/app/invocations/z_image/z_image_lora_loader.py:171-181 — before extracting anything, compare `invokeai/app/invocations/anima/anima_lora_loader.py` and `invokeai/app/invocations/flux2/flux2_klein_lora_loader.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 `invokeai/app/invocations/anima/anima_lora_loader.py:155` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (12 lines × 3) · ×1
  • Duplicated block (12 lines × 3) invokeai/backend/util/attention.py:391 — invokeai/backend/util/attention.py:391-402 | invokeai/backend/util/attention.py:697-708 | invokeai/backend/util/sage_attention.py:343-354 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (9–12 lines × 2) · ×1
  • Duplicated block (9–12 lines × 2) invokeai/app/invocations/qwen_image/qwen_image_denoise.py:767 — invokeai/app/invocations/qwen_image/qwen_image_denoise.py:767-775 | invokeai/app/invocations/z_image/z_image_denoise.py:706-717 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (8–12 lines × 2) · ×1
  • Duplicated block (8–12 lines × 2) invokeai/backend/hidiffusion/hidiffusion.py:1011 — invokeai/backend/hidiffusion/hidiffusion.py:1011-1022 | invokeai/backend/util/hotfixes.py:635-642 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (9–11 lines × 4) · ×1
  • Duplicated block (9–11 lines × 4) invokeai/backend/model_manager/configs/main.py:1270 — invokeai/backend/model_manager/configs/main.py:1270-1280 | invokeai/backend/model_manager/configs/main.py:4002-4010 | invokeai/backend/model_manager/configs/main.py:4156-4164 | invokeai/backend/model_manager/configs/main.py:4322-4331 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (11 lines × 4) · ×1
  • Duplicated block (11 lines × 4) invokeai/backend/model_manager/load/model_loaders/cogview4.py:28 — invokeai/backend/model_manager/load/model_loaders/cogview4.py:28-38 | invokeai/backend/model_manager/load/model_loaders/flux.py:1111-1121 | invokeai/backend/model_manager/load/model_loaders/flux.py:1153-1163 | invokeai/backend/model_manager/load/model_loaders/qwen_image.py:159-169 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `invokeai/backend/model_manager/load/model_loaders/flux.py:1172` calls `SilenceWarnings` and `invokeai/backend/model_manager/load/model_loaders/cogview4.py:43` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (7–10 lines × 5) · ×1
  • Duplicated block (7–10 lines × 5) invokeai/backend/model_manager/load/model_loaders/flux.py:997 — invokeai/backend/model_manager/load/model_loaders/flux.py:997-1003 | invokeai/backend/model_manager/load/model_loaders/flux.py:1533-1539 | invokeai/backend/model_manager/load/model_loaders/ideogram4.py:488-494 | invokeai/backend/model_manager/load/model_loaders/krea2.py:740-749 | invokeai/backend/model_manager/load/model_loaders/z_image.py:708-714 — there are 5 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/backend/model_manager/load/model_loaders/z_image.py:700` calls `load_state_dict_ignoring_extras`, `clear` and `invokeai/backend/model_manager/load/model_loaders/ideogram4.py:486` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (10 lines × 3) · ×1
  • Duplicated block (10 lines × 3) invokeai/app/api/routers/style_presets.py:132 — invokeai/app/api/routers/style_presets.py:132-141 | invokeai/app/api/routers/style_presets.py:222-231 | invokeai/app/api/routers/workflows.py:366-375 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (7–10 lines × 3) · ×1
  • Duplicated block (7–10 lines × 3) scripts/calibrate_flux2_denoise_working_memory.py:588 — scripts/calibrate_flux2_denoise_working_memory.py:588-594 | scripts/calibrate_flux3_denoise_working_memory.py:825-831 | scripts/calibrate_krea2_working_memory.py:714-723 — before extracting anything, compare `scripts/calibrate_flux2_denoise_working_memory.py` and `scripts/calibrate_flux3_denoise_working_memory.py` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/calibrate_krea2_working_memory.py:714` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `scripts/calibrate_flux3_denoise_working_memory.py:824` calls `add_argument` and `scripts/calibrate_flux2_denoise_working_memory.py:587` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8–10 lines × 2) · ×1
  • Duplicated block (8–10 lines × 2) invokeai/app/services/shared/graph.py:1457 — invokeai/app/services/shared/graph.py:1457-1464 | invokeai/app/services/shared/graph.py:1472-1481 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/shared/graph.py:1472` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (3–10 lines × 3) · ×1
  • Duplicated block (3–10 lines × 3) invokeai/backend/patches/lora_conversions/flux_diffusers_lora_conversion_utils.py:113 — invokeai/backend/patches/lora_conversions/flux_diffusers_lora_conversion_utils.py:113-115 | invokeai/backend/patches/lora_conversions/flux_kohya_lora_conversion_utils.py:68-77 | invokeai/backend/patches/lora_conversions/flux_onetrainer_lora_conversion_utils.py:62-71 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. Note first that the copies are not typed on the same thing: the declarations holding them bind `state_dict` to `Dict[str, torch.Tensor]` in one and `dict[str | int, Any]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (8–9 lines × 3) · ×1
  • Duplicated block (8–9 lines × 3) invokeai/app/invocations/cogview4/cogview4_denoise.py:165 — invokeai/app/invocations/cogview4/cogview4_denoise.py:165-173 | invokeai/app/invocations/qwen_image/qwen_image_denoise.py:214-221 | invokeai/app/invocations/sd3/sd3_denoise.py:184-192 — `invokeai/app/invocations/cogview4/cogview4_denoise.py` and `invokeai/app/invocations/qwen_image/qwen_image_denoise.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 43 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (1–9 lines × 6) · ×1
  • Duplicated block (1–9 lines × 6) invokeai/app/invocations/vae/anima_image_to_latents.py:104 — invokeai/app/invocations/vae/anima_image_to_latents.py:104-112 | invokeai/app/invocations/vae/anima_latents_to_image.py:141-141 | invokeai/app/invocations/vae/minimax_h3_latents_to_video.py:106-106 | invokeai/app/invocations/vae/wan_image_to_latents.py:73-81 | invokeai/app/invocations/vae/wan_latents_to_image.py:102-105 | invokeai/app/invocations/vae/wan_latents_to_video.py:205-205 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 6 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/vae/wan_latents_to_image.py:102` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/app/invocations/vae/anima_latents_to_image.py:137` calls `unsqueeze`, `tensor`, `view` and `invokeai/app/invocations/vae/wan_image_to_latents.py:73` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (6–8 lines × 7) · ×1
  • Duplicated block (6–8 lines × 7) invokeai/app/invocations/vae/anima_latents_to_image.py:191 — invokeai/app/invocations/vae/anima_latents_to_image.py:191-197 | invokeai/app/invocations/vae/cogview4_latents_to_image.py:75-82 | invokeai/app/invocations/vae/ideogram4_latents_to_image.py:91-96 | invokeai/app/invocations/vae/qwen_image_latents_to_image.py:142-149 | invokeai/app/invocations/vae/sd3_latents_to_image.py:77-84 | invokeai/app/invocations/vae/wan_latents_to_image.py:115-121 | invokeai/app/invocations/vae/z_image_latents_to_image.py:157-164 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 7 call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (3–8 lines × 5) · ×1
  • Duplicated block (3–8 lines × 5) invokeai/app/invocations/anima/anima_lora_loader.py:60 — invokeai/app/invocations/anima/anima_lora_loader.py:60-66 | invokeai/app/invocations/flux/flux_lora_loader.py:65-72 | invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:103-105 | invokeai/app/invocations/qwen_image/qwen_image_lora_loader.py:51-57 | invokeai/app/invocations/z_image/z_image_lora_loader.py:58-65 — before extracting anything, compare `invokeai/app/invocations/anima/anima_lora_loader.py` and `invokeai/app/invocations/flux2/flux2_klein_lora_loader.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `invokeai/app/invocations/anima/anima_lora_loader.py:66` calls `ValueError` and `invokeai/app/invocations/flux2/flux2_klein_lora_loader.py:105` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (6–8 lines × 4) · ×1
  • Duplicated block (6–8 lines × 4) invokeai/app/services/shared/graph_materializer.py:655 — invokeai/app/services/shared/graph_materializer.py:655-662 | invokeai/app/services/shared/graph_materializer.py:733-738 | invokeai/app/services/shared/graph_materializer.py:761-768 | invokeai/app/services/shared/graph_materializer.py:1189-1194 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/services/shared/graph_materializer.py:655` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/app/services/shared/graph_materializer.py:1188` calls `_discard_source_executed`, `_create_execution_node_copy` and `invokeai/app/services/shared/graph_materializer.py:655` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8 lines × 4) · ×1
  • Duplicated block (8 lines × 4) scripts/calibrate_flux2_denoise_working_memory.py:590 — scripts/calibrate_flux2_denoise_working_memory.py:590-597 | scripts/calibrate_flux3_denoise_working_memory.py:827-834 | scripts/calibrate_vae_tiling_working_memory.py:683-690 | scripts/calibrate_z_image_working_memory.py:523-531 — before extracting anything, compare `scripts/calibrate_flux2_denoise_working_memory.py` and `scripts/calibrate_flux3_denoise_working_memory.py` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/calibrate_z_image_working_memory.py:523` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `scripts/calibrate_flux3_denoise_working_memory.py:824` calls `add_argument` and `scripts/calibrate_flux2_denoise_working_memory.py:587` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (1–8 lines × 6) · ×1
  • Duplicated block (1–8 lines × 6) invokeai/app/invocations/vae/anima_image_to_latents.py:113 — invokeai/app/invocations/vae/anima_image_to_latents.py:113-120 | invokeai/app/invocations/vae/anima_latents_to_image.py:142-142 | invokeai/app/invocations/vae/minimax_h3_latents_to_video.py:107-107 | invokeai/app/invocations/vae/wan_image_to_latents.py:82-89 | invokeai/app/invocations/vae/wan_latents_to_image.py:106-106 | invokeai/app/invocations/vae/wan_latents_to_video.py:206-206 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 6 call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `invokeai/app/invocations/vae/anima_image_to_latents.py:107` calls `encode`, `sample`, `to` and `invokeai/app/invocations/vae/anima_latents_to_image.py:137` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (6 lines × 6) · ×1
  • Duplicated block (6 lines × 6) invokeai/app/invocations/pid/flux2_pid_decode.py:194 — invokeai/app/invocations/pid/flux2_pid_decode.py:194-199 | invokeai/app/invocations/pid/flux_pid_decode.py:163-168 | invokeai/app/invocations/pid/qwen_image_pid_decode.py:192-197 | invokeai/app/invocations/pid/sd3_pid_decode.py:157-162 | invokeai/app/invocations/pid/sdxl_pid_decode.py:175-180 | invokeai/app/invocations/pid/z_image_pid_decode.py:183-189 — before extracting anything, compare `invokeai/app/invocations/pid/flux2_pid_decode.py` and `invokeai/app/invocations/pid/flux_pid_decode.py` 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. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `invokeai/app/invocations/pid/flux2_pid_decode.py:194` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6 lines × 5) · ×1
  • Duplicated block (6 lines × 5) invokeai/app/invocations/text_encoder/anima_text_encoder.py:288 — invokeai/app/invocations/text_encoder/anima_text_encoder.py:288-293 | invokeai/app/invocations/text_encoder/flux2_dev_text_encoder.py:258-263 | invokeai/app/invocations/text_encoder/flux2_klein_text_encoder.py:215-220 | invokeai/app/invocations/text_encoder/z_image_text_encoder.py:215-220 | invokeai/app/invocations/z_image/z_image_denoise.py:763-768 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 5 times.
D4 · Code Duplication · Duplicated block (5–6 lines × 3) · ×1
  • Duplicated block (5–6 lines × 3) scripts/calibrate_flux2_denoise_working_memory.py:576 — scripts/calibrate_flux2_denoise_working_memory.py:576-581 | scripts/calibrate_krea2_working_memory.py:698-703 | scripts/calibrate_z_image_working_memory.py:511-515 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/calibrate_flux2_denoise_working_memory.py:576` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (5 lines × 7) · ×1
  • Duplicated block (5 lines × 7) invokeai/app/util/user_management.py:124 — invokeai/app/util/user_management.py:124-128 | invokeai/app/util/user_management.py:164-168 | invokeai/app/util/user_management.py:241-245 | invokeai/app/util/user_management.py:289-293 | invokeai/app/util/user_management.py:474-478 | invokeai/app/util/user_management.py:524-528 | invokeai/app/util/user_management.py:581-585 — 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 — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (4–5 lines × 3) · ×1
  • Duplicated block (4–5 lines × 3) invokeai/backend/flux/custom_block_processor.py:50 — invokeai/backend/flux/custom_block_processor.py:50-53 | invokeai/backend/flux/ip_adapter/ip_double_stream_block_processor.py:64-70 | invokeai/backend/flux/modules/layers.py:178-182 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
D4 · Code Duplication · Duplicated block (138 lines × 2) · ×1
  • Duplicated block (138 lines × 2) invokeai/app/services/image_files/image_files_base.py:14 — invokeai/app/services/image_files/image_files_base.py:14-151 | invokeai/app/services/image_records/image_records_base.py:25-190 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (44 lines × 2) · ×1
  • Duplicated block (44 lines × 2) invokeai/app/services/item_storage/item_storage_base.py:16 — invokeai/app/services/item_storage/item_storage_base.py:16-59 | invokeai/app/services/videos/videos_base.py:26-202 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (126 lines × 3) · ×1
  • Duplicated block (126 lines × 3) invokeai/app/services/image_files/image_files_base.py:14 — invokeai/app/services/image_files/image_files_base.py:14-151 | invokeai/app/services/image_records/image_records_base.py:25-190 | invokeai/app/services/video_records/video_records_base.py:21-146 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
D4 · Code Duplication · Duplicated block (11 lines × 3) · ×1
  • Duplicated block (11 lines × 3) invokeai/app/services/external_generation/external_generation_default.py:355 — invokeai/app/services/external_generation/external_generation_default.py:355-365 | invokeai/app/services/external_generation/providers/atlascloud.py:358-368 | invokeai/app/services/external_generation/providers/gemini.py:223-233 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (5 lines × 10) · ×1
  • Duplicated block (5 lines × 10) invokeai/backend/model_manager/configs/controlnet.py:104 — invokeai/backend/model_manager/configs/controlnet.py:104-108 | invokeai/backend/model_manager/configs/controlnet.py:169-173 | invokeai/backend/model_manager/configs/ip_adapter.py:58-62 | invokeai/backend/model_manager/configs/ip_adapter.py:138-142 | invokeai/backend/model_manager/configs/lora.py:596-600 | invokeai/backend/model_manager/configs/lora.py:661-665 | invokeai/backend/model_manager/configs/lora.py:1691-1695 | invokeai/backend/model_manager/configs/main.py:352-356 | invokeai/backend/model_manager/configs/main.py:1162-1166 | invokeai/backend/model_manager/configs/t2i_adapter.py:53-57 — there are 10 copies across 5 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 10 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (10 lines × 6) · ×1
  • Duplicated block (10 lines × 6) invokeai/backend/model_manager/load/model_loaders/anima.py:84 — invokeai/backend/model_manager/load/model_loaders/anima.py:84-93 | invokeai/backend/model_manager/load/model_loaders/flux.py:1025-1034 | invokeai/backend/model_manager/load/model_loaders/flux.py:1071-1080 | invokeai/backend/model_manager/load/model_loaders/qwen_image.py:209-218 | invokeai/backend/model_manager/load/model_loaders/z_image.py:471-480 | invokeai/backend/model_manager/load/model_loaders/z_image.py:746-755 — there are 6 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (14 lines × 12) · ×1
  • Duplicated block (14 lines × 12) invokeai/app/services/shared/sqlite_migrator/migrations/migration_10.py:22 — invokeai/app/services/shared/sqlite_migrator/migrations/migration_10.py:22-37 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_13.py:19-33 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_14.py:49-63 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_15.py:21-36 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_16.py:19-33 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_17.py:22-37 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_18.py:31-49 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_4.py:72-85 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_5.py:21-36 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_6.py:48-64 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_7.py:74-90 | invokeai/app/services/shared/sqlite_migrator/migrations/migration_9.py:17-31 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 12 call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D6 · Cohesion (LCOM4) · Low cohesion · ×1
  • Low cohesion: PixelDiTModel (LCOM4 4) invokeai/backend/pid/_src/models/pixeldit_model.py:119 — PixelDiTModel's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
P12 · CI test-gate honesty · Runner config excludes tests no gate runs · ×1
  • Runner config excludes tests no gate runs invokeai/frontend/webv2/vitest.config.mts:11 — `src/**/*.browser.test.{ts,tsx}` removes 3791 test(s) in 428 file(s) (e.g. `invokeai/frontend/webv2/src/app/AccountLifecycleCoordinator.browser.test.tsx`, `invokeai/frontend/webv2/src/app/AccountModelsUiProvider.browser.test.tsx`) from what vitest collects, and no other runner or CI command runs them — they are dead tests. Run them (another runner, project or job), or delete them.
PF3 · Async & latency hygiene · Sync-over-async blocking · ×1
  • Sync-over-async blocking REDACTED:185 — `unzipSync` in `readArchiveEntries` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
R10 · Code Duplication · Duplication concentrated across 24 sibling directories (219 clone groups) · ×1
  • Duplication concentrated across 24 sibling directories (219 clone groups) invokeai/frontend/webv1/src/features/dnd/DndListDropIndicator.tsx:12 — 219 duplicated blocks under invokeai/frontend/webv1/src/features/ have copies in at least two of the sibling directories auth, changeBoardModal, controlLayers, cropper, customNodes, deleteImageModal (+18 more sibling(s) not listed) — 107 of them are reported below, and 112 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 219 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 219 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 219 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication · Duplication concentrated across 4 sibling directories (161 clone groups) · ×1
  • Duplication concentrated across 4 sibling directories (161 clone groups) invokeai/frontend/webv2/src/features/fonts/runtime.ts:102 — 161 duplicated blocks under invokeai/frontend/webv2/src/ have copies in at least two of the sibling directories app, features, platform, workbench — 56 of them are reported below, and 105 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 161 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 161 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 161 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication · Duplication concentrated across 11 sibling directories (89 clone groups) · ×1
  • Duplication concentrated across 11 sibling directories (89 clone groups) invokeai/frontend/webv2/src/features/upscale/ui/UpscaleFormFields.tsx:24 — 89 duplicated blocks under invokeai/frontend/webv2/src/features/ have copies in at least two of the sibling directories fonts, gallery, generation, identity, intermediates, models (+5 more sibling(s) not listed) — 46 of them are reported below, and 43 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 89 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 89 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 89 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication · Duplication concentrated across 13 sibling directories (78 clone groups) · ×1
  • Duplication concentrated across 13 sibling directories (78 clone groups) invokeai/frontend/webv2/src/workbench/launchpad/HelpMenu.tsx:77 — 78 duplicated blocks under invokeai/frontend/webv2/src/workbench/ have copies in at least two of the sibling directories canvas-engine, canvas-operations, diagnostics, hotkeys, image-actions, launchpad (+7 more sibling(s) not listed) — 33 of them are reported below, and 45 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 78 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 78 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 78 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication · Duplication concentrated across 14 sibling directories (59 clone groups) · ×1
  • Duplication concentrated across 14 sibling directories (59 clone groups) invokeai/frontend/webv1/src/features/controlLayers/components/CanvasEntityList/useCanvasEntityListDnd.ts:11 — 59 duplicated blocks under invokeai/frontend/webv1/src/features/controlLayers/components/ have copies in at least two of the sibling directories CanvasContextMenu, CanvasEntityList, ControlLayer, Filters, InpaintMask, RasterLayer (+8 more sibling(s) not listed) — 40 of them are reported below, and 19 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 59 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 59 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 59 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication · Duplication concentrated across 2 sibling directories (56 clone groups) · ×1
  • Duplication concentrated across 2 sibling directories (56 clone groups) invokeai/frontend/webv1/src/features/nodes/util/workflowImageExport.ts:170 — 56 duplicated blocks under invokeai/frontend/ have copies in at least two of the sibling directories webv1, webv2 — 28 of them are reported below, and 28 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 56 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 56 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 56 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication · Duplication concentrated across 13 sibling directories (22 clone groups) · ×1
  • Duplication concentrated across 13 sibling directories (22 clone groups) invokeai/frontend/webv1/src/features/parameters/components/Bbox/BboxPreview.tsx:1 — 22 duplicated blocks under invokeai/frontend/webv1/src/features/parameters/components/ have copies in at least two of the sibling directories Advanced, Bbox, Canvas, Core, Dimensions, Krea2Enhancers (+7 more sibling(s) not listed) — 18 of them are reported below, and 4 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 22 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 22 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 22 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication · Duplication concentrated across 10 sibling directories (19 clone groups) · ×1
  • Duplication concentrated across 10 sibling directories (19 clone groups) invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/geometryForm.tsx:72 — 19 duplicated blocks under invokeai/frontend/webv2/src/workbench/widgets/ have copies in at least two of the sibling directories autosave-status, canvas, diagnostics, image-map, layers, preview (+4 more sibling(s) not listed) — 8 of them are reported below, and 11 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 19 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 19 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 19 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication · Duplication concentrated across 4 sibling directories (14 clone groups) · ×1
  • Duplication concentrated across 4 sibling directories (14 clone groups) invokeai/frontend/webv1/src/common/hooks/useCopyImageToClipboard.ts:14 — 14 duplicated blocks under invokeai/frontend/webv1/src/ have copies in at least two of the sibling directories app, common, features, services — 9 of them are reported below, and 5 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 14 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 14 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 14 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication · Duplication concentrated across 3 sibling directories (11 clone groups) · ×1
  • Duplication concentrated across 3 sibling directories (11 clone groups) invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityTransformer.ts:1186 — 11 duplicated blocks under invokeai/frontend/webv1/src/features/controlLayers/konva/ have copies in at least two of the sibling directories CanvasEntity, CanvasObject, CanvasTool — 6 of them are reported below, and 5 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 11 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 11 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 11 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication · Duplication concentrated across 6 sibling directories (10 clone groups) · ×1
  • Duplication concentrated across 6 sibling directories (10 clone groups) invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/ControlAdapterModelDefaultSettings/ControlAdapterModelDefaultSettings.tsx:31 — 10 duplicated blocks under invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/ have copies in at least two of the sibling directories ControlAdapterModelDefaultSettings, CpuOnlyModelSettings, EncoderModelSettings, LoRAModelDefaultSettings, MainModelDefaultSettings, VAEModelSettings — 8 of them are reported below, and 2 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 10 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 10 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 10 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication · Duplication concentrated across 7 sibling directories (10 clone groups) · ×1
  • Duplication concentrated across 7 sibling directories (10 clone groups) invokeai/frontend/webv2/src/features/models/ui/detail/UpdatePathDialog.tsx:60 — 10 duplicated blocks under invokeai/frontend/webv2/src/features/models/ui/ have copies in at least two of the sibling directories add-models, credentials, detail, install-queue, launchpad, library (+1 more sibling(s) not listed) — 5 of them are reported below, and 5 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 10 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 10 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 10 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication · Duplication concentrated across 9 sibling directories (10 clone groups) · ×1
  • Duplication concentrated across 9 sibling directories (10 clone groups) invokeai/frontend/webv2/src/workbench/canvas-engine/export/psdExport.ts:388 — 10 duplicated blocks under invokeai/frontend/webv2/src/workbench/canvas-engine/ have copies in at least two of the sibling directories controllers, document, document-model, editing, export, math (+3 more sibling(s) not listed) — 7 of them are reported below, and 3 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 10 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 10 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 10 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication · Duplication concentrated across 2 sibling directories (7 clone groups) · ×1
  • Duplication concentrated across 2 sibling directories (7 clone groups) invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/StringFieldCollectionInputComponent.tsx:117 — 7 duplicated blocks under invokeai/frontend/webv1/src/features/nodes/components/ have copies in at least two of the sibling directories flow, sidePanel — 3 of them are reported below, and 4 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 7 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 7 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 7 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication · Duplication concentrated across 4 sibling directories (6 clone groups) · ×1
  • Duplication concentrated across 4 sibling directories (6 clone groups) invokeai/frontend/webv1/src/features/nodes/store/nodesSlice.ts:667 — 6 duplicated blocks under invokeai/frontend/webv1/src/features/nodes/ have copies in at least two of the sibling directories components, hooks, store, util — 4 of them are reported below, and 2 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 6 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 6 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 6 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication · Duplication concentrated across 2 sibling directories (6 clone groups) · ×1
  • Duplication concentrated across 2 sibling directories (6 clone groups) invokeai/frontend/webv2/scripts/mock-working-memory.mjs:148 — 6 duplicated blocks under invokeai/frontend/webv2/ have copies in at least two of the sibling directories scripts, src — 4 of them are reported below, and 2 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 6 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 6 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 6 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication · Duplication concentrated across 2 sibling directories (5 clone groups) · ×1
  • Duplication concentrated across 2 sibling directories (5 clone groups) invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/FloatField/useFloatField.ts:45 — 5 of the duplicated blocks reported below have copies in at least two of the sibling directories FloatField, IntegerField under invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/. That concentration is one structural fact, not 5 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 5 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication · Duplicated block with local edits (221 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (221 matched lines × 2 locations) invokeai/frontend/webv1/src/features/nodes/util/workflowImageExport.ts:170 — invokeai/frontend/webv1/src/features/nodes/util/workflowImageExport.ts:170 · invokeai/frontend/webv2/src/features/workflow/ui/editor/workflowImageExport.ts:174 — the two spans are one implementation copied and then locally edited — 1760 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (198 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (198 matched lines × 2 locations) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/addInpaint.ts:22 — invokeai/frontend/webv1/src/features/nodes/util/graph/generation/addInpaint.ts:22 · invokeai/frontend/webv1/src/features/nodes/util/graph/generation/addOutpaint.ts:24 — the two spans are one implementation copied and then locally edited — 1330 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (174 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (174 matched lines × 2 locations) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildSD1Graph.ts:117 — invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildSD1Graph.ts:117 · invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildSDXLGraph.ts:128 — the two spans are one implementation copied and then locally edited — 1036 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Wholesale file copy (172 identical lines × 2 files) · ×1
  • Wholesale file copy (172 identical lines × 2 files) invokeai/frontend/webv1/src/features/ui/layouts/upscaling-tab-auto-layout.tsx:1 — invokeai/frontend/webv1/src/features/ui/layouts/upscaling-tab-auto-layout.tsx:1 · invokeai/frontend/webv1/src/features/ui/layouts/workflows-tab-auto-layout.tsx:1 — these 2 files are line-for-line copies of one another — 172 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication · Wholesale file copy (169 identical lines × 2 files) · ×1
  • Wholesale file copy (169 identical lines × 2 files) invokeai/frontend/webv1/src/features/ui/layouts/canvas-tab-auto-layout.tsx:1 — invokeai/frontend/webv1/src/features/ui/layouts/canvas-tab-auto-layout.tsx:1 · invokeai/frontend/webv1/src/features/ui/layouts/workflows-tab-auto-layout.tsx:1 — these 2 files are line-for-line copies of one another — 169 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication · Duplicated block (144 lines × 2 locations) · ×1
  • Duplicated block (144 lines × 2 locations) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildQwenImageGraph.ts:250 — invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildQwenImageGraph.ts:250 · invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildZImageGraph.ts:251 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
R10 · Code Duplication · Wholesale file copy (143 identical lines × 2 files) · ×1
  • Wholesale file copy (143 identical lines × 2 files) invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/FloatFieldCollectionInputComponent.tsx:1 — invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/FloatFieldCollectionInputComponent.tsx:1 · invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/inputs/IntegerFieldCollectionInputComponent.tsx:1 — these 2 files are line-for-line copies of one another — 143 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication · Duplicated block with local edits (138 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (138 matched lines × 2 locations) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/filterResultController.ts:47 — invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/filterResultController.ts:47 · invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/generatedResultController.ts:42 — the two spans are one implementation copied and then locally edited — 973 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (132 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (132 matched lines × 2 locations) invokeai/frontend/webv1/src/features/auth/components/UserManagement.tsx:112 — invokeai/frontend/webv1/src/features/auth/components/UserManagement.tsx:112 · invokeai/frontend/webv1/src/features/auth/components/UserProfile.tsx:93 — the two spans are one implementation copied and then locally edited — 739 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (112 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (112 matched lines × 2 locations) invokeai/frontend/webv2/src/workbench/widgets/layers/LayerChildRow.tsx:145 — invokeai/frontend/webv2/src/workbench/widgets/layers/LayerChildRow.tsx:145 · invokeai/frontend/webv2/src/workbench/widgets/layers/LayerRow.tsx:143 — the two spans are one implementation copied and then locally edited — 626 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Wholesale file copy (108 identical lines × 2 files) · ×1
  • Wholesale file copy (108 identical lines × 2 files) invokeai/frontend/webv1/src/features/queue/hooks/useEnqueueCanvas.ts:1 — invokeai/frontend/webv1/src/features/queue/hooks/useEnqueueCanvas.ts:1 · invokeai/frontend/webv1/src/features/queue/hooks/useEnqueueGenerate.ts:1 — these 2 files are line-for-line copies of one another — 108 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication · Duplicated block with local edits (105 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (105 matched lines × 2 locations) invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx:686 — invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx:686 · invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx:931 — the two spans are one implementation copied and then locally edited — 569 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Wholesale file copy (100 identical lines × 2 files) · ×1
  • Wholesale file copy (100 identical lines × 2 files) invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/InputFieldHandle.tsx:1 — invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/InputFieldHandle.tsx:1 · invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/fields/OutputFieldHandle.tsx:1 — these 2 files are line-for-line copies of one another — 100 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication · Duplicated block with local edits (100 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (100 matched lines × 2 locations) invokeai/frontend/webv2/src/features/identity/ui/ProfileDialog.tsx:92 — invokeai/frontend/webv2/src/features/identity/ui/ProfileDialog.tsx:92 · invokeai/frontend/webv2/src/features/identity/ui/UserFormDialog.tsx:112 — the two spans are one implementation copied and then locally edited — 628 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (99 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (99 matched lines × 2 locations) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:306 — invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:306 · invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:492 — the two spans are one implementation copied and then locally edited — 717 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (91 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (91 matched lines × 2 locations) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/booleanMergeController.ts:75 — invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/booleanMergeController.ts:75 · invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts:394 — the two spans are one implementation copied and then locally edited — 558 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (88 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (88 matched lines × 2 locations) invokeai/frontend/webv1/src/features/queue/store/readiness.ts:515 — invokeai/frontend/webv1/src/features/queue/store/readiness.ts:515 · invokeai/frontend/webv1/src/features/queue/store/readiness.ts:1293 — the two spans are one implementation copied and then locally edited — 689 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 696, cognitive 1160) · ×1
  • Complex function (anonymous) (cyclomatic 696, cognitive 1160) invokeai/frontend/webv2/scripts/mock-backend.mjs:1169 — (anonymous) has cyclomatic complexity 696 and cognitive complexity 1160; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 263, cognitive 203) · ×1
  • Complex function (anonymous) (cyclomatic 263, cognitive 203) invokeai/frontend/webv2/src/workbench/workbenchState.ts:4428 — (anonymous) has cyclomatic complexity 263 and cognitive complexity 203; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function effect (cyclomatic 209, cognitive 574) · ×1
  • Complex function effect (cyclomatic 209, cognitive 574) invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/modelSelected.ts:100 — effect has cyclomatic complexity 209 and cognitive complexity 574; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function getReasonsWhyCannotEnqueueCanvasTab (cyclomatic 145, cognitive 294) · ×1
  • Complex function getReasonsWhyCannotEnqueueCanvasTab (cyclomatic 145, cognitive 294) invokeai/frontend/webv1/src/features/queue/store/readiness.ts:773 — getReasonsWhyCannotEnqueueCanvasTab has cyclomatic complexity 145 and cognitive complexity 294; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 98, cognitive 119) · ×1
  • Complex function (anonymous) (cyclomatic 98, cognitive 119) invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:2293 — (anonymous) has cyclomatic complexity 98 and cognitive complexity 119; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 96, cognitive 163) · ×1
  • Complex function (anonymous) (cyclomatic 96, cognitive 163) invokeai/frontend/webv2/src/workbench/image-actions/recallParameters.ts:198 — (anonymous) has cyclomatic complexity 96 and cognitive complexity 163; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 96, cognitive 84) · ×1
  • Complex function (anonymous) (cyclomatic 96, cognitive 84) invokeai/frontend/webv2/src/features/gallery/ui/useGalleryData.ts:321 — (anonymous) has cyclomatic complexity 96 and cognitive complexity 84; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 94, cognitive 123) · ×1
  • Complex function (anonymous) (cyclomatic 94, cognitive 123) invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts:569 — (anonymous) has cyclomatic complexity 94 and cognitive complexity 123; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 94, cognitive 61) · ×1
  • Complex function (anonymous) (cyclomatic 94, cognitive 61) invokeai/frontend/webv2/src/workbench/queue-integration/queueRunRestoration.ts:17 — (anonymous) has cyclomatic complexity 94 and cognitive complexity 61; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function GalleryImageGrid (cyclomatic 93, cognitive 85) · ×1
  • Complex function GalleryImageGrid (cyclomatic 93, cognitive 85) invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx:409 — GalleryImageGrid has cyclomatic complexity 93 and cognitive complexity 85; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function getReasonsWhyCannotEnqueueGenerateTab (cyclomatic 89, cognitive 148) · ×1
  • Complex function getReasonsWhyCannotEnqueueGenerateTab (cyclomatic 89, cognitive 148) invokeai/frontend/webv1/src/features/queue/store/readiness.ts:357 — getReasonsWhyCannotEnqueueGenerateTab has cyclomatic complexity 89 and cognitive complexity 148; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 88, cognitive 89) · ×1
  • Complex function (anonymous) (cyclomatic 88, cognitive 89) invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts:769 — (anonymous) has cyclomatic complexity 88 and cognitive complexity 89; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function VideoWidgetView (cyclomatic 83, cognitive 75) · ×1
  • Complex function VideoWidgetView (cyclomatic 83, cognitive 75) invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx:131 — VideoWidgetView has cyclomatic complexity 83 and cognitive complexity 75; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 73, cognitive 57) · ×1
  • Complex function (anonymous) (cyclomatic 73, cognitive 57) invokeai/frontend/webv2/src/features/workflow/core/document.ts:910 — (anonymous) has cyclomatic complexity 73 and cognitive complexity 57; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 72, cognitive 122) · ×1
  • Complex function (anonymous) (cyclomatic 72, cognitive 122) invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildFLUXGraph.ts:55 — (anonymous) has cyclomatic complexity 72 and cognitive complexity 122; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 72, cognitive 85) · ×1
  • Complex function (anonymous) (cyclomatic 72, cognitive 85) invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHotkeyCommands.ts:166 — (anonymous) has cyclomatic complexity 72 and cognitive complexity 85; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 70, cognitive 89) · ×1
  • Complex function (anonymous) (cyclomatic 70, cognitive 89) invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:1974 — (anonymous) has cyclomatic complexity 70 and cognitive complexity 89; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 69, cognitive 129) · ×1
  • Complex function (anonymous) (cyclomatic 69, cognitive 129) invokeai/frontend/webv1/src/features/nodes/util/workflow/validateWorkflow.ts:140 — (anonymous) has cyclomatic complexity 69 and cognitive complexity 129; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 69, cognitive 73) · ×1
  • Complex function (anonymous) (cyclomatic 69, cognitive 73) invokeai/frontend/webv2/src/features/video/core/graph.ts:654 — (anonymous) has cyclomatic complexity 69 and cognitive complexity 73; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 69, cognitive 63) · ×1
  • Complex function (anonymous) (cyclomatic 69, cognitive 63) invokeai/frontend/webv2/src/workbench/workbenchState.ts:3968 — (anonymous) has cyclomatic complexity 69 and cognitive complexity 63; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R3 · Large Files · invokeai/frontend/webv2/src/workbench/workbenchState.ts · ×1
  • invokeai/frontend/webv2/src/workbench/workbenchState.ts: 5902 lines of code invokeai/frontend/webv2/src/workbench/workbenchState.ts:1 — invokeai/frontend/webv2/src/workbench/workbenchState.ts has 5902 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts · ×1
  • invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts: 3773 lines of code invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:1 — invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts has 3773 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts · ×1
  • invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts: 3020 lines of code invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts:1 — invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts has 3020 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv1/src/features/metadata/parsing.tsx · ×1
  • invokeai/frontend/webv1/src/features/metadata/parsing.tsx: 2950 lines of code invokeai/frontend/webv1/src/features/metadata/parsing.tsx:1 — invokeai/frontend/webv1/src/features/metadata/parsing.tsx has 2950 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts · ×1
  • invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts: 2507 lines of code invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts:1 — invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts has 2507 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv2/src/features/queue/runtime.ts · ×1
  • invokeai/frontend/webv2/src/features/queue/runtime.ts: 2449 lines of code invokeai/frontend/webv2/src/features/queue/runtime.ts:1 — invokeai/frontend/webv2/src/features/queue/runtime.ts has 2449 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts · ×1
  • invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts: 2271 lines of code invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts:1 — invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts has 2271 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx · ×1
  • invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx: 2047 lines of code invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx:1 — invokeai/frontend/webv2/src/features/workflow/ui/fields/WorkflowFieldInput.tsx has 2047 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv1/src/features/controlLayers/store/canvasSlice.ts · ×1
  • invokeai/frontend/webv1/src/features/controlLayers/store/canvasSlice.ts: 2001 lines of code invokeai/frontend/webv1/src/features/controlLayers/store/canvasSlice.ts:1 — invokeai/frontend/webv1/src/features/controlLayers/store/canvasSlice.ts has 2001 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx · ×1
  • invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx: 1921 lines of code invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx:1 — invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx has 1921 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv2/src/features/generation/core/graph.ts · ×1
  • invokeai/frontend/webv2/src/features/generation/core/graph.ts: 1893 lines of code invokeai/frontend/webv2/src/features/generation/core/graph.ts:1 — invokeai/frontend/webv2/src/features/generation/core/graph.ts has 1893 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv1/src/features/nodes/store/util/testUtils.ts · ×1
  • invokeai/frontend/webv1/src/features/nodes/store/util/testUtils.ts: 1841 lines of code invokeai/frontend/webv1/src/features/nodes/store/util/testUtils.ts:1 — invokeai/frontend/webv1/src/features/nodes/store/util/testUtils.ts has 1841 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv1/src/features/nodes/types/field.ts · ×1
  • invokeai/frontend/webv1/src/features/nodes/types/field.ts: 1629 lines of code invokeai/frontend/webv1/src/features/nodes/types/field.ts:1 — invokeai/frontend/webv1/src/features/nodes/types/field.ts has 1629 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv2/src/workbench/projects/draftStore.ts · ×1
  • invokeai/frontend/webv2/src/workbench/projects/draftStore.ts: 1583 lines of code invokeai/frontend/webv2/src/workbench/projects/draftStore.ts:1 — invokeai/frontend/webv2/src/workbench/projects/draftStore.ts has 1583 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv1/src/features/controlLayers/store/paramsSlice.ts · ×1
  • invokeai/frontend/webv1/src/features/controlLayers/store/paramsSlice.ts: 1542 lines of code invokeai/frontend/webv1/src/features/controlLayers/store/paramsSlice.ts:1 — invokeai/frontend/webv1/src/features/controlLayers/store/paramsSlice.ts has 1542 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts · ×1
  • invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts: 1527 lines of code invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts:1 — invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts has 1527 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts · ×1
  • invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts: 1471 lines of code invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:1 — invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts has 1471 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv1/src/features/queue/store/readiness.ts · ×1
  • invokeai/frontend/webv1/src/features/queue/store/readiness.ts: 1446 lines of code invokeai/frontend/webv1/src/features/queue/store/readiness.ts:1 — invokeai/frontend/webv1/src/features/queue/store/readiness.ts has 1446 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx · ×1
  • invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx: 1404 lines of code invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx:1 — invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx has 1404 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · REDACTED · ×1
  • REDACTED: 1392 lines of code REDACTED:1 — REDACTED has 1392 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts · ×1
  • invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts: 1383 lines of code invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts:1 — invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts has 1383 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts · ×1
  • invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts: 1373 lines of code invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts:1 — invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts has 1373 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowEditorView.tsx · ×1
  • invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowEditorView.tsx: 1338 lines of code invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowEditorView.tsx:1 — invokeai/frontend/webv2/src/features/workflow/ui/editor/WorkflowEditorView.tsx has 1338 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv1/src/features/cropper/lib/editor.ts · ×1
  • invokeai/frontend/webv1/src/features/cropper/lib/editor.ts: 1336 lines of code invokeai/frontend/webv1/src/features/cropper/lib/editor.ts:1 — invokeai/frontend/webv1/src/features/cropper/lib/editor.ts has 1336 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts · ×1
  • invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts: 1305 lines of code invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts:1 — invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts has 1305 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx · ×1
  • invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx: 1288 lines of code invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx:1 — invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx has 1288 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts · ×1
  • invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts: 1273 lines of code invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts:1 — invokeai/frontend/webv2/src/workbench/image-actions/imageRecall.ts has 1273 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv1/src/features/controlLayers/store/types.ts · ×1
  • invokeai/frontend/webv1/src/features/controlLayers/store/types.ts: 1203 lines of code invokeai/frontend/webv1/src/features/controlLayers/store/types.ts:1 — invokeai/frontend/webv1/src/features/controlLayers/store/types.ts has 1203 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts · ×1
  • invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts: 1164 lines of code invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts:1 — invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts has 1164 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx · ×1
  • invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx: 1163 lines of code invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx:1 — invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx has 1163 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv2/src/features/queue/runtime/coordinator.ts · ×1
  • invokeai/frontend/webv2/src/features/queue/runtime/coordinator.ts: 1148 lines of code invokeai/frontend/webv2/src/features/queue/runtime/coordinator.ts:1 — invokeai/frontend/webv2/src/features/queue/runtime/coordinator.ts has 1148 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv2/src/features/upscale/core/settings.ts · ×1
  • invokeai/frontend/webv2/src/features/upscale/core/settings.ts: 1112 lines of code invokeai/frontend/webv2/src/features/upscale/core/settings.ts:1 — invokeai/frontend/webv2/src/features/upscale/core/settings.ts has 1112 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.ts · ×1
  • invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.ts: 1111 lines of code invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.ts:1 — invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.ts has 1111 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv1/src/services/api/endpoints/images.ts · ×1
  • invokeai/frontend/webv1/src/services/api/endpoints/images.ts: 1108 lines of code invokeai/frontend/webv1/src/services/api/endpoints/images.ts:1 — invokeai/frontend/webv1/src/services/api/endpoints/images.ts has 1108 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv2/src/features/workflow/core/document.ts · ×1
  • invokeai/frontend/webv2/src/features/workflow/core/document.ts: 1104 lines of code invokeai/frontend/webv2/src/features/workflow/core/document.ts:1 — invokeai/frontend/webv2/src/features/workflow/core/document.ts has 1104 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv2/src/features/gallery/data/queries.ts · ×1
  • invokeai/frontend/webv2/src/features/gallery/data/queries.ts: 1096 lines of code invokeai/frontend/webv2/src/features/gallery/data/queries.ts:1 — invokeai/frontend/webv2/src/features/gallery/data/queries.ts has 1096 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx · ×1
  • invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx: 1080 lines of code invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx:1 — invokeai/frontend/webv2/src/features/workflow/ui/editor/InvocationFlowNode.tsx has 1080 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityTransformer.ts · ×1
  • invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityTransformer.ts: 1067 lines of code invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityTransformer.ts:1 — invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityTransformer.ts has 1067 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.ts · ×1
  • invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.ts: 1067 lines of code invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.ts:1 — invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.ts has 1067 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · invokeai/frontend/webv2/src/features/video/core/graph.ts · ×1
  • invokeai/frontend/webv2/src/features/video/core/graph.ts: 1059 lines of code invokeai/frontend/webv2/src/features/video/core/graph.ts:1 — invokeai/frontend/webv2/src/features/video/core/graph.ts has 1059 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R7 · Dead Code · Dead file (~66 LoC) · ×1
  • Dead file (~66 LoC) invokeai/frontend/webv1/src/features/nodes/types/common.test-d.ts — no import path from any entry point (456 application, 17 tooling, 1335 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~19 LoC) · ×1
  • Dead file (~19 LoC) invokeai/frontend/webv2/src/workbench/workbenchAggregateInterface.type-test.ts — no import path from any entry point (456 application, 17 tooling, 1335 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~18 LoC) · ×1
  • Dead file (~18 LoC) invokeai/frontend/webv1/src/features/nodes/types/workflow.test-d.ts — no import path from any entry point (456 application, 17 tooling, 1335 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~15 LoC) · ×1
  • Dead file (~15 LoC) invokeai/frontend/webv2/src/platform/ui/Button.type-test.tsx — no import path from any entry point (456 application, 17 tooling, 1335 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~12 LoC) · ×1
  • Dead file (~12 LoC) invokeai/frontend/webv2/src/workbench/widgetRegionItems.ts — no import path from any entry point (456 application, 17 tooling, 1335 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~3 LoC) · ×1
  • Dead file (~3 LoC) invokeai/frontend/webv2/src/workbench/settings/index.ts — no import path from any entry point (456 application, 17 tooling, 1335 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~2 LoC) · ×1
  • Dead file (~2 LoC) invokeai/frontend/webv2/src/workbench/palette/index.ts — no import path from any entry point (456 application, 17 tooling, 1335 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
X18 · Disposal-pattern correctness · Disposes a dependency it does not own · ×1
  • Disposes a dependency it does not own invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/persistenceController.ts:49 — `store` is never created by `PersistenceController` — it is the constructor parameter `store` (line 17), and its declared type `BitmapStore` is an interface — yet this class disposes it here (line 49). The instance came from whoever resolved it, and that owner decides when it ends. Disposing it from here reaches outside this object's lifetime: a dependency shared with the rest of the program is torn down when THIS instance goes away, and the real owner's later `dispose()` runs a second time on an object already disposed. Drop the call — a class disposes what it constructed, and only that. If this dependency genuinely is exclusive to this instance, construct it here (or take an owned factory) so the ownership is stated in the code rather than assumed.
X29 · Per-element action decided by a fixed element · Per-element action decided by a fixed element · ×1
  • Per-element action decided by a fixed element invokeai/frontend/webv2/src/workbench/launchpad/projects/projectLibraryView.ts:148 — This loop runs once per element of `groups`, and the statement it guards acts on the element it is on — `group`. The test deciding whether that statement runs does not: `showHeadings` reads `groups[0]`, a subscript that does not move, so whatever it answers for that one element it answers for ALL of them. One `if` names the same collection at two different subscripts — the fixed one at line 145, which is the contradiction: either the test was meant to be per-element, in which case every element that differs from the fixed one is handled wrongly and all in the same direction, or it really is one answer for the whole collection, in which case it is being re-asked on every pass and belongs above the loop. The `if` is in the wrong place under both readings. Give the test the loop variable, or hoist it out.
Minor — 907 finding(s)
D34 · Knowledge Freshness · Orphaned file · ×442
  • Orphaned file invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityFilterer.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file invokeai/app/util/controlnet_utils.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file invokeai/frontend/webv1/src/features/imageActions/actions.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file invokeai/app/services/shared/sqlite_migrator/migrations/migration_1.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file invokeai/backend/image_util/normal_bae/nets/submodules/efficientnet_repo/geffnet/mobilenetv3.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file invokeai/app/services/shared/sqlite_migrator/sqlite_migrator_common.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasColorPickerToolModule.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file invokeai/backend/flux/extensions/regional_prompting_extension.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file invokeai/frontend/webv1/src/features/deleteImageModal/store/state.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file invokeai/frontend/webv1/src/features/controlLayers/components/RasterLayer/RasterLayerCurvesAdjustmentsGraph.tsx:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasEraserToolModule.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file invokeai/frontend/webv1/src/features/controlLayers/store/selectors.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file invokeai/frontend/webv1/src/features/nodes/types/v2/field.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file invokeai/frontend/webv1/src/features/nodes/store/util/fieldValidators.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file invokeai/app/invocations/wan/wan_lora_loader.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file invokeai/backend/flux/controlnet/state_dict_utils.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file invokeai/backend/image_util/normal_bae/nets/submodules/efficientnet_repo/geffnet/conv2d_layers.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasManager.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file invokeai/frontend/webv1/src/common/hooks/useImageUploadButton.tsx:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file invokeai/backend/image_util/dw_openpose/onnxpose.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file invokeai/app/invocations/tiles.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file invokeai/backend/model_hash/hash_validator.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file invokeai/frontend/webv1/src/features/nodes/util/graph/generation/addControlAdapters.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/RelatedModels.tsx:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file invokeai/backend/image_util/lineart_anime.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • + 417 more in this group — see findings.md.
D10 · Test Quality · Mock-dominated test · ×193
  • Mock-dominated test: reads the board listing alongside generator resolution and dispatches only once both have answered invokeai/frontend/webv2/src/workbench/invocationSubmit.test.ts:226 — This test sets up 4 test doubles (for example `vi.spyOn`) against 3 real object(s) of its own, and its only verification is 4 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: carries the captured project and workflow through generator resolution to the dispatch invokeai/frontend/webv2/src/workbench/invocationSubmit.test.ts:312 — This test sets up 3 test doubles (for example `vi.spyOn`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: queues nothing for a workflow the captured project no longer owns invokeai/frontend/webv2/src/workbench/invocationSubmit.test.ts:341 — This test sets up 3 test doubles (for example `vi.spyOn`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: keeps Invoke Front on a Workflow dispatch invokeai/frontend/webv2/src/workbench/invocationSubmit.test.ts:550 — This test sets up 3 test doubles (for example `vi.spyOn`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: leaves drafts alone when the page is hidden before loading or after its account lifetime ended invokeai/frontend/webv2/src/workbench/persistenceRuntime.test.ts:1275 — This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 2 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: cycles all modes through the M command and keeps swap and exit separate invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewCompare.browser.test.tsx:257 — This test sets up 4 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 5 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: offers 100% at a fit just past it, though both read as 100%, and not at an exact 100% fit invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewHeaderActions.browser.test.tsx:383 — This test sets up 3 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: refreshes a loaded map when the socket reconnects, and detaches cleanly invokeai/frontend/webv2/src/workbench/widgets/image-map/ImageMapDataRuntime.test.ts:255 — This test sets up 4 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 5 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: %s runs the bar’s %s action for the candidate invokeai/frontend/webv2/src/workbench/widgets/canvas/StagingItemContextMenu.browser.test.tsx:175 — This test sets up 4 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: anchors the zoom at the viewport centre invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHeaderCommands.test.ts:55 — This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: re-reads the viewport size on every call invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHeaderCommands.test.ts:61 — This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: commits one undoable setCanvasBbox whose inverse restores the current bbox invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHeaderCommands.test.ts:69 — This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: is inert with a null rect (nothing to fit to) invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHeaderCommands.test.ts:89 — This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: is inert while editing is locked, even with a valid rect invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHeaderCommands.test.ts:96 — This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: fitBboxToLayers commits the layers rect and re-fits invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHeaderCommands.test.ts:105 — This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: fitBboxToMasks commits the masks rect and does NOT re-fit invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHeaderCommands.test.ts:116 — This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: newSession opens the confirm dialog instead of replacing directly invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHeaderCommands.test.ts:127 — This test sets up 4 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: fit commands are inert with no rect to fit to invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHeaderCommands.test.ts:135 — This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: %s zooms to %d× about the viewport centre invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHeaderCommands.test.ts:154 — This test sets up 4 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: ignores an unknown command id invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHeaderCommands.test.ts:166 — This test sets up 4 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: quick switch prefers the bookmark, falls back to the previous selection, and skips missing layers invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHotkeyCommands.test.ts:250 — This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 4 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: reports when whole-layer duplication throws invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHotkeyCommands.test.ts:416 — This test sets up 3 test doubles (for example `vi.fn`) against 1 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: explains a %s whole-layer duplication refusal invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHotkeyCommands.test.ts:426 — This test sets up 3 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: resetSelected explains a refused clear and stays silent when there is nothing to clear invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHotkeyCommands.test.ts:613 — This test sets up 3 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: reports a merge the engine refused invokeai/frontend/webv2/src/workbench/widgets/canvas/canvasHotkeyCommands.test.ts:641 — This test sets up 3 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • + 168 more in this group — see findings.md.
D24 · Comment Value · redundant comment · ×59
  • redundant comment invokeai/frontend/api/scripts/typegen.js:18 — "`Record<string, unknown>` type" repeats the code it sits on: 4 of its 4 words (record, string, unknown, type) are already in `const RECORD_STRING_UNKNOWN = ts.factory.createTypeReferenceNode(ts.factory.createIdentifier('Record'), [`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/modelSelected.test.ts:160 — "Mock i18next" repeats the code it sits on: 3 of its 3 words (mock, 18, next) are already in `vi.mock('i18next', () => ({`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/modelSelected.test.ts:339 — "Find the dispatched actions for Anima encoders" repeats the code it sits on: 4 of its 5 words (find, dispatched, anima, encoders) are already in `const qwen3Dispatch = dispatched.find((a) => a.type === animaQwen3EncoderModelSelected.type);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment invokeai/frontend/webv1/src/common/util/promptAST.ts:397 — "consume method close paren" repeats the code it sits on: 4 of its 4 words (consume, method, close, paren) are already in `const methodCloseParen = consume()!;`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment invokeai/frontend/webv1/src/common/util/promptAttention.test.ts:92 — "Cross-Boundary Selection" repeats the code it sits on: 3 of its 3 words (cross, boundary, selection) are already in `describe('cross-boundary selection', () =>`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment invokeai/frontend/webv1/src/common/util/promptAttention.test.ts:144 — "Numeric Attention Weights" repeats the code it sits on: 3 of its 3 words (numeric, attention, weights) are already in `describe('numeric attention weights', () =>`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment invokeai/frontend/webv1/src/common/util/promptAttention.test.ts:473 — "Selection Preservation with Prompt Functions" repeats the code it sits on: 4 of its 4 words (selection, preservation, prompt, functions) are already in `describe('selection preservation with prompt functions', () =>`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment invokeai/frontend/webv1/src/common/util/promptAttention.ts:82 — "Check if the added direction cancels the current one" repeats the code it sits on: 4 of its 5 words (check, added, cancels, current) are already in `const isCancel = (current.startsWith('+') && added === '-') || (current.startsWith('-') && added === '+');`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFieldRenderer.tsx:424 — "For other field types, show a read-only message" repeats the code it sits on: 5 of its 6 words (field, types, show, read, only) are already in `log.warn(`Unsupported field type "${fieldType}" for field "${label}" - showing as read-only`);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment invokeai/frontend/webv1/src/features/controlLayers/hooks/useAutoFitBBoxToMasks.ts:12 — "Get the rect of all visible inpaint masks" repeats the code it sits on: 5 of its 5 words (get, rect, visible, inpaint, masks) are already in `const visibleRect = canvasManager.compositor.getVisibleRectOfType('inpaint_mask');`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment invokeai/frontend/webv1/src/features/controlLayers/hooks/useCanvasProjectLoad.ts:68 — "Collect all image names referenced in the state" repeats the code it sits on: 4 of its 5 words (collect, image, names, state) are already in `const imageNames = collectImageNames(canvasState, refImages);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment invokeai/frontend/webv1/src/features/controlLayers/hooks/useCanvasProjectLoad.ts:106 — "Remap image names in state objects" repeats the code it sits on: 4 of its 5 words (remap, image, names, state) are already in `const remappedCanvasState = remapCanvasState(canvasState, imageNameMapping);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment invokeai/frontend/webv1/src/features/controlLayers/hooks/useCanvasProjectSave.ts:56 — "Collect all image names referenced in the state" repeats the code it sits on: 4 of its 5 words (collect, image, names, state) are already in `const imageNames = collectImageNames(projectState, refImagesState.entities);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasCompositorModule.ts:544 — "Get the canvas from the adapter" repeats the code it sits on: 3 of its 3 words (get, canvas, adapter) are already in `const adapterCanvas = adapter.getCanvas(rect);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasCompositorModule.ts:555 — "Draw the original adapter canvas to the temp canvas" repeats the code it sits on: 4 of its 5 words (draw, adapter, canvas, temp) are already in `tempCtx.drawImage(adapterCanvas, 0, 0);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityFilterer.ts:183 — "Add the group to the parent layer" repeats the code it sits on: 4 of its 4 words (add, group, parent, layer) are already in `this.parent.konva.layer.add(this.konva.group);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts:388 — "Add bbox rect and transformer to bbox group" repeats the code it sits on: 4 of its 5 words (add, bbox, rect, group) are already in `this.konva.bboxGroup.add(this.konva.bboxRect);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts:1170 — "Run the graph and get the segmented image output" repeats the code it sits on: 5 of its 6 words (run, graph, segmented, image, output) are already in `const segmentResult = await withResultAsync(() =>`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment invokeai/frontend/webv1/src/features/controlLayers/store/canvasSlice.ts:361 — 7 comments in this file only repeat the code they sit on (lines 361, 529, 569, 640, 642, 832, 1166), for example "Convert the raster layer to inpaint mask". Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment invokeai/frontend/webv1/src/features/controlLayers/store/validators.ts:138 — 5 comments in this file only repeat the code they sit on (lines 138, 146, 185, 208, 279), for example "No model selected". Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment invokeai/frontend/webv1/src/features/cropper/lib/editor.ts:1272 — "Update handle scaling" repeats the code it sits on: 3 of its 3 words (update, handle, scaling) are already in `this.updateKonvaCropInteractionHandleScales();`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment invokeai/frontend/webv1/src/features/cropper/lib/editor.ts:1328 — "Update handle scaling" repeats the code it sits on: 3 of its 3 words (update, handle, scaling) are already in `this.updateKonvaCropInteractionHandleScales();`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment invokeai/frontend/webv1/src/features/cropper/lib/editor.ts:1366 — "Update handle scaling" repeats the code it sits on: 3 of its 3 words (update, handle, scaling) are already in `this.updateKonvaCropInteractionHandleScales();`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment invokeai/frontend/webv1/src/features/dnd/dnd.ts:176 — 10 comments in this file only repeat the code they sit on (lines 176, 204, 232, 260, 285, 311, 337, 388, 420, 479), for example "#region Set Global Reference Image". Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment invokeai/frontend/webv1/src/features/gallery/components/ContextMenu/ImageContextMenu.tsx:226 — "Context menu events" repeats the code it sits on: 3 of its 3 words (context, menu, events) are already in `window.addEventListener('contextmenu', onContextMenu, { signal: controller.signal });`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • + 34 more in this group — see findings.md.
X4 · Structured logging · Interpolated log message defeats structured logging · ×40
  • Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:127 — `trace` at line 127 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.trace({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.trace('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
  • Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:534 — `trace` at line 534 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.trace({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.trace('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
  • Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:562 — `error` at line 562 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.error({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.error('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
  • Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:633 — `warn` at line 633 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
  • Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:659 — `debug` at line 659 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
  • Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:663 — `trace` at line 663 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.trace({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.trace('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
  • Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/onInvocationComplete.tsx:761 — `trace` at line 761 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.trace({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.trace('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
  • Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/onQueueItemStatusChanged.tsx:48 — `debug` at line 48 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
  • Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:98 — `debug` at line 98 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
  • Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:226 — `trace` at line 226 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.trace({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.trace('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
  • Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:230 — `debug` at line 230 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
  • Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:236 — `trace` at line 236 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.trace({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.trace('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
  • Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:240 — `trace` at line 240 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.trace({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.trace('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
  • Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:262 — `trace` at line 262 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.trace({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.trace('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
  • Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:266 — `error` at line 266 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.error({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.error('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
  • Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:638 — `debug` at line 638 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
  • Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:640 — `warn` at line 640 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
  • Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:644 — `error` at line 644 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.error({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.error('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
  • Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:650 — `info` at line 650 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
  • Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:655 — `debug` at line 655 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
  • Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:680 — `debug` at line 680 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
  • Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:682 — `warn` at line 682 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.warn({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.warn('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
  • Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:686 — `error` at line 686 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.error({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.error('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
  • Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:690 — `info` at line 690 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.info({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.info('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
  • Interpolated log message defeats structured logging invokeai/frontend/webv1/src/services/events/setEventListeners.tsx:695 — `debug` at line 695 is handed a template literal with `${…}` substitutions as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass the values beside a constant message instead: `logger.debug({ orderId, status }, 'order status updated')` for pino and bunyan, `logger.debug('order status updated', { orderId, status })` for winston. If these calls go through a NestJS `Logger` routed into pino, nestjs-pino forwards an object first argument as fields in the same way.
  • + 15 more in this group — see findings.md.
X10 · Duplicated predicate · Duplicated predicate · ×25
  • Duplicated predicate invokeai/frontend/webv2/src/workbench/canvas-engine/document/insertionAnchors.ts:122 — `!!entry && entry.stack === stack && isGroupNode(entry.node)` appears character-identically in 2 files — invokeai/frontend/webv2/src/workbench/canvas-engine/document/insertionAnchors.ts, invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate invokeai/frontend/webv1/src/features/controlLayers/components/RefImage/RefImagePreview.tsx:88 — `!!mainModelConfig && isExternalApiModelConfig(mainModelConfig)` appears character-identically in 2 files — invokeai/frontend/webv1/src/features/controlLayers/components/RefImage/RefImagePreview.tsx, invokeai/frontend/webv1/src/features/controlLayers/components/RefImage/RefImageSettings.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate invokeai/frontend/webv1/src/features/controlLayers/components/RefImage/RefImageSettings.tsx:218 — `!!referenceImage && referenceImage.config.image !== null` appears character-identically in 2 files — invokeai/frontend/webv1/src/features/controlLayers/components/RefImage/RefImageSettings.tsx, invokeai/frontend/webv1/src/features/controlLayers/components/RegionalGuidance/RegionalGuidanceIPAdapterSettings.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate invokeai/frontend/webv1/src/features/nodes/util/workflowImageExport.ts:156 — `!Number.isFinite(pathBounds.x) || !Number.isFinite(pathBounds.y) || !Number.isFinite(pathBounds.width) || !Number.isFinite(pathBounds.height…` appears character-identically in 2 files — invokeai/frontend/webv1/src/features/nodes/util/workflowImageExport.ts, invokeai/frontend/webv2/src/features/workflow/ui/editor/workflowImageExport.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate invokeai/frontend/webv2/src/features/queue/ui/formatDuration.ts:9 — `!Number.isFinite(seconds) || seconds < 0` appears character-identically in 2 files — invokeai/frontend/webv2/src/features/queue/ui/formatDuration.ts, invokeai/frontend/webv2/src/workbench/image-map/indexProgress.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate invokeai/frontend/webv2/src/features/generation/core/promptTemplateOwnership.ts:31 — `!account.multiuserEnabled || record.userId === account.currentUserId` appears character-identically in 2 files — invokeai/frontend/webv2/src/features/generation/core/promptTemplateOwnership.ts, invokeai/frontend/webv2/src/features/generation/core/systemPrompts.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx:60 — `!currentUser || currentUser.is_admin || board.user_id === currentUser.user_id` appears character-identically in 2 files — invokeai/frontend/webv1/src/features/changeBoardModal/components/ChangeBoardModal.tsx, invokeai/frontend/webv1/src/services/api/hooks/useBoardAccess.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasBrushToolModule.ts:201 — `!cursorPos || !isPrimaryPointerDown || !selectedEntity` appears character-identically in 2 files — invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasBrushToolModule.ts, invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasEraserToolModule.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasBrushToolModule.ts:264 — `!cursorPos || !selectedEntity || !isPrimaryPointerDown` appears character-identically in 2 files — invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasBrushToolModule.ts, invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasEraserToolModule.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate invokeai/frontend/webv2/src/workbench/projects/invk/duplicateProject.ts:232 — `!didAttemptProjectCreate && isAccountScopeCurrent(owner)` appears character-identically in 2 files — invokeai/frontend/webv2/src/workbench/projects/invk/duplicateProject.ts, invokeai/frontend/webv2/src/workbench/projects/projectFile.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate invokeai/frontend/webv1/src/features/nodes/components/flow/panels/TopPanel/SaveWorkflowButton.tsx:20 — `!doesWorkflowHaveUnsavedChanges || !isCurrentWorkflowOwner` appears character-identically in 3 files — invokeai/frontend/webv1/src/features/nodes/components/flow/panels/TopPanel/SaveWorkflowButton.tsx, invokeai/frontend/webv1/src/features/nodes/components/sidePanel/WorkflowListMenu/SaveWorkflowButton.tsx, invokeai/frontend/webv1/src/features/workflowLibrary/components/WorkflowLibraryMenu/SaveWorkflowMenuItem.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/callSavedWorkflowFormUtils.ts:114 — `!element || element.type !== 'node-field'` appears character-identically in 2 files — invokeai/frontend/webv1/src/features/nodes/components/flow/nodes/Invocation/callSavedWorkflowFormUtils.ts, invokeai/frontend/webv2/src/features/workflow/core/document.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate invokeai/frontend/webv2/src/workbench/shell/topbar/LayoutPresetManagerDialogBody.tsx:75 — `!event.over || event.active.id === event.over.id` appears character-identically in 2 files — invokeai/frontend/webv2/src/workbench/shell/topbar/LayoutPresetManagerDialogBody.tsx, invokeai/frontend/webv2/src/workbench/shell/topbar/LayoutPresetStrip.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate invokeai/frontend/webv1/src/features/controlLayers/components/RefImage/RefImageImage.tsx:83 — `!imageDTO || (tab === 'canvas' && isStaging)` appears character-identically in 2 files — invokeai/frontend/webv1/src/features/controlLayers/components/RefImage/RefImageImage.tsx, invokeai/frontend/webv1/src/features/controlLayers/components/RegionalGuidance/RegionalGuidanceRefImageImage.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate invokeai/frontend/webv2/src/workbench/shell/CenterArea.tsx:452 — `!instance || !widget || widget.status !== 'enabled'` appears character-identically in 2 files — invokeai/frontend/webv2/src/workbench/shell/CenterArea.tsx, invokeai/frontend/webv2/src/workbench/shell/Panels.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate invokeai/frontend/webv2/src/features/gallery/data/realtimeRuntime.ts:67 — `!isActive() || invalidationTimer !== null` appears character-identically in 2 files — invokeai/frontend/webv2/src/features/gallery/data/realtimeRuntime.ts, invokeai/frontend/webv2/src/features/queue/data/realtimeRuntime.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts:107 — `!isClosed && !isUnavailable && isWorkbenchDatabaseAvailable(database)` appears character-identically in 3 files — invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts, invokeai/frontend/webv2/src/workbench/queue-integration/queueRecallCache.ts, invokeai/frontend/webv2/src/workbench/queue-integration/queueRunJournal.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate invokeai/frontend/webv1/src/features/queue/hooks/useCancelAllExceptCurrentQueueItem.ts:39 — `!isConnected || !queueStatus?.queue.pending` appears character-identically in 2 files — invokeai/frontend/webv1/src/features/queue/hooks/useCancelAllExceptCurrentQueueItem.ts, invokeai/frontend/webv1/src/features/queue/hooks/useDeleteAllExceptCurrentQueueItem.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate invokeai/frontend/webv2/src/app/QueueRuntimeAdapter.tsx:60 — `!isDisposed && isAccountScopeCurrent(owner)` appears character-identically in 3 files — invokeai/frontend/webv2/src/app/QueueRuntimeAdapter.tsx, invokeai/frontend/webv2/src/features/queue/runtime.ts, invokeai/frontend/webv2/src/features/queue/runtime/coordinator.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate invokeai/frontend/webv2/src/workbench/widgets/preview/useCompareLoupe.ts:103 — `!isFit && actualZoom >= PIXELATED_ACTUAL_ZOOM` appears character-identically in 2 files — invokeai/frontend/webv2/src/workbench/widgets/preview/useCompareLoupe.ts, invokeai/frontend/webv2/src/workbench/widgets/preview/usePreviewLoupe.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate invokeai/frontend/webv1/src/features/auth/components/AdministratorSetup.tsx:38 — `!isLoadingSetup && setupStatus && !setupStatus.multiuser_enabled` appears character-identically in 2 files — invokeai/frontend/webv1/src/features/auth/components/AdministratorSetup.tsx, invokeai/frontend/webv1/src/features/auth/components/LoginPage.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasBrushToolModule.ts:427 — `!lastPoint || !isDistanceMoreThanMin(cursorPos.relative, lastPoint, minDistance)` appears character-identically in 2 files — invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasBrushToolModule.ts, invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasEraserToolModule.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/textEditingController.ts:79 — `!next.fontVariations || Object.keys(next.fontVariations).length === 0` appears character-identically in 2 files — invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/textEditingController.ts, invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/TextOptions.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/filterResultController.ts:105 — `!o.ctx.isPermitCurrent(permit) || o.ctx.isGestureActive()` appears character-identically in 2 files — invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/filterResultController.ts, invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/stagedResultController.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate invokeai/frontend/webv2/src/workbench/widgets/preview/useCompareLoupe.ts:374 — `!pinch.pointerIds.includes(event.pointerId) || !first || !second` appears character-identically in 2 files — invokeai/frontend/webv2/src/workbench/widgets/preview/useCompareLoupe.ts, invokeai/frontend/webv2/src/workbench/widgets/preview/usePreviewLoupe.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
AX6 · Interface segregation · Fat interface · ×16
  • Fat interface: GalleryCommandsPort (19 required operations) invokeai/frontend/webv2/src/features/gallery/ui/GalleryUiContext.tsx:69 — `GalleryCommandsPort` declares 19 required operations: `clearSelection`, `reconcileDeletedBoardOutcome`, `selectBoard`, `selectItem`, `selectImage`, `setCompareItem`, `setCompareImage`, `setItemMultiSelection`, `setPage`, `setPageInfo`, `setSearchTerm`, `setStarredOnly`, `setSemanticSearchMode`, `setSemanticSearchText`, `commitSemanticSearch`, `clearSearch`, `setView`, `toggleItemSelection`, `updateSettings`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: GalleryActions (27 required operations) invokeai/frontend/webv2/src/features/gallery/ui/GalleryWidgetContext.tsx:22 — `GalleryActions` declares 27 required operations: `archiveBoard`, `clearSelection`, `createBoard`, `deleteBoard`, `downloadBoard`, `exportProject`, `loadMore`, `moveBoard`, `refresh`, `renameBoard`, `setBoardGeneralAccess`, `selectBoard`, `selectItem`, `selectItemRange`, `setCompareItem`, `setSearchTerm`, `setSearchScope`, `setStarredOnly`, `clearSearch`, `commitSemanticSearch`, `setSemanticImageQuery`, `setSemanticSearchMode`, `setSemanticSearchText`, `setView`, `toggleItemInSelection`, `updateSettings`, `uploadFiles`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: QueueBackendPort (20 required operations) invokeai/frontend/webv2/src/features/queue/core/types.ts:331 — `QueueBackendPort` declares 20 required operations: `claimItemDelivery`, `cancelQueueItems`, `cancelQueueItemsByBatchIds`, `enqueueGenerate`, `enqueueWorkflow`, `getItem`, `getResultImages`, `getResultVideoNames`, `getResultVideos`, `listItems`, `readCurrent`, `readItemIds`, `readItemsById`, `readNext`, `readStatus`, `readItemDetail`, `retryItems`, `emit`, `on`, `onConnectionChange`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: ProjectDraftStore (24 required operations) invokeai/frontend/webv2/src/workbench/projects/draftStore.ts:270 — `ProjectDraftStore` declares 24 required operations: `adopt`, `acknowledgeRetarget`, `claimWriter`, `close`, `delete`, `deleteCorrupt`, `discardUnloadJournal`, `get`, `journalBeforeUnload`, `list`, `listForProject`, `listRetargets`, `peekUnloadJournalProjectIds`, `reconcileUnloadJournal`, `reserveCopyIdentity`, `resumeDraft`, `rebaseDraft`, `retargetAcknowledgedCopy`, `settleAcknowledgement`, `settleConflict`, `settleSchemaRefusal`, `settleUnloadJournal`, `stage`, `startFreshWriter`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: DurableSyncedWorkbenchPersistence (31 required operations) invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts:508 — `DurableSyncedWorkbenchPersistence` declares 31 required operations: `acknowledgeProjectResolution`, `abortProjectResolution`, `adoptProjectRecord`, `clearWorkbench`, `close`, `deleteRecoverableDraft`, `deleteProjectOnServer`, `ensureProjectOnServer`, `flushProjectToServer`, `getProjectDraftDocument`, `getRecoverableDraftDocument`, `hasClosedSession`, `journalBeforeUnload`, `hasChangesUnloadWouldLose`, `isUnloadAtRisk`, `hasPendingChanges`, `hydrateProjectFromServer`, `loadWorkbench`, `listRecoverableDrafts`, `markProjectDeleted`, `persistEmptySession`, `releaseMutationLocks`, `reopenSession`, `subscribeSessionReopened`, `resolveConflictDiscard`, `resolveConflictSaveAsNew`, `resolveConflictUseServer`, `releaseProjectSync`, `retain`, `saveWorkbench`, `unmarkProjectDeleted`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: PersistenceAggregatePort (17 required operations) invokeai/frontend/webv2/src/workbench/persistenceRuntime.ts:11 — `PersistenceAggregatePort` declares 17 required operations: `assignProjectBoard`, `getPersistedRevision`, `getState`, `hydrate`, `notifyProjectNotFound`, `reportLoadAvailable`, `reportLoadError`, `reportLoadUnavailable`, `reportRefusedProjects`, `saveFailed`, `saveNeedsAttention`, `savePending`, `saveScheduled`, `saveStarted`, `saveSucceeded`, `setHasHydrated`, `subscribe`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: LayerRowCommands (22 required operations) invokeai/frontend/webv2/src/workbench/widgets/layers/layerRowCommands.ts:19 — `LayerRowCommands` declares 22 required operations: `select`, `focus`, `toggleExpanded`, `setEnabled`, `setHidden`, `setLocked`, `startRename`, `rename`, `endRename`, `openMenu`, `openStackMenu`, `toggleCollapse`, `toggleChildren`, `selectChild`, `setChildEnabled`, `removeChild`, `renameChild`, `moveChild`, `moveChildToLayer`, `duplicateChild`, `openChildMenu`, `keyDown`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: LayerContextActionEffects (33 required operations) invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.ts:159 — `LayerContextActionEffects` declares 33 required operations: `reorder`, `duplicate`, `mergeSelected`, `mergeMasks`, `group`, `removeFromGroup`, `openRename`, `openRunWorkflow`, `startSelectObject`, `startFilter`, `transform`, `fitToBbox`, `openProperties`, `saveToBoard`, `copyToClipboard`, `cropToBbox`, `extractMaskedArea`, `booleanMerge`, `copyTo`, `rasterize`, `convertTo`, `patchConfig`, `addReferenceImage`, `addMaskModifier`, `addAdjustment`, `addLayerRegion`, `setColorLabel`, `mergeDown`, `toggleVisibility`, `toggleHidden`, `toggleLock`, `toggleQuickSwitchBookmark`, `delete`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: LayerCacheStore (21 required operations) invokeai/frontend/webv2/src/workbench/canvas-engine/render/layerCache.ts:82 — `LayerCacheStore` declares 21 required operations: `peek`, `layerIds`, `get`, `getOrCreate`, `getOrCreateRect`, `growToRect`, `shrinkToRect`, `prepareReplacement`, `installReplacement`, `publishRasterized`, `captureState`, `restoreState`, `publishPixels`, `damageSince`, `invalidate`, `delete`, `version`, `revision`, `byteSize`, `evict`, `dispose`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: CanvasEngineLayerCapability (29 required operations) invokeai/frontend/webv2/src/workbench/canvas-engine/capabilities.ts:744 — `CanvasEngineLayerCapability` declares 29 required operations: `applyTransform`, `beginTransform`, `booleanMergeRasterLayers`, `cancelTextEdit`, `cancelTransform`, `clearMask`, `commitLayerConversion`, `commitLayerCopy`, `commitMaskImageResult`, `commitOpenTextSession`, `commitRasterFilterResult`, `commitTextEdit`, `convertLayerToControl`, `copyLayerToControl`, `copyLayerToRaster`, `cropAllLayersToBbox`, `cropLayerToBbox`, `duplicateLayers`, `mergeInpaintMasks`, `mergeLayerDown`, `mergeSelectedRasterLayers`, `mergeVisibleRasterLayers`, `nudgeSelectedLayer`, `openTextCreate`, `openTextEdit`, `rasterizeLayer`, `setTextEditContentReader`, `updateTextEditStyle`, `updateTransformSession`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: CanvasApplicationHost (27 required operations) invokeai/frontend/webv2/src/workbench/canvas-engine/applicationHost.ts:42 — `CanvasApplicationHost` declares 27 required operations: `captureGuard`, `clearFilterPreview`, `clearSamPreview`, `commitFilter`, `commitGenerated`, `commitMask`, `decodeSelectObjectPreview`, `encodeSurface`, `exportBakedLayerBlob`, `flushLayerUploads`, `exportLayerPixels`, `getCompositeExecutorDeps`, `getDocument`, `isGuardCurrent`, `isSamToolActive`, `prepareSelectObjectStart`, `publishFilterPreview`, `publishSamPreview`, `replaceSelection`, `replaceTemporaryRestoreTool`, `selectLayer`, `setSamInputHandler`, `setEscapeHandler`, `setSamInteraction`, `setSamTool`, `setViewTool`, `subscribeToolChanges`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: PixelEditControllerOptions (17 required operations) invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/controlPixelController.ts:43 — `PixelEditControllerOptions` declares 17 required operations: `canEdit`, `deleteDerived`, `getActiveProjectId`, `getAdjustedSurface`, `peekAdjustedSurface`, `getAdjustmentStatus`, `getDocument`, `getTransformSession`, `installPrepared`, `invalidate`, `isCacheReady`, `isOperationIdle`, `notifyPainted`, `preparePixels`, `publishStroke`, `reportRefusal`, `setTransformOverride`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: PointerPipeline (16 required operations) invokeai/frontend/webv2/src/workbench/canvas-engine/input/pointerPipeline.ts:66 — `PointerPipeline` declares 16 required operations: `onPointerDown`, `onPointerMove`, `onPointerUp`, `onPointerCancel`, `onPointerEnter`, `onPointerLeave`, `onKeyDown`, `onKeyUp`, `onFocusIn`, `isGestureActive`, `hoverPoint`, `cancelActiveGesture`, `endForToolSwitch`, `replaceTemporaryRestoreTool`, `heldRestoreToolId`, `reset`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: CanvasOperationCapability (26 required operations) invokeai/frontend/webv2/src/workbench/canvas-operations/contracts.ts:63 — `CanvasOperationCapability` declares 26 required operations: `composeForGeneration`, `uploadIntermediate`, `getOperationState`, `subscribeOperation`, `getFilterSessionState`, `subscribeFilterSession`, `getSamSessionState`, `subscribeSamSession`, `startSelectObject`, `startFilterOperation`, `updateFilterOperation`, `setFilterOperationAutoProcess`, `processFilterOperation`, `resetFilterOperation`, `commitFilterOperation`, `cancelFilterOperation`, `updateSelectObjectSession`, `processSelectObjectSession`, `applySelectObjectSession`, `saveSelectObjectSession`, `resetSelectObjectSession`, `cancelSelectObjectSession`, `applyControlLayerIntent`, `retryControlDetection`, `getControlDetectionStatus`, `subscribeControlDetectionStatus`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: CanvasSelectObjectCoordinatorDeps (19 required operations) invokeai/frontend/webv2/src/workbench/canvas-operations/contracts.ts:202 — `CanvasSelectObjectCoordinatorDeps` declares 19 required operations: `prepareStart`, `selectLayer`, `clearOtherOperation`, `setSamTool`, `setViewTool`, `replaceTemporaryRestoreTool`, `isSamToolActive`, `captureGuard`, `isGuardCurrent`, `exportSource`, `uploadIntermediate`, `runGraph`, `decodePreview`, `publishPreview`, `clearPreview`, `invalidateOverlay`, `commitGenerated`, `commitMask`, `replaceSelection`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: ImageActions (22 required operations) invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts:110 — `ImageActions` declares 22 required operations: `copyImage`, `createCanvasFromImages`, `deleteImages`, `deriveImageRecallCapabilities`, `downloadImage`, `downloadImages`, `generatePbrMaps`, `loadImageWorkflow`, `loadVideoWorkflow`, `moveImagesToBoard`, `openImageInPreview`, `recallImageData`, `recallVideoData`, `sendToInitialVideo`, `savePromptAsTemplate`, `selectForCompare`, `sendToCanvas`, `sendImageAsControl`, `setImagesStarred`, `useAsReferenceImage`, `useAsReferenceVideo`, `useAsConditioningClip`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
X7 · Silent fallback defaults · Silent fallback default in catch · ×16
  • Silent fallback default in catch invokeai/app/api/sockets.py:444 — `_running_queue_item_owners` swallows every exception into `return set()` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch invokeai/app/services/session_queue/session_queue_default.py:460 — `_get_device_resident_model_keys` swallows every exception into `return set()` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch invokeai/backend/model_manager/load/model_cache/model_cache.py:2443 — `_get_reclaimable_allocator_bytes` swallows every exception into `return 0` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch invokeai/backend/quantization/fp8_scaled.py:883 — `_probe_fp8_matmul` swallows every exception into `return False` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch invokeai/backend/quantization/int8_convrot.py:211 — `parse_comfy_quant_bytes` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch invokeai/backend/quantization/int8_convrot.py:220 — `parse_comfy_quant_marker` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch invokeai/backend/util/wddm.py:391 — `_counter_values` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch invokeai/backend/working_memory/counters.py:278 — `_sample` swallows every exception into `return ()` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch invokeai/frontend/webv2/src/features/gallery/ui/GalleryItemSearch.tsx:59 — `getSemanticReferenceName` swallows every exception into `return ''` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch invokeai/frontend/webv2/src/features/queue/runtime/receiptAcknowledgements.ts:59 — `createQueueReceiptAcknowledgements.drain` swallows every exception into `return false` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch invokeai/frontend/webv2/src/features/workflow/core/layerWorkflow.ts:349 — `getRunnableLayerWorkflowInputs` swallows every exception into `return false` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch invokeai/frontend/webv2/src/platform/ui/colorPickerStore.ts:72 — `parseRecents` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch invokeai/frontend/webv2/src/workbench/projects/covers.ts:69 — `parseProjectCovers` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch invokeai/frontend/webv2/src/workbench/widgets/canvas/toolFamilyStore.ts:18 — `readStored` swallows every exception into `return 'marquee'` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch invokeai/frontend/webv2/src/workbench/palette/recents.ts:51 — `parseRecords` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-presentation/propertyGroupStore.ts:22 — `readStored` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
X7 · Silent fallback defaults · Pending state with no failure state · ×14
  • Pending state with no failure state invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasHeaderActions.tsx:406 — The view draws `<Spinner boxSize="3.5"/>` under `isSaving`, but `isSaving` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
  • Pending state with no failure state invokeai/frontend/webv2/src/workbench/projects/components/OpenProjectDialog.tsx:220 — The view draws `<Spinner color="fg.muted"/>` under `isBusy`, but `isBusy` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
  • Pending state with no failure state invokeai/frontend/webv1/src/features/systemPrompts/components/SystemPromptsModal.tsx:63 — The view draws `<Spinner alignSelf="center"/>` under `isLoading`, but `isLoading` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
  • Pending state with no failure state invokeai/frontend/webv1/src/features/stylePresets/components/StylePresetExportButton.tsx:60 — The view draws `<PiSpinner/>` under `! isLoading`, but `isLoading` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
  • Pending state with no failure state invokeai/frontend/webv1/src/features/stylePresets/components/StylePresetImportButton.tsx:56 — The view draws `<PiSpinner/>` under `! isLoading`, but `isLoading` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
  • Pending state with no failure state invokeai/frontend/webv1/src/features/stylePresets/components/StylePresetForm/StylePresetModal.tsx:99 — The view draws `<Spinner/>` under `! stylePresetModalState . prefilledFormData || formData`, but `formData` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
  • Pending state with no failure state invokeai/frontend/webv1/src/features/queue/components/QueueList/QueueList.tsx:113 — The view draws `<IAINoContentFallbackWithSpinner/>` under `isLoading`, but `isLoading` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
  • Pending state with no failure state invokeai/frontend/webv1/src/features/nodes/components/sidePanel/workflow/WorkflowLibrary/WorkflowList.tsx:99 — The view draws `<Flex alignItems="center" justifyContent="center" w="full" h="full">` under `isLoading`, but `isLoading` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
  • Pending state with no failure state invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/ModelPanel/Model.tsx:37 — The view draws `<IAINoContentFallbackWithSpinner label= />` under `isLoading`, but `isLoading` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
  • Pending state with no failure state invokeai/frontend/webv1/src/features/modelManagerV2/subpanels/AddModelPanel/StarterModels/StarterModelsForm.tsx:15 — The view draws `<FetchingModelsLoader loadingMessage= />` under `isLoading`, but `isLoading` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
  • Pending state with no failure state invokeai/frontend/webv1/src/features/gallery/components/ImageMetadataViewer/ImageMetadataViewer.tsx:136 — The view draws `<IAINoContentFallbackWithSpinner label= />` under `isLoading`, but `isLoading` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
  • Pending state with no failure state invokeai/frontend/webv1/src/features/gallery/components/ImageGrid/GallerySearch.tsx:45 — The view draws `<InputRightElement h="full" pe= >` under `isFetching`, but `isFetching` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
  • Pending state with no failure state invokeai/frontend/webv1/src/features/customNodes/CustomNodesList.tsx:90 — The view draws `<Flex justifyContent="center" py= >` under `isLoading`, but `isLoading` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
  • Pending state with no failure state invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/CanvasWorkflowIntegrationWorkflowSelector.tsx:53 — The view draws `<Flex alignItems="center" gap= >` under `isLoading || isFiltering`, but `isLoading` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
P2 · Observability · Console output used as the logging channel · ×13
  • Console output used as the logging channel invokeai/frontend/webv1/src/services/events/useSocketIO.ts:154 — `invokeai/frontend/webv1/src/services/events/useSocketIO.ts` reports through `console.*` at line 154 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel invokeai/frontend/webv1/src/services/events/useSocketIO.ts:169 — `invokeai/frontend/webv1/src/services/events/useSocketIO.ts` reports through `console.*` at line 169 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts:311 — `invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts` reports through `console.*` at line 311 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts:313 — `invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts` reports through `console.*` at line 313 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts:397 — `invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts` reports through `console.*` at line 397 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts:399 — `invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts` reports through `console.*` at line 399 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts:444 — `invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts` reports through `console.*` at line 444 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts:446 — `invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts` reports through `console.*` at line 446 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasManager.ts:328 — `invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasManager.ts` reports through `console.*` at line 328 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel invokeai/frontend/webv1/src/app/store/middleware/debugLoggerMiddleware.ts:19 — `invokeai/frontend/webv1/src/app/store/middleware/debugLoggerMiddleware.ts` reports through `console.*` at line 19 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel invokeai/frontend/webv1/src/app/store/middleware/debugLoggerMiddleware.ts:23 — `invokeai/frontend/webv1/src/app/store/middleware/debugLoggerMiddleware.ts` reports through `console.*` at line 23 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel invokeai/frontend/webv1/src/app/store/middleware/debugLoggerMiddleware.ts:26 — `invokeai/frontend/webv1/src/app/store/middleware/debugLoggerMiddleware.ts` reports through `console.*` at line 26 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts:2713 — `invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts` reports through `console.*` at line 2713 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
X7 · Silent fallback defaults · Silent fallback default on parse failure · ×9
  • Silent fallback default on parse failure invokeai/app/services/image_index/projection.py:88 — `stored_projection_method` returns `'umap'` when `(ValueError, AttributeError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure invokeai/app/services/shared/database/queries/base.py:154 — `day_after` returns `''` when `(ValueError, OverflowError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure invokeai/app/services/shared/database/startup.py:102 — `redacted_database_url` returns `'***'` when `ValueError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure invokeai/app/services/shared/sqlite_migrator/migrations/migration_2026_08_06_add_project_boards.py:356 — `_collect_board_candidates` returns `set()` when `(TypeError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure invokeai/app/util/dynamicprompts.py:62 — `find_missing_wildcards` returns `[]` when `ParseException` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure invokeai/backend/ltx2/checkpoint_layout.py:75 — `header_config` returns `{}` when `ValueError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure scripts/family_e2e/bundle.py:237 — `_strip_url` returns `'<url>'` when `ValueError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure scripts/family_e2e/report.py:314 — `_node_types` returns `{}` when `(OSError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure scripts/family_e2e/runner.py:422 — `read_heartbeat` returns `{}` when `(OSError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
D16 · Bus Factor · Off-boarding risk · ×8
  • Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 638 significant file(s) lose their only recent owner: invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts, invokeai/frontend/webv2/src/workbench/canvas-engine/engine.ts, invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx, invokeai/frontend/webv2/src/workbench/projects/draftStore.ts, invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts, invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx, invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx, invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts (+630 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 129 significant file(s) lose their only recent owner: invokeai/backend/model_manager/load/model_loaders/z_image.py, REDACTED, invokeai/backend/quantization/int8_convrot.py, invokeai/backend/quantization/fp8_scaled.py, invokeai/app/invocations/krea2/krea2_denoise.py, invokeai/app/invocations/wan/wan_denoise.py, invokeai/backend/model_manager/configs/qwen3_encoder.py, invokeai/backend/model_manager/load/model_loaders/ideogram4.py (+121 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #3 — If anonymized user #3 becomes unavailable, 84 significant file(s) lose their only recent owner: invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts, invokeai/frontend/webv2/src/features/video/core/graph.ts, invokeai/frontend/webv2/src/features/video/core/settings.ts, invokeai/backend/ltx2/denoise.py, invokeai/app/api/routers/video_recall.py, invokeai/frontend/webv2/src/workbench/image-actions/videoRecall.ts, invokeai/app/util/video_thumbnails.py, invokeai/frontend/webv2/src/workbench/image-actions/executeVideoRecall.ts (+76 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #4 — If anonymized user #4 becomes unavailable, 58 significant file(s) lose their only recent owner: invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts, invokeai/frontend/webv1/src/features/cropper/lib/editor.ts, invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityTransformer.ts, invokeai/frontend/webv1/src/features/ui/layouts/navigation-api.ts, invokeai/frontend/webv1/src/features/controlLayers/konva/util.ts, invokeai/frontend/webv1/src/services/api/run-graph.ts, invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasManager.ts, invokeai/frontend/webv1/src/features/nodes/components/sidePanel/builder/ContainerElement.tsx (+50 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #5 — If anonymized user #5 becomes unavailable, 24 significant file(s) lose their only recent owner: invokeai/app/services/shared/graph.py, invokeai/app/services/shared/execution_engine/child.py, invokeai/app/services/shared/graph_scheduler.py, invokeai/frontend/webv2/src/features/workflow/ui/editor/workflowImageExport.ts, invokeai/app/services/shared/execution_effects.py, invokeai/frontend/webv2/src/features/workflow/core/forLoops.ts, invokeai/app/services/shared/graph_iterate_planner.py, invokeai/app/services/shared/graph_nested_iterate_planner.py (+16 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #6 — If anonymized user #6 becomes unavailable, 11 significant file(s) lose their only recent owner: invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasShapeToolModule.ts, invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasTextToolModule.ts, invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasGradientToolModule.ts, invokeai/frontend/webv1/src/features/controlLayers/components/InpaintMask/InpaintMaskMenuItemsExtractMaskedArea.tsx, invokeai/frontend/webv1/src/features/ui/layouts/canvasToolModifierHints.ts, invokeai/backend/stable_diffusion/hidiffusion_utils.py, invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/toolHotkeys.ts, invokeai/frontend/webv1/src/features/ui/layouts/DockviewCanvasHeaderActions.tsx (+3 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #7 — If anonymized user #7 becomes unavailable, 5 significant file(s) lose their only recent owner: invokeai/backend/flux/extensions/regional_prompting_extension.py, invokeai/backend/stable_diffusion/multi_diffusion_pipeline.py, invokeai/backend/flux/extensions/instantx_controlnet_extension.py, invokeai/backend/flux/controlnet/xlabs_controlnet_flux.py, invokeai/backend/patches/layers/merged_layer_patch.py. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #8 — If anonymized user #8 becomes unavailable, 3 significant file(s) lose their only recent owner: invokeai/backend/stable_diffusion/extensions/ip_adapter.py, invokeai/backend/stable_diffusion/diffusion_backend.py, invokeai/backend/stable_diffusion/denoise_context.py. Pair on, review, or document these before any departure.
IC1 · Incompleteness & stubs · Empty method body · ×3
  • Empty method body invokeai/frontend/webv2/src/workbench/focusRegions.tsx:387 — `focusAdjacentRegion` has an empty body — confirm it's an intentional no-op and not an unfinished method.
  • Empty method body invokeai/frontend/webv2/src/workbench/focusRegions.tsx:388 — `focusFloating` has an empty body — confirm it's an intentional no-op and not an unfinished method.
  • Empty method body invokeai/frontend/webv2/src/workbench/focusRegions.tsx:389 — `focusRegion` has an empty body — confirm it's an intentional no-op and not an unfinished method.
D19 · Documentation Quality · Documentation · ×2
  • Documentation: no build, run or usage example README.md:1 — the repository holds project manifests and neither `README.md` nor the documents it links hold a code block or a command. Show the command that builds or runs it, or a usage snippet.
  • Documentation: no build, run or usage example docs/README.md:1 — `docs` is runnable (a `start` script in `package.json`) and neither `docs/README.md` nor the documents it links hold a code block or a command. Show the command that builds or runs it, or a usage snippet.
D21 · Naming Consistency · `selectAspectRatioID` spells `ID` where 1924 names in the project spell it `Id` · ×2
  • `selectAspectRatioID` spells `ID` where 1924 names in the project spell it `Id` invokeai/frontend/webv1/src/features/controlLayers/store/paramsSlice.ts:1542 — 1924 of 1929 names in project repository spell the token `Id` (1924 of 1929; unit: names in project repository containing `Id`). Peers: boardIdSelected.addBoardIdSelectedListener (invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/boardIdSelected.ts:10); imageUploaded.getUploadedToastDescription(boardId) (invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/imageUploaded.ts:22); videoUploaded.getUploadedToastDescription(boardId) (invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/videoUploaded.ts:20); Picker.buildSelectIsCompactView(pickerId) (invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx:218); Picker.getFirstOptionId (invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx:294). Rename to `selectAspectRatioId`. [rule N6]
  • `selectAspectRatioID` spells `ID` where 1924 names in the project spell it `Id` invokeai/frontend/webv1/src/features/controlLayers/store/selectors.ts:340 — 1924 of 1929 names in project repository spell the token `Id` (1924 of 1929; unit: names in project repository containing `Id`). Peers: boardIdSelected.addBoardIdSelectedListener (invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/boardIdSelected.ts:10); imageUploaded.getUploadedToastDescription(boardId) (invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/imageUploaded.ts:22); videoUploaded.getUploadedToastDescription(boardId) (invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/videoUploaded.ts:20); Picker.buildSelectIsCompactView(pickerId) (invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx:218); Picker.getFirstOptionId (invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx:294). Rename to `selectAspectRatioId`. [rule N6]
X23 · Unguarded diagnostic materialisation · Diagnostic log message is built whether or not it is wanted · ×2
  • Diagnostic log message is built whether or not it is wanted invokeai/frontend/webv1/src/features/controlLayers/hooks/useExportCanvasToPSD.ts:120 — `debug` at line 120 is called with an argument built by `children?.map((l) => ({ name : l.name, bounds : { left : l.left, top : l.top, right : l.right, bottom : l.bottom }, }))` (line 125), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
  • Diagnostic log message is built whether or not it is wanted invokeai/frontend/webv1/src/features/controlLayers/components/CanvasWorkflowIntegration/WorkflowFormPreview.tsx:98 — `debug` at line 98 is called with an argument built by `Object.keys(els)` (line 98), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
C4 · Data Retention · Partial data-retention evidence · ×1
  • Partial data-retention evidence — A retention mechanism is present, but the data-lifecycle is not yet complete — missing: an expiry limit — a declared maximum age / TTL after which the data is no longer kept, a scheduled purge / cleanup job (a Celery beat task, APScheduler job or management command that deletes rows past their retention — Session.objects.filter(created__lt=cutoff).delete(), purge_expired… / delete_old…).
D16 · Bus Factor · Further sole-owners (lower concentration) · ×1
  • Further sole-owners (lower concentration) — 2 other contributor(s) are each the sole owner of a small amount of code below the off-boarding threshold — folded into the bus-factor score and metrics (954 single-owned of 2603 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 2603 of the 4775 production source files in this repository met that bar). They are anonymized user #9 (1 file(s)), anonymized user #10 (1 file(s)) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: invokeai/app/services/external_generation/providers/openai.py, invokeai/frontend/webv1/src/features/controlLayers/components/RasterLayer/RasterLayerMenuItemsBooleanSubMenu.tsx.
D20 · ADR Quality · No ADRs found · ×1
  • No ADRs found — No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`.
D21 · Naming Consistency · `addGetOpenAPISchemaListener` spells `API` where 36 names in the project spell it `Api` · ×1
  • `addGetOpenAPISchemaListener` spells `API` where 36 names in the project spell it `Api` invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/getOpenAPISchema.ts:13 — 36 of 38 names in project repository spell the token `Api` (36 of 38; unit: names in project repository containing `Api`). Peers: invokeai.frontend.webv1.src.features.controlLayers.components.StagingArea.state.StagingAreaApi (invokeai/frontend/webv1/src/features/controlLayers/components/StagingArea/state.ts:93); CanvasManager.stateApi (invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasManager.ts:56); invokeai.frontend.webv1.src.features.controlLayers.konva.CanvasStateApiModule.CanvasStateApiModule (invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasStateApiModule.ts:68); state.useDeleteImageModalApi (invokeai/frontend/webv1/src/features/deleteImageModal/store/state.ts:173); state.useDeleteVideoModalApi (invokeai/frontend/webv1/src/features/deleteVideoModal/store/state.ts:181). Rename to `addGetOpenApiSchemaListener`. [rule N6]
D21 · Naming Consistency · `getSAMPoints` spells `SAM` where 38 names in the project spell it `Sam` · ×1
  • `getSAMPoints` spells `SAM` where 38 names in the project spell it `Sam` invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts:137 — 38 of 40 names in project repository spell the token `Sam` (38 of 40; unit: names in project repository containing `Sam`). Peers: CanvasApplicationHost.clearSamPreview (invokeai/frontend/webv2/src/workbench/canvas-engine/applicationHost.ts:45); CanvasApplicationHost.isSamToolActive (invokeai/frontend/webv2/src/workbench/canvas-engine/applicationHost.ts:66); CanvasApplicationHost.publishSamPreview (invokeai/frontend/webv2/src/workbench/canvas-engine/applicationHost.ts:75); CanvasApplicationHost.setSamInputHandler (invokeai/frontend/webv2/src/workbench/canvas-engine/applicationHost.ts:89); CanvasApplicationHost.setSamInteraction (invokeai/frontend/webv2/src/workbench/canvas-engine/applicationHost.ts:91). Rename to `getSamPoints`. [rule N6]
D21 · Naming Consistency · `getSAMPointColor` spells `SAM` where 38 names in the project spell it `Sam` · ×1
  • `getSAMPointColor` spells `SAM` where 38 names in the project spell it `Sam` invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts:1531 — 38 of 40 names in project repository spell the token `Sam` (38 of 40; unit: names in project repository containing `Sam`). Peers: CanvasApplicationHost.clearSamPreview (invokeai/frontend/webv2/src/workbench/canvas-engine/applicationHost.ts:45); CanvasApplicationHost.isSamToolActive (invokeai/frontend/webv2/src/workbench/canvas-engine/applicationHost.ts:66); CanvasApplicationHost.publishSamPreview (invokeai/frontend/webv2/src/workbench/canvas-engine/applicationHost.ts:75); CanvasApplicationHost.setSamInputHandler (invokeai/frontend/webv2/src/workbench/canvas-engine/applicationHost.ts:89); CanvasApplicationHost.setSamInteraction (invokeai/frontend/webv2/src/workbench/canvas-engine/applicationHost.ts:91). Rename to `getSamPointColor`. [rule N6]
D21 · Naming Consistency · `isAspectRatioID` spells `ID` where 1924 names in the project spell it `Id` · ×1
  • `isAspectRatioID` spells `ID` where 1924 names in the project spell it `Id` invokeai/frontend/webv1/src/features/controlLayers/store/types.ts:774 — 1924 of 1929 names in project repository spell the token `Id` (1924 of 1929; unit: names in project repository containing `Id`). Peers: boardIdSelected.addBoardIdSelectedListener (invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/boardIdSelected.ts:10); imageUploaded.getUploadedToastDescription(boardId) (invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/imageUploaded.ts:22); videoUploaded.getUploadedToastDescription(boardId) (invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/videoUploaded.ts:20); Picker.buildSelectIsCompactView(pickerId) (invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx:218); Picker.getFirstOptionId (invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx:294). Rename to `isAspectRatioId`. [rule N6]
D21 · Naming Consistency · `WorkflowJSONTab` spells `JSON` where 33 names in the project spell it `Json` · ×1
  • `WorkflowJSONTab` spells `JSON` where 33 names in the project spell it `Json` invokeai/frontend/webv1/src/features/nodes/components/sidePanel/workflow/WorkflowJSONTab.tsx:8 — 33 of 34 names in project repository spell the token `Json` (33 of 34; unit: names in project repository containing `Json`). Peers: promptTemplates.isJsonPrompt (invokeai/frontend/webv2/src/features/generation/core/promptTemplates.ts:16); workingMemory.isJsonObject (invokeai/frontend/webv2/src/features/models/core/workingMemory.ts:56); ModelsDataPort.requestJson (invokeai/frontend/webv2/src/features/models/data/transport.ts:6); NodesDataPort.requestJson (invokeai/frontend/webv2/src/features/nodes/data/transport.ts:6); workflowJson.parseWorkflowJson (invokeai/frontend/webv2/src/features/workflow/core/workflowJson.ts:283). Rename to `WorkflowJsonTab`. [rule N6]
D21 · Naming Consistency · `prepareLinearUIBatch` spells `UI` where 51 names in the project spell it `Ui` · ×1
  • `prepareLinearUIBatch` spells `UI` where 51 names in the project spell it `Ui` invokeai/frontend/webv1/src/features/nodes/util/graph/buildLinearBatchConfig.ts:24 — 51 of 53 names in project repository spell the token `Ui` (51 of 53; unit: names in project repository containing `Ui`). Peers: uiSlice.selectUiSlice (invokeai/frontend/webv1/src/features/ui/store/uiSlice.ts:92); GalleryUiAdapter.GalleryUiAdapterProvider (invokeai/frontend/webv2/src/app/GalleryUiAdapter.tsx:65); GenerationUiAdapter.GenerationUiAdapterProvider (invokeai/frontend/webv2/src/app/GenerationUiAdapter.tsx:206); ModelsUiAdapter.ModelsUiAdapterProvider (invokeai/frontend/webv2/src/app/ModelsUiAdapter.tsx:9); QueueUiAdapter.QueueUiAdapterProvider (invokeai/frontend/webv2/src/app/QueueUiAdapter.tsx:21). Rename to `prepareLinearUiBatch`. [rule N6]
D21 · Naming Consistency · `openAPI` spells `API` where 36 names in the project spell it `Api` · ×1
  • `openAPI` spells `API` where 36 names in the project spell it `Api` invokeai/frontend/webv1/src/features/nodes/util/schema/parseSchema.ts:97 — 36 of 38 names in project repository spell the token `Api` (36 of 38; unit: names in project repository containing `Api`). Peers: invokeai.frontend.webv1.src.features.controlLayers.components.StagingArea.state.StagingAreaApi (invokeai/frontend/webv1/src/features/controlLayers/components/StagingArea/state.ts:93); CanvasManager.stateApi (invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasManager.ts:56); invokeai.frontend.webv1.src.features.controlLayers.konva.CanvasStateApiModule.CanvasStateApiModule (invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasStateApiModule.ts:68); state.useDeleteImageModalApi (invokeai/frontend/webv1/src/features/deleteImageModal/store/state.ts:173); state.useDeleteVideoModalApi (invokeai/frontend/webv1/src/features/deleteVideoModal/store/state.ts:181). Rename to `openApi`. [rule N6]
D21 · Naming Consistency · `getGroupIDFromModelConfig` spells `ID` where 1924 names in the project spell it `Id` · ×1
  • `getGroupIDFromModelConfig` spells `ID` where 1924 names in the project spell it `Id` invokeai/frontend/webv1/src/features/parameters/components/ModelPicker.tsx:129 — 1924 of 1929 names in project repository spell the token `Id` (1924 of 1929; unit: names in project repository containing `Id`). Peers: boardIdSelected.addBoardIdSelectedListener (invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/boardIdSelected.ts:10); imageUploaded.getUploadedToastDescription(boardId) (invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/imageUploaded.ts:22); videoUploaded.getUploadedToastDescription(boardId) (invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/videoUploaded.ts:20); Picker.buildSelectIsCompactView(pickerId) (invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx:218); Picker.getFirstOptionId (invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx:294). Rename to `getGroupIdFromModelConfig`. [rule N6]
D21 · Naming Consistency · `aspectRatioID` spells `ID` where 1924 names in the project spell it `Id` · ×1
  • `aspectRatioID` spells `ID` where 1924 names in the project spell it `Id` invokeai/frontend/webv1/src/features/settingsAccordions/components/ImageSettingsAccordion/GenerateTabImageSettingsAccordion.tsx:29 — 1924 of 1929 names in project repository spell the token `Id` (1924 of 1929; unit: names in project repository containing `Id`). Peers: boardIdSelected.addBoardIdSelectedListener (invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/boardIdSelected.ts:10); imageUploaded.getUploadedToastDescription(boardId) (invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/imageUploaded.ts:22); videoUploaded.getUploadedToastDescription(boardId) (invokeai/frontend/webv1/src/app/store/middleware/listenerMiddleware/listeners/videoUploaded.ts:20); Picker.buildSelectIsCompactView(pickerId) (invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx:218); Picker.getFirstOptionId (invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx:294). Rename to `aspectRatioId`. [rule N6]
D21 · Naming Consistency · `getInitialUIState` spells `UI` where 51 names in the project spell it `Ui` · ×1
  • `getInitialUIState` spells `UI` where 51 names in the project spell it `Ui` invokeai/frontend/webv1/src/features/ui/store/uiTypes.ts:29 — 51 of 53 names in project repository spell the token `Ui` (51 of 53; unit: names in project repository containing `Ui`). Peers: uiSlice.selectUiSlice (invokeai/frontend/webv1/src/features/ui/store/uiSlice.ts:92); GalleryUiAdapter.GalleryUiAdapterProvider (invokeai/frontend/webv2/src/app/GalleryUiAdapter.tsx:65); GenerationUiAdapter.GenerationUiAdapterProvider (invokeai/frontend/webv2/src/app/GenerationUiAdapter.tsx:206); ModelsUiAdapter.ModelsUiAdapterProvider (invokeai/frontend/webv2/src/app/ModelsUiAdapter.tsx:9); QueueUiAdapter.QueueUiAdapterProvider (invokeai/frontend/webv2/src/app/QueueUiAdapter.tsx:21). Rename to `getInitialUiState`. [rule N6]
D21 · Naming Consistency · `isSdxlTrainingSize` spells `Sdxl` where 14 names in the project spell it `SDXL` · ×1
  • `isSdxlTrainingSize` spells `Sdxl` where 14 names in the project spell it `SDXL` invokeai/frontend/webv2/src/features/generation/core/canvas/canvasProcessingSize.ts:49 — 14 of 15 names in project repository spell the token `SDXL` (14 of 15; unit: names in project repository containing `SDXL`). Peers: useGroupedModelCombobox.selectBaseWithSDXLFallback (invokeai/frontend/webv1/src/common/hooks/useGroupedModelCombobox.ts:34); paramsSlice.selectIsSDXL (invokeai/frontend/webv1/src/features/controlLayers/store/paramsSlice.ts:1269); addSDXLLoRAs.addSDXLLoRAs (invokeai/frontend/webv1/src/features/nodes/util/graph/generation/addSDXLLoRAs.ts:7); addSDXLRefiner.addSDXLRefiner (invokeai/frontend/webv1/src/features/nodes/util/graph/generation/addSDXLRefiner.ts:9); buildSDXLGraph.buildSDXLGraph (invokeai/frontend/webv1/src/features/nodes/util/graph/generation/buildSDXLGraph.ts:41). Rename to `isSDXLTrainingSize`. [rule N6]
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion — 3 of 7 project(s) overshoot their size bounds, lowering Project Cohesion to 1.4/10. The most over is `invokeai/frontend/webv2` (318397 LoC, 4029 module-visible types across 147 directories). Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D28 · Secrets (history) · Rotate the exposed credentials · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D34 · Knowledge Freshness · Further orphaned files (smaller) · ×1
  • Further orphaned files (smaller) — 442 smaller file(s) also have no living knowledge — folded into the freshness score and metrics rather than raised one row each — most significant first: invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasEntity/CanvasEntityFilterer.ts, invokeai/app/util/controlnet_utils.py, invokeai/frontend/webv1/src/features/imageActions/actions.ts, invokeai/backend/image_util/normal_bae/nets/submodules/efficientnet_repo/geffnet/mobilenetv3.py, invokeai/app/services/shared/sqlite_migrator/sqlite_migrator_common.py, invokeai/frontend/webv1/src/features/controlLayers/konva/CanvasTool/CanvasColorPickerToolModule.ts, invokeai/backend/flux/extensions/regional_prompting_extension.py, invokeai/frontend/webv1/src/features/deleteImageModal/store/state.ts (and 434 more) (462 orphaned of 2638 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 2638 of the 4775 production source files in this repository met that bar). Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
M2 · Architecture documentation · No ADRs · ×1
  • No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
M3 · Folder & project structure · No src/ separation · ×1
  • No src/ separation — Production code isn't grouped under a src/ folder — it's spread across several top-level directories, so there's no one place that says 'this is the product'.
P3 · Security & performance tooling · No SAST · ×1
  • No SAST REDACTED:29 — No static application security testing detected. For this repository's stack, add bandit, `semgrep --config=p/python`, or CodeQL's python pack as a CI step. What was searched, so you can tell an absence from a miss: the 78289 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.
P3 · Security & performance tooling · No dependency-update automation · ×1
  • No dependency-update automation docs/package.json:17 — `docs/package.json` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`.
P4 · Deployment & Rollback · No rollback/health safety · ×1
  • No rollback/health safety — Deployment is orchestrated by compose, and the service already exposes health probe endpoints (healthz/livez/readyz or a container healthcheck), but no compose service declares a `healthcheck:` that uses them and nothing pins a previous image to fall back to — so a release that starts but does not serve looks healthy, and reversing it is a manual step.
P6 · Release Hygiene · No changelog · ×1
  • No changelog — No CHANGELOG/HISTORY/RELEASES file — what shipped when isn't easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)
R7 · Dead Code · Unused export '$true' · ×1
  • Unused export '$true' invokeai/frontend/webv1/src/app/store/nanostores/util.ts:16 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'setLoading' · ×1
  • Unused export 'setLoading' invokeai/frontend/webv1/src/features/auth/store/authSlice.ts:181 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'selectIsAuthLoading' · ×1
  • Unused export 'selectIsAuthLoading' invokeai/frontend/webv1/src/features/auth/store/authSlice.ts:207 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'selectDefaultControlAdapter' · ×1
  • Unused export 'selectDefaultControlAdapter' invokeai/frontend/webv1/src/features/controlLayers/hooks/addLayerHooks.ts:65 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'ModelIdentifier' · ×1
  • Unused export 'ModelIdentifier' invokeai/frontend/webv1/src/features/nodes/types/v2/common.ts:53 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'useListGalleryItemsQuery' · ×1
  • Unused export 'useListGalleryItemsQuery' invokeai/frontend/webv1/src/services/api/endpoints/gallery.ts:71 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'useChangeVideoIsIntermediateMutation' · ×1
  • Unused export 'useChangeVideoIsIntermediateMutation' invokeai/frontend/webv1/src/services/api/endpoints/videos.ts:360 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'useDeleteVideoMutation' · ×1
  • Unused export 'useDeleteVideoMutation' invokeai/frontend/webv1/src/services/api/endpoints/videos.ts:360 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'useDeleteVideosMutation' · ×1
  • Unused export 'useDeleteVideosMutation' invokeai/frontend/webv1/src/services/api/endpoints/videos.ts:360 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'useGetVideoNamesQuery' · ×1
  • Unused export 'useGetVideoNamesQuery' invokeai/frontend/webv1/src/services/api/endpoints/videos.ts:360 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'useListVideosQuery' · ×1
  • Unused export 'useListVideosQuery' invokeai/frontend/webv1/src/services/api/endpoints/videos.ts:360 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'getVideoDTO' · ×1
  • Unused export 'getVideoDTO' invokeai/frontend/webv1/src/services/api/endpoints/videos.ts:385 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'uploadVideo' · ×1
  • Unused export 'uploadVideo' invokeai/frontend/webv1/src/services/api/endpoints/videos.ts:395 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'VideoRecordChanges' · ×1
  • Unused export 'VideoRecordChanges' invokeai/frontend/webv1/src/services/api/types.ts:948 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'GalleryItemNamesResult' · ×1
  • Unused export 'GalleryItemNamesResult' invokeai/frontend/webv1/src/services/api/types.ts:983 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'OffsetPaginatedResults_GalleryItem_' · ×1
  • Unused export 'OffsetPaginatedResults_GalleryItem_' invokeai/frontend/webv1/src/services/api/types.ts:985 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'WCAG_RELEASE_TAGS' · ×1
  • Unused export 'WCAG_RELEASE_TAGS' invokeai/frontend/webv2/scripts/accessibility/axe.mjs:6 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'MAX_WILDCARD_VALUES' · ×1
  • Unused export 'MAX_WILDCARD_VALUES' invokeai/frontend/webv2/src/features/generation/core/dynamicPrompts.ts:252 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'LLMTaskCompleteEvent' · ×1
  • Unused export 'LLMTaskCompleteEvent' invokeai/frontend/webv2/src/features/generation/data/llmTaskProgress.ts:24 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'LLMTaskErrorEvent' · ×1
  • Unused export 'LLMTaskErrorEvent' invokeai/frontend/webv2/src/features/generation/data/llmTaskProgress.ts:26 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'LoginFormValues' · ×1
  • Unused export 'LoginFormValues' invokeai/frontend/webv2/src/features/identity/core/schemas.ts:53 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'UserManagement' · ×1
  • Unused export 'UserManagement' invokeai/frontend/webv2/src/features/identity/ui/UserManagement.tsx:18 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'getKindTotal' · ×1
  • Unused export 'getKindTotal' invokeai/frontend/webv2/src/features/intermediates/core/types.ts:170 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'MainDefaultSettingsFormValues' · ×1
  • Unused export 'MainDefaultSettingsFormValues' invokeai/frontend/webv2/src/features/models/core/schemas.ts:49 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'LoraDefaultSettingsFormValues' · ×1
  • Unused export 'LoraDefaultSettingsFormValues' invokeai/frontend/webv2/src/features/models/core/schemas.ts:81 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'useNodesUi' · ×1
  • Unused export 'useNodesUi' invokeai/frontend/webv2/src/features/nodes/ui/nodesUiStore.ts:106 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'ensureQueueLoaded' · ×1
  • Unused export 'ensureQueueLoaded' invokeai/frontend/webv2/src/features/queue/ui/queueDataStore.ts:71 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'createQueueRowsSelector' · ×1
  • Unused export 'createQueueRowsSelector' invokeai/frontend/webv2/src/features/queue/ui/queueViewModel.ts:31 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'getPendingQueueCount' · ×1
  • Unused export 'getPendingQueueCount' invokeai/frontend/webv2/src/features/queue/ui/queueViewModel.ts:40 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'getQueueActionState' · ×1
  • Unused export 'getQueueActionState' invokeai/frontend/webv2/src/features/queue/ui/queueViewModel.ts:81 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'documentToPreviewGraph' · ×1
  • Unused export 'documentToPreviewGraph' invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/GraphPreviewFlow.tsx:34 — Nothing ultimately consumes this binding: its only referrer is the re-export in invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code · Unused export 'areWorkflowPanelStatesEqual' · ×1
  • Unused export 'areWorkflowPanelStatesEqual' invokeai/frontend/webv2/src/features/workflow/ui/linear/WorkflowLinearPanel.tsx:56 — Nothing imports this binding — it is safe to review for removal.
R8 · Dependency Hygiene · Type-only dependency 'chakra-react-select' in production deps · ×1
  • Type-only dependency 'chakra-react-select' in production deps invokeai/frontend/webv1/src/common/hooks/useGroupedModelCombobox.ts:4 — Every import is type-only — move it to devDependencies.
X2 · Cancellation propagation · Not all async functions that make a request accept an AbortSignal · ×1
  • Not all async functions that make a request accept an AbortSignal — Only 18/34 async functions that make a cancellable request (fetch, axios, ky, ofetch, got, undici, node:http) accept an AbortSignal or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, an unmounted component, a timed-out job. Take a `signal` (or an options object that carries one) and hand it to the request; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
X5 · Nullable reference types · Strict null checking is not enabled everywhere the repository type-checks · ×1
  • Strict null checking is not enabled everywhere the repository type-checks — 3/5 of this repository's type-checking configuration(s) turn on strict null checking (`"strict": true`, or `"strictNullChecks": true`). A configuration that states neither is counted as OFF, because off is tsc's own default; a solution-style one whose `"files"` is empty and whose `"references"` point at other projects is in neither number, because it checks no source itself. Where it is off, `string` admits `null` and `undefined`: passing a value that is null compiles silently and throws on the first property access.
X5 · Nullable reference types · Null assertions (`!`) reduce the strict null checking score · ×1
  • Null assertions (`!`) reduce the strict null checking score — ~1.3 `!` null assertions per 1k TypeScript source lines — 657 assertion(s) across the 516159 source line(s) of the 3271 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: invokeai/frontend/webv1/src/common/util/promptAST.ts (28), invokeai/frontend/webv2/src/workbench/canvas-engine/document-model/documentModel.ts (27), invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/mergeLayerController.ts (24). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce.
X6 · Hand-rolled structured-format parsing · Hand-rolled JSON/XML parsing via regex · ×1
  • Hand-rolled JSON/XML parsing via regex invokeai/frontend/webv2/src/features/generation/core/canvas/addRegionalGuidance.ts:158 — A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This JavaScript/TypeScript code already uses a real parser in the same package; use it here too.
Minor — 5 finding(s)
D10 · Test Quality · Skipped (documented) · ×3
  • Skipped (documented): (unnamed test) invokeai/frontend/webv2/src/workbench/canvas-engine/render/golden/compositeGolden.browser.test.ts:243 — Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
  • Skipped (documented): (unnamed test) invokeai/frontend/webv2/src/workbench/canvas-engine/render/golden/compositeGolden.browser.test.ts:248 — Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
  • Skipped (documented): (unnamed test) invokeai/frontend/webv2/src/workbench/canvas-engine/render/golden/compositeGolden.browser.test.ts:265 — Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
D24 · Comment Value · doc comments repeat the names · ×2
  • doc comments repeat the names invokeai/frontend/webv1/src/app/logging/logger.ts:53 — 30 of 382 documented parameters and 14 of 1428 summaries in `@invoke-ai/invoke-ai-ui` only repeat the member or parameter name (e.g. "The log level" for `logLevel`). 3 documentation tag(s) are empty. Delete the restating tags, or add what the name does not say.
  • doc comments repeat the names invokeai/frontend/webv2/src/features/generation/core/canvas/addControlLayers.ts:82 — 0 of 0 documented parameters and 12 of 10779 summaries in `@invoke-ai/invoke-ai-webv2` only repeat the member or parameter name (e.g. "Options for ." for `AddControlLayersOptions`). Delete the restating tags, or add what the name does not say.

Appendix B — Reproduction & audit trail

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

DimensionToolVersionCommandFindingsRaw output
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-12f28137f4224aa2bfcd0a6709212daa/history.json --exit-code 0 --source .2artifacts/raw/gitleaks-history.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-git --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-12f28137f4224aa2bfcd0a6709212daa/tree.json --exit-code 0 --source .1artifacts/raw/gitleaks-tree.json
D29 · Static Analysis (SAST)semgrep—semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/canine-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off --exclude *.arrow --exclude *.avro --exclude *.csv --exclude *.dat --exclude *.db --exclude *.feather --exclude *.geojson --exclude *.h5 --exclude *.hdf5 --exclude *.jsonl --exclude *.log --exclude *.ndjson --exclude *.npy --exclude *.npz --exclude *.orc --exclude *.parquet --exclude *.pickle --exclude *.pkl --exclude *.psv --exclude *.sqlite --exclude *.sqlite3 --exclude *.tfrecord --exclude *.tsv --exclude *.txt --exclude invokeai/frontend/webv1/public/locales --exclude tests/app/services/shared/sqlite_migrator/server_schema_at_cutover .50artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** . --skip-db-update14artifacts/raw/trivy-fs.json
D31 · IaC & Container Securitytrivy—trivy config --format json --quiet .3artifacts/raw/trivy-config.json
D32 · Data Compliance (PII/GDPR)semgrep—semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that. semgrep could not parse 134 file(s) — `docs/src/config/head.ts`, `invokeai/frontend/webv1/src/app/hooks/useSyncFaviconQueueStatus.ts`, `invokeai/frontend/webv1/src/common/components/Picker/Picker.tsx`, `invokeai/frontend/webv1/src/common/hooks/useAsyncState.ts`, `invokeai/frontend/webv1/src/common/hooks/useImageUploadButton.tsx`, … (+129 more) — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.0—
D40 · Network Egress Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.0—
D41 · Kernel & Syscall Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.0—
D42 · Runtime Threat Enforcementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.0—
D43 · Malicious Dependenciestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** . --skip-db-update0artifacts/raw/trivy-fs.json

Run 01a1a68a-96b3-79df-aa64-5ad9b359c9c3 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.

Downloadable artifacts

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

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