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

iOfficeAI/OfficeCLI

Measured 22 October 2026, 23:30 UTC, at code version 06ab520

Regression: 1 dimension fell since the last survey Test distribution: not measured

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

Test distribution is not measured: No automated tests.

CAI score 33out of 100 Weak
CriticalWeakAdequateStrongExemplary
Down 2 since the last survey

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

A large codebase: 286,490 lines of product code in 1 project, tests not counted · Estimated rebuild effort: about 49.2 person-years · Weakest lens: Code Health, 19

Findings by how serious they are

463 critical 3611 serious 112 minor

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

This survey was produced by

Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
22 October 2026, 23:30 UTC

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

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

76of 83 dimensions measured by tools. The other 7 are advisory notes from an AI model, which explain the code but don't count towards the score.
4159of 4186 findings point to an exact file and line, so you can open each one in the code. The other 27 concern the repository as a whole, such as missing documentation.
83dimensions across 6 lenses, read from 286,490 lines of product code in 1 project.
Chapters

Executive summary

iOfficeAI/OfficeCLI scores 33 out of 100 and is rated Weak, while four of its six lenses score higher still: Architecture at 72, Security and Compliance at 67, Maturity at 61 and Performance at 60, all rated Adequate.

The score is lower than those four because the weakest lens counts most, and here that is Code Health, which scores 19 and is rated Critical. Its Type Safety dimension scores 0 out of 10, and until that reaches 4, Code Health can't be rated higher than Adequate. The first actions are to resolve the 1 No automated tests finding(s) in Code Coverage and to resolve the 1 No tests found finding(s) in Test Distribution, and if Code Health rose to 70, the score would rise from 33 to about 46.

463 findings are critical: 432 in Explicit Debt, 23 in Static Analysis (SAST), six in Secrets (history), one in Code Coverage and one in Project dependency cycles.

Watchdog couldn't measure Dependency Hygiene and Runtime evidence locked — no reproducible boot in this code, so those dimensions are left out of the score. The product code is 286,490 lines, which would take an estimated 49.2 person-years, around €7,200,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.
Code Health 19 · counts for 46%Production Readiness 26 · counts for 25%Performance 60 · counts for 14%Maturity 61 · counts for 8%Security and Compliance 67 · counts for 4%Architecture 72 · counts for 2%

If Code Health rose from 19 to 70, the lowest score rated Strong, the score would rise from 33 to about 46.

Code composition: what the lines of code are
Business logic 90%Supporting code 10%
New since the last survey: 350 findings

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

  • Cyclomatic Complexity · SlideComposition.PlaceholderMatches (cyclomatic 16) src/officecli/Handlers/Pptx/SlideComposition.cs
  • Cognitive Complexity · PowerPointHandler.RenderLayoutPlaceholders (cognitive 21) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.cs
  • Cognitive Complexity · PowerPointHandler.RenderPictureSvg (cognitive 21) src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs
  • Cognitive Complexity · PowerPointHandler.Dispose (cognitive 17) REDACTED
  • Cognitive Complexity · SlideComposition.ResolveInheritedFrame (cognitive 16) src/officecli/Handlers/Pptx/SlideComposition.cs
  • Cognitive Complexity · WordHandler.Dispose (cognitive 16) src/officecli/Handlers/WordHandler.cs
  • Code Duplication · Edited copy of a member (14 corresponding lines) src/officecli/Core/Chart/ChartHelper.Builder.cs
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) src/officecli/Core/Chart/ChartHelper.Setter.cs
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) REDACTED
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) REDACTED
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) src/officecli/Handlers/Pptx/PowerPointHandler.Chart.cs
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) src/officecli/Core/Chart/ChartHelper.Setter.cs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) src/officecli/Core/Chart/ChartSvgRenderer.cs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) src/officecli/Core/Chart/ChartSvgRenderer.cs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs
  • Code Duplication · Duplicated block (15–30 lines × 2) REDACTED
  • Code Duplication · Duplicated block (29–30 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs
  • Code Duplication · Duplicated block (17–20 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs
  • Code Duplication · Duplicated block (16–17 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs
  • Code Duplication · Duplicated block (14 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.cs
  • Code Duplication · Duplicated block (10 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs
  • Code Duplication · Duplicated block (10–11 lines × 5) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs
  • Code Duplication · Duplicated block (8 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs
  • Code Duplication · Duplicated block (7 lines × 2) src/officecli/Core/Chart/ChartHelper.Setter.cs
  • Code Duplication · Duplicated block (6 lines × 2) src/officecli/Core/Chart/ChartHelper.Builder.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/BatchTypes.cs src/officecli/BatchTypes.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Handlers/Pptx/PowerPointHandler.Set.Slide.cs src/officecli/Handlers/Pptx/PowerPointHandler.Set.Slide.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/CommandBuilder.Batch.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/CommandBuilder.Batch.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/CommandBuilder.Batch.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/CommandBuilder.Batch.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/CommandBuilder.Batch.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/CommandBuilder.Batch.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/CommandBuilder.Batch.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/CommandBuilder.GetQuery.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/CommandBuilder.GetQuery.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/CommandBuilder.GetQuery.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/CommandBuilder.Import.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/CommandBuilder.View.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/CommandBuilder.View.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/CommandBuilder.View.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/CommandBuilder.View.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/CommandBuilder.View.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/CommandBuilder.View.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/CommandBuilder.Watch.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/AtomicPackageWriter.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/AtomicPackageWriter.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/Chart/ChartHelper.Builder.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/Chart/ChartHelper.Builder.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/CliLogger.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/Diagram/MermaidImageRenderer.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/Diagram/MermaidImageRenderer.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/Diagram/MermaidImageRenderer.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/Diagram/MermaidImageRenderer.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/Diagram/MermaidImageRenderer.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/Diagram/MermaidImageRenderer.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/FontMetricsReader.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/Formula/FormulaEvaluator.Functions.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/Formula/FormulaEvaluator.Functions.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/Formula/FormulaEvaluator.cs
  • Explicit Debt · EmptyCatchBlock REDACTED
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/HtmlScreenshot.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/HtmlScreenshot.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/Installer.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/Installer.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/Installer.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/Installer.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/Installer.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/Installer.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/Installer.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/Installer.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/OleHelper.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/OleHelper.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/OleHelper.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/PivotTableHelper.Cache.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/PivotTableHelper.Readback.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/PivotTableHelper.Set.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/PivotTableHelper.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/PivotTableHelper.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/PivotTableHelper.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/PivotTableHelper.cs
  • Explicit Debt · EmptyCatchBlock REDACTED
  • Explicit Debt · EmptyCatchBlock REDACTED
  • Explicit Debt · EmptyCatchBlock REDACTED
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/Plugins/PluginProcess.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/Plugins/PluginProcess.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/Plugins/PluginProcess.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/PowerPointPngBackend.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/PowerPointPngBackend.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/RawXmlHelper.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/RawXmlHelper.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/RawXmlHelper.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/SkillInstaller.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/SkillInstaller.cs
  • Explicit Debt · EmptyCatchBlock src/officecli/Core/SvgImageHelper.cs

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

Fixed since the last survey: 524 findings

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

  • Cyclomatic Complexity · PowerPointHandler.PlaceholderMatches (cyclomatic 16) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs
  • Cognitive Complexity · WordHandler.GetListPrefix (cognitive 19) src/officecli/Handlers/Word/WordHandler.StyleList.cs
  • Cognitive Complexity · WordHandler.EnsureSectPrPageMargin (cognitive 18) src/officecli/Handlers/Word/WordHandler.Helpers.SectionTable.cs
  • Cognitive Complexity · PowerPointHandler.ResolveInheritedPosition (cognitive 17) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs
  • Code Duplication · Edited copy of a member (14 corresponding lines) src/officecli/Core/Chart/ChartHelper.Builder.cs
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) src/officecli/Core/Chart/ChartHelper.Setter.cs
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) REDACTED
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) REDACTED
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) src/officecli/Handlers/Pptx/PowerPointHandler.Chart.cs
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) src/officecli/Core/Chart/ChartHelper.Setter.cs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) src/officecli/Core/Chart/ChartSvgRenderer.cs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) src/officecli/Core/Chart/ChartSvgRenderer.cs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs
  • Code Duplication · Duplicated block (27–28 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs
  • Code Duplication · Duplicated block (17–20 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs
  • Code Duplication · Duplicated block (13–14 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs
  • Code Duplication · Duplicated block (11–13 lines × 5) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs
  • Code Duplication · Duplicated block (6 lines × 4) src/officecli/Core/Chart/ChartHelper.Setter.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Core/Formula/FormulaParser.cs src/officecli/Core/Formula/FormulaParser.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Handlers/Excel/ExcelHandler.Set.Tables.cs src/officecli/Handlers/Excel/ExcelHandler.Set.Tables.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Handlers/Word/WordHandler.Add.Structure.cs src/officecli/Handlers/Word/WordHandler.Add.Structure.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Handlers/Excel/ExcelHandler.Set.Sheet.cs src/officecli/Handlers/Excel/ExcelHandler.Set.Sheet.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Core/ExcelStyleManager.cs src/officecli/Core/ExcelStyleManager.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Core/OutputFormatter.cs src/officecli/Core/OutputFormatter.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Handlers/Word/WordHandler.HtmlPreview.Tables.cs src/officecli/Handlers/Word/WordHandler.HtmlPreview.Tables.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Handlers/Excel/ExcelBatchEmitter.cs src/officecli/Handlers/Excel/ExcelBatchEmitter.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Handlers/Word/WordHandler.Query.cs src/officecli/Handlers/Word/WordHandler.Query.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Handlers/Excel/ExcelHandler.Query.RowWhere.cs src/officecli/Handlers/Excel/ExcelHandler.Query.RowWhere.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Handlers/Word/WordHandler.HtmlPreview.Text.cs src/officecli/Handlers/Word/WordHandler.HtmlPreview.Text.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Handlers/Pptx/PowerPointHandler.Add.Shape.cs src/officecli/Handlers/Pptx/PowerPointHandler.Add.Shape.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Core/Chart/ChartHelper.Axis.cs src/officecli/Core/Chart/ChartHelper.Axis.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Core/Formula/FormulaEvaluator.Helpers.cs src/officecli/Core/Formula/FormulaEvaluator.Helpers.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Handlers/Excel/ExcelBatchEmitter.Elements.cs src/officecli/Handlers/Excel/ExcelBatchEmitter.Elements.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Handlers/Excel/ExcelHandler.DumpSupport.cs src/officecli/Handlers/Excel/ExcelHandler.DumpSupport.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Handlers/Excel/ExcelHandler.Helpers.Validation.cs src/officecli/Handlers/Excel/ExcelHandler.Helpers.Validation.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Handlers/Excel/ExcelHandler.Set.Drawings.cs src/officecli/Handlers/Excel/ExcelHandler.Set.Drawings.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Core/PivotTableHelper.Readback.cs src/officecli/Core/PivotTableHelper.Readback.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Handlers/Pptx/PowerPointHandler.Set.cs src/officecli/Handlers/Pptx/PowerPointHandler.Set.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Core/HtmlScreenshot.cs src/officecli/Core/HtmlScreenshot.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/CommandBuilder.GetQuery.cs src/officecli/CommandBuilder.GetQuery.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/CommandBuilder.Mark.cs src/officecli/CommandBuilder.Mark.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Handlers/Excel/ExcelDataFormatter.cs src/officecli/Handlers/Excel/ExcelDataFormatter.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Core/PivotTableHelper.Definition.cs src/officecli/Core/PivotTableHelper.Definition.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.cs src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Handlers/Pptx/PptxBatchEmitter.Media.cs src/officecli/Handlers/Pptx/PptxBatchEmitter.Media.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Core/Formula/ModernFunctionQualifier.cs src/officecli/Core/Formula/ModernFunctionQualifier.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Handlers/Pptx/PowerPointHandler.Fill.cs src/officecli/Handlers/Pptx/PowerPointHandler.Fill.cs
  • Churn × Complexity Hotspots · Hotspot: src/officecli/Core/SelectorCommaSplit.cs src/officecli/Core/SelectorCommaSplit.cs
  • Churn × Complexity Hotspots · Repeated repair: src/officecli/Core/Formula/FormulaEvaluator.SpecialFunctions.cs src/officecli/Core/Formula/FormulaEvaluator.SpecialFunctions.cs
  • Supply-chain Provenance & Signing · REDACTED
  • Cancellation propagation · Async method without CancellationToken: DoStopAsync src/officecli/Core/Watch/WatchServer.cs
  • Exception handling · Swallowed exception (caught, then discarded) src/officecli/BatchTypes.cs
  • Exception handling · Swallowed exception (caught, then discarded) src/officecli/CommandBuilder.cs
  • Exception handling · Swallowed exception (caught, then discarded) src/officecli/CommandBuilder.cs
  • Exception handling · Swallowed exception (caught, then discarded) src/officecli/CommandBuilder.cs
  • Exception handling · Swallowed exception (caught, then discarded) src/officecli/CommandBuilder.cs
  • Exception handling · Swallowed exception (caught, then discarded) src/officecli/CommandBuilder.cs
  • Exception handling · Swallowed exception (caught, then discarded) src/officecli/CommandBuilder.cs
  • Exception handling · Swallowed exception (caught, then discarded) src/officecli/CommandBuilder.GetQuery.cs
  • Exception handling · Swallowed exception (caught, then discarded) src/officecli/Core/CliLogger.cs
  • Exception handling · Swallowed exception (caught, then discarded) src/officecli/Core/CompoundFile.cs
  • Exception handling · Swallowed exception (caught, then discarded) src/officecli/Core/EmuConverter.cs
  • Exception handling · Swallowed exception (caught, then discarded) src/officecli/Core/FontMetricsReader.cs
  • Exception handling · Swallowed exception (caught, then discarded) src/officecli/Core/FontMetricsReader.cs
  • Exception handling · Swallowed exception (caught, then discarded) src/officecli/Core/FontMetricsReader.cs
  • Exception handling · Swallowed exception (caught, then discarded) src/officecli/Core/FontMetricsReader.cs
  • Exception handling · Swallowed exception (caught, then discarded) src/officecli/Core/FontMetricsReader.cs
  • Exception handling · Swallowed exception (caught, then discarded) src/officecli/Core/FontMetricsReader.cs
  • Exception handling · Swallowed exception (caught, then discarded) src/officecli/Core/FontMetricsReader.cs
  • Exception handling · Swallowed exception (caught, then discarded) src/officecli/Core/FontMetricsReader.cs
  • Exception handling · Swallowed exception (caught, then discarded) src/officecli/Core/Formula/FormulaEvaluator.cs
  • Exception handling · Swallowed exception (caught, then discarded) src/officecli/Core/Formula/FormulaEvaluator.cs
  • Exception handling · Swallowed exception (empty catch) src/officecli/Core/Formula/FormulaEvaluator.Helpers.cs
  • Exception handling · Swallowed exception (caught, then discarded) REDACTED
  • Exception handling · Swallowed exception (caught, then discarded) REDACTED
  • Exception handling · Swallowed exception (caught, then discarded) src/officecli/Core/HtmlPreviewHelper.cs
  • Exception handling · Swallowed exception (empty catch) src/officecli/Core/HtmlScreenshot.cs
  • Exception handling · Swallowed exception (caught, then discarded) src/officecli/Core/HtmlScreenshot.cs
  • Exception handling · Swallowed exception (caught, then discarded) src/officecli/Core/HtmlScreenshot.cs
  • Exception handling · Swallowed exception (empty catch) src/officecli/Core/HtmlScreenshot.cs
  • Exception handling · Swallowed exception (empty catch) src/officecli/Core/HtmlScreenshot.cs
  • Exception handling · Swallowed exception (empty catch) src/officecli/Core/HtmlScreenshot.cs
  • Exception handling · Swallowed exception (empty catch) src/officecli/Core/HtmlScreenshot.cs
  • Exception handling · Swallowed exception (caught, then discarded) src/officecli/Core/HtmlScreenshot.cs
  • Exception handling · Swallowed exception (empty catch) src/officecli/Core/HtmlScreenshot.cs
  • Exception handling · Swallowed exception (caught, then discarded) src/officecli/Core/Installer.cs
  • Exception handling · Swallowed exception (empty catch) src/officecli/Core/Installer.cs
  • Exception handling · Swallowed exception (empty catch) src/officecli/Core/Installer.cs
  • Exception handling · Swallowed exception (caught, then discarded) src/officecli/Core/Installer.cs
Rebuild cost: about €7,200,000 · Estimate
Cost to rebuild€2,300,000 to €12,000,000, for 38,380 to 126,790 hours of work, about 49.2 person-years for 28 to 94 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 33. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
SizeLarge: 286,490 lines of product code
Comment linesThe estimate prices 214,982 lines. Comment lines count towards the size of 286,490 lines but aren't priced as work.

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

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 1 No automated tests finding(s) in Code Coverage.
Raises the score by about 10 points · Low effort · Code Coverage
2
Resolve the 1 No tests found finding(s) in Test Distribution.
Raises the score by about 10 points · Low effort · Test Distribution
3
Resolve the 1 DeadLoopAccumulator finding(s) in Explicit Debt — start with RawXmlHelper.cs.
Raises the score by about 6 points · Low effort · Explicit Debt

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 €7,200,000 to build again, about 49.2 person-years of work. Its weakest lens is Code Health, at 19 (Critical). Code Health is about how easy the code is to read and change safely, and code that is hard to read is slow and risky to change, so every future change costs more than it should. Because the weakest lens counts most in the score, work on Code Health also moves the score most.
Based on: the rebuild estimate · the Code Health grade · how much each lens counts
What to do: Start with the Code Health actions in Top priorities.
If you do one thing first · First action
Resolve the 1 No automated tests finding(s) in Code Coverage. Of all the actions in this report, it raises the score most for the work it takes: about 10 points for low effort, because it clears the 1 Code Coverage 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 5.5 out of 10. Code at that level is slower to change than clean code, and Watchdog estimates the extra work at 6% to 14% on every change. The history of the code shows how much it changes: about 16,355 lines over the last 90 days, which is about 66,329 lines a year. At that pace, the extra work comes to an estimated 10.4 to 62.2 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of Watchdog's own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change; 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.

31 modules, with 15 dependencies between them. One loop runs through 6 of the modules, marked above the diagonal.

Which modules use which. The module on each row uses the module in each column, and the number counts the pairs of types that connect them. A cell above the diagonal is part of a loop.
uses →1 (global)2 OfficeCli.Core.Diagram3 OfficeCli.Core.Markdown4 OfficeCli.Core.TableStyles5 OfficeCli.Help6 examples.excel7 examples.excel.charts8 examples.ppt9 examples.ppt.charts10 examples.ppt.ole11 examples.ppt.pictures12 examples.ppt.shapes13 examples.ppt.tables14 examples.ppt.textboxes15 examples.ppt.transitions16 examples.word17 npm18 npm.lib19 sdk20 sdk.node21 sdk.python22 sdk.python.officecli23 skills.morph-ppt.reference24 src.officecli.Resources25 OfficeCli.Core26 OfficeCli.Core.TableStyles.Families27 OfficeCli.Core.Plugins28 OfficeCli.Core.Rendering29 OfficeCli.Handlers.Rendering30 OfficeCli.Handlers31 OfficeCli
1 (global)
2 OfficeCli.Core.Diagram
3 OfficeCli.Core.Markdown
4 OfficeCli.Core.TableStyles
5 OfficeCli.Help
6 examples.excel
7 examples.excel.charts
8 examples.ppt
9 examples.ppt.charts
10 examples.ppt.ole
11 examples.ppt.pictures
12 examples.ppt.shapes
13 examples.ppt.tables
14 examples.ppt.textboxes
15 examples.ppt.transitions
16 examples.word
17 npm
18 npm.lib
19 sdk
20 sdk.node
21 sdk.python
22 sdk.python.officecli
23 skills.morph-ppt.reference
24 src.officecli.Resources
25 OfficeCli.Core1
26 OfficeCli.Core.TableStyles.Families11
27 OfficeCli.Core.Plugins10
28 OfficeCli.Core.Rendering1
29 OfficeCli.Handlers.Rendering218
30 OfficeCli.Handlers152735
31 OfficeCli10112
Uses a module listed above itPart of a loopThe module itself
1 (global)2 OfficeCli.Core.Diagram3 OfficeCli.Core.Markdown4 OfficeCli.Core.TableStyles5 OfficeCli.Help6 examples.excel7 examples.excel.charts8 examples.ppt9 examples.ppt.charts10 examples.ppt.ole11 examples.ppt.pictures12 examples.ppt.shapes13 examples.ppt.tables14 examples.ppt.textboxes15 examples.ppt.transitions16 examples.word17 npm18 npm.lib19 sdk20 sdk.node21 sdk.python22 sdk.python.officecli23 skills.morph-ppt.reference24 src.officecli.Resources25 OfficeCli.Core26 OfficeCli.Core.TableStyles.Families27 OfficeCli.Core.Plugins28 OfficeCli.Core.Rendering29 OfficeCli.Handlers.Rendering30 OfficeCli.Handlers31 OfficeCli(global)1OfficeCli.Core.Diagram2OfficeCli.Core.Markdown3OfficeCli.Core.TableStyles4OfficeCli.Help5examples.excel6examples.excel.charts7examples.ppt8examples.ppt.charts9examples.ppt.ole10examples.ppt.pictures11examples.ppt.shapes12examples.ppt.tables13examples.ppt.textboxes14examples.ppt.transitions15examples.word16npm17npm.lib18sdk19sdk.node20sdk.python21sdk.python.officecli22skills.morph-ppt.reference23src.officecli.Resources24OfficeCli.Core25OfficeCli.Core.TableStyles.Families26OfficeCli.Core.Plugins27OfficeCli.Core.Rendering28OfficeCli.Handlers.Rendering29OfficeCli.Handlers30OfficeCli3111110121815273510112

At a glance — Code Health · 19% · Critical · gated by D1, D2, R1, R2, R3, X1, X3 ·

At a glance — Architecture · 72% · Adequate · gated by D26, AX5 ·

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

At a glance — Readiness · 26% · Weak · gated by D8, D9, R4, R6, P3 ·

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

At a glance — Performance · 60% · Adequate ·

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 — Injection36High / Critical
A07:2025 — Authentication Failures7High / Critical
A03:2025 — Software Supply Chain Failures6Medium
A08:2025 — Software or Data Integrity Failures1Medium

Roadmap

First, address the lack of automated testing by resolving the single coverage and distribution gaps to ensure new code is properly validated. Next, tackle the significant volume of empty catch blocks, prioritizing fixes in ResidentServer.cs, REDACTED, and UpdateChecker.cs to improve error handling reliability. Finally, eliminate specific code quality issues by fixing the dead loop accumulator in RawXmlHelper.cs and the unused private field in ModernFunctionQualifier.cs.

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

Do thisHelpsEffortDimension
Resolve the 1 No automated tests finding(s) in Code Coverage.+9.5 ptsLowCode Coverage
Resolve the 1 No tests found finding(s) in Test Distribution.+9.5 ptsLowTest Distribution
Resolve the 1 DeadLoopAccumulator finding(s) in Explicit Debt — start with RawXmlHelper.cs.+6.4 ptsLowExplicit Debt
Resolve the 1 WriteOnlyPrivateField finding(s) in Explicit Debt — start with ModernFunctionQualifier.cs.+6.4 ptsLowExplicit Debt
Resolve the 430 EmptyCatchBlock finding(s) in Explicit Debt — start with ResidentServer.cs (31), REDACTED (27), UpdateChecker.cs (25).+9.5 ptsHighExplicit Debt
Resolve the 1 IL efficiency finding(s) in IL Efficiency — start with ChartHelper.Setter.cs.+2.3 ptsLowIL Efficiency
Bring the 1071 bodies over 15 down to 15 or less in Cognitive Complexity — start with ChartHelper.SetChartProperties (cognitive 1584), WordHandler.ParagraphToNode (cognitive 1182), WordHandler.QueryDispatch (cognitive 1164).+4.8 ptsHighCognitive Complexity
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.+3.3 ptsMediumType Safety

File quality

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

FileScoreBandWorst signal
REDACTED0.0SlopSecrets (history): High secret: REDACTED
REDACTED0.0SlopStatic Analysis (SAST): High: REDACTED
REDACTED0.2SlopStatic Analysis (SAST): High: REDACTED
REDACTED0.4SlopSecrets (history): High secret: REDACTED
REDACTED1.0SlopExplicit Debt: EmptyCatchBlock
src/officecli/Handlers/Pptx/PowerPointHandler.View.cs1.0SlopExplicit Debt: EmptyCatchBlock
src/officecli/Core/RawXmlHelper.cs1.0SlopExplicit Debt: EmptyCatchBlock
src/officecli/Core/Watch/WatchServer.cs1.0SlopExplicit Debt: EmptyCatchBlock
src/officecli/Handlers/ExcelHandler.cs1.0SlopExplicit Debt: EmptyCatchBlock
src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Text.cs1.6SlopExplicit Debt: EmptyCatchBlock
src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs2.2SlopExplicit Debt: EmptyCatchBlock
src/officecli/ResidentServer.cs2.2SlopExplicit Debt: EmptyCatchBlock
src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs2.2SlopExplicit Debt: EmptyCatchBlock
src/officecli/Handlers/WordHandler.cs2.2SlopExplicit Debt: EmptyCatchBlock
src/officecli/Handlers/Excel/ExcelHandler.Remove.cs2.2SlopExplicit Debt: EmptyCatchBlock
src/officecli/CommandBuilder.View.cs2.2SlopExplicit Debt: EmptyCatchBlock
src/officecli/Core/WordPdfBackend.cs2.2SlopExplicit Debt: EmptyCatchBlock
src/officecli/Handlers/Word/WordHandler.Mutations.cs2.2SlopExplicit Debt: EmptyCatchBlock
src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs2.2SlopExplicit Debt: EmptyCatchBlock
src/officecli/CommandBuilder.Batch.cs2.3SlopExplicit Debt: EmptyCatchBlock

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

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

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

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

Could not be resolved — 3

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

Methodology & how to trust this report

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

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

What we checked — 83 dimensions across the health lenses
D1D2D3D4D5D6D8D9D13D14D15D17D18D19D20D21D22D24D26D27D28D29D30D34D35D36D37D39D43D44AX10AX3AX4AX5AX6ED5GD1IC1M1M2M3M4P1P2P3P4P6PF1PF2PF3R1R10R2R3R4R6R7R8R9X1X12X13X14X15X16X17X18X19X2X20X21X22X23X24X25X26X27X28X29X3X30X32X5

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

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

Tools & methods

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

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

Every finding is locatable in findings.md. Run 01a165f3-b3a3-7140-a2fa-4489c847dd48.

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.

  • D12 Dependency Hygiene — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `dotnet list package` did not return usable output (restore or query failed); no outdated/vulnerable/deprecated data to assess. The tool said: /usr/share/dotnet/sdk/10.0.400/NuGet.targets(521,5): error MSB3202: The project file "tests/OfficeCli.Tests/OfficeCli.Tests.csproj" was not found. [officecli.slnx].
  • D14 License Compliance — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares package.json, but the licence verdict published here was taken over its NuGet package 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.
  • D16 Bus Factor — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. Single-maintainer repository — bus factor is not applicable (22 contributor(s) across 6236 commit(s) sampled, automation and bot accounts excluded). One of them holds 98% of the history; the other 21 hold 0.1% each on average, below the 5% at which there is somebody to hand the work to. That is a single maintainer with drive-by contributors, not a team whose knowledge has concentrated — so the bus factor is not applicable and there is nothing here for the owner to act on.
  • D17 Explicit Debt — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The C# workspace loaded this repository's projects but reported a load failure, and the dead-code reference search is unreliable over a graph that did not load cleanly, so it was skipped. The other debt markers on this row were read; dead symbols were not, and their absence from the score is not a finding that the code has none. First load diagnostic: Failure: Project file not found: 'tests/OfficeCli.Tests/OfficeCli.Tests.csproj'.
  • D18 Solution Shape — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The build did not finish within its budget on this run; structural metrics are reported, build/warning status is unknown.
  • D30 Dependency Vulnerabilities — measured, with a gap in what it reached — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. The solution did not restore on the analyzer's .NET SDK (an SDK/target-framework/restore mismatch, common for an older codebase), so there was no restored dependency graph to scan. 1 of 3 declared ecosystem(s) (npm) WERE scanned and every vulnerability they reported is included in this result; nuget was not, so this dimension's score covers less than the dependency surface this repository declares, and nothing here is evidence that nuget is free of known-vulnerable dependencies.
  • D30 Dependency Vulnerabilities — measured, with a gap in what it reached — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. The scanner produced no output at all, so no dependency was actually scanned. 1 of 3 declared ecosystem(s) (npm) WERE scanned and every vulnerability they reported is included in this result; REDACTED was not, so this dimension's score covers less than the dependency surface this repository declares, and nothing here is evidence that REDACTED is free of known-vulnerable dependencies.
  • D32 Data Compliance (PII/GDPR) — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `src/officecli/BatchTypes.cs`, `src/officecli/Core/Formula/FormulaEvaluator.Spill.cs`, `src/officecli/Core/Formula/FormulaEvaluator.cs`, `src/officecli/Core/NativeRenderFailure.cs`, `src/officecli/Core/OutputFormatter.cs`, … (+7 more) produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
  • D43 Malicious Dependencies — measured, with a gap in what it reached — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. The scanner produced no output at all, so no dependency was actually scanned. 1 of 2 declared ecosystem(s) (npm) WERE scanned and every vulnerability they reported is included in this result; REDACTED was not, so this dimension's score covers less than the dependency surface this repository declares, and nothing here is evidence that REDACTED is free of known-vulnerable dependencies.
  • AXB1 Runtime evidence locked — no reproducible boot — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Subject: 1 markup document(s) — HTML, Razor, JSX, Vue, Svelte or server templates. The Runtime Evidence tier boots an app only via docker-compose, an Aspire AppHost, a Dockerfile, an npm dev script, a web service's own toolchain entry point (cargo, go, dotnet, Python, Spring Boot), or an Android app's own Gradle wrapper (run on an emulator); an Apple or Flutter app needs a host it lacks. None applied, so no live runtime a11y/egress/header evidence was collected. You can widen what we reach: add a docker-compose.yml (or an Aspire AppHost) that brings the app up with its dependencies. Watchdog then boots it in an isolated sandbox and gathers real runtime evidence — you change nothing in your pipeline (no CI step, no SDK).
  • P5 DR & Backup — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. No backup/snapshot/replication config, RTO/RPO or restore-procedure documentation was found — and no production persistence was detected either (no data-access packages, no data-store services, no database resources), so there is nothing in this repository whose loss a DR control would recover. If this system's data lives in a platform or ops repo we can't see, that's where the DR evidence belongs.
  • X24 Document value interpolated into markup unescaped — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 53 further occurrence(s) are not listed individually; the score already reflects all 93.
  • X3 Exception handling — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 508 further occurrence(s) are not listed individually; the score already reflects all 548.

Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.

Limitations & what we did not check

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

Per-dimension blind spots

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

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
  • D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
  • D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
  • D8 Code Coverage: Coverage is measured by building and running the test suite inside Watchdog's isolated image — the target repo is never modified, and nothing on your systems runs. So coverage exists only when the suite builds and runs within the inline time budget; one that needs external services, can't build, or exceeds the budget yields no coverage (D8 then degrades to not-measured, not a low score). Line coverage also says nothing about assertion quality.
  • D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
  • D13 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
  • D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
  • 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.
  • D18 Solution Shape: Build integrity reflects whether the solution compiled in this environment — a build that needs a private feed, a specific SDK, or a generated file absent from the repo can read as broken when it is merely unreproducible here.
  • D19 Documentation Quality: Documentation quality is judged by an LLM over a bounded sample of docs — it reads what is written, not whether the docs match the running system, and it is advisory, not a measurement. Its critique rows are drawn from a closed category vocabulary and each row means the same thing in every run, so two scans can be compared row by row; the SET that fires is still a sample, and does not repeat exactly. Measured on one frozen input, six scans at one engine SHA: 2-5 critique rows per scan, 8 distinct rows across the six, 3 of those 8 seen in only one scan. So a D19 row is evidence about the documentation, but a COUNT of D19 rows is not a quantity — never read a change in it as an improvement or a regression.
  • D20 ADR Quality: ADR quality is an LLM read of the decision records present — it cannot know about decisions made and never recorded, and its verdict is sampled and advisory.
  • D21 Naming Consistency: Naming quality is an LLM judgement over a bounded sample — it assesses clarity/consistency of the names it sees, not domain-correctness, and is advisory.
  • D22 Internal API Consistency: API-surface coherence is an LLM judgement over a sample of the public surface — consistency of intent across the whole API is approximated, not exhaustively verified.
  • D24 Comment Value: Comment value (WHY vs WHAT) is an LLM judgement over a bounded sample — it is advisory and cannot weigh a comment against the precise code change it was written to explain.
  • D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
  • D27 Navigability: Indirection/navigability is structural — it measures hops to follow a call, not whether that indirection buys real flexibility or just ceremony.
  • D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
  • D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
  • D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
  • D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
  • D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
  • D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
  • D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a Dockerfile (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
  • AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
  • ED5 Idempotency: Idempotency is judged from the handler body's visible writes and guards — a guard enforced by a database unique constraint, a broker's exactly-once delivery, or a domain method whose no-op-when-applied logic the scan can't follow may read as at-risk; the at-risk candidates are confirmed by a SAMPLED LLM verdict (advisory, not exhaustive) and degrade to heuristic-only when no model is configured. It flags the at-least-once double-apply SHAPE, not a runtime proof of a duplicate effect.
  • M4 Documentation accuracy: Onboarding quality is an LLM read of the docs/setup present — it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.
  • P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
  • P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.

The LLM boundary

LLM-set scores this run (7): D19, D21, D22, D24, D26, ED5, M4 (model: Local LLM). For these, a model reads a bounded sample and sets the numeric score; each names its own sample and method on its card. They are sampled and advisory by design: they vary at the margins between runs and are never a deterministic measurement. Every other score in this report is tool-computed at confidence 1.0.

Dimensions

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

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

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

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

803 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was ChartHelper.SetChartProperties at 809. A further 69 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 FormulaParser.CommandToSymbol at 213 — they are counted neither in the figure above nor in this dimension's score. 7 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: src/officecli/Handlers/Pptx/PowerPointHandler.Fill.cs (PowerPointHandler.ParsePresetShape at 87), src/officecli/Handlers/Word/WordHandler.Set.DocSettings.cs (WordHandler.TrySetDocSetting at 43), src/officecli/Core/LocaleFontRegistry.cs (LocaleFontRegistry.DetectLocaleFromCjkFontName at 40), src/officecli/Handlers/Pptx/PowerPointHandler.Add.cs (PowerPointHandler.AddCore at 37), src/officecli/Handlers/Word/WordHandler.Helpers.SectionTable.cs (WordHandler.SectPrChildOrder at 24), and 2 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.

(anonymous) (cyclomatic 23) · ×2src/officecli/Resources/watch-overlay.js:547
ChartHelper.SetChartProperties (cyclomatic 809)src/officecli/Core/Chart/ChartHelper.Setter.cs:219
PowerPointHandler.SetRunOrShapeProperties (cyclomatic 565)src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:165
FormulaEvaluator.EvalFunction (cyclomatic 554)src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:13
WordHandler.AddParagraph (cyclomatic 541)src/officecli/Handlers/Word/WordHandler.Add.Text.cs:13

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

What to do

  1. Bring the 329 bodies over 30 down to 30 or less in Cyclomatic Complexity — start with ChartHelper.SetChartProperties (cyclomatic 809), PowerPointHandler.SetRunOrShapeProperties (cyclomatic 565), FormulaEvaluator.EvalFunction (cyclomatic 554). — 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 329 together lifts Cyclomatic Complexity from 2.0 to about 5.6/10, projected with the scoring formula itself and assuming each lands exactly at 30; 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

1071 method(s) exceeded the cognitive complexity threshold of 15; the worst was ChartHelper.SetChartProperties at 1584.

ChartHelper.SetChartProperties (cognitive 1584)src/officecli/Core/Chart/ChartHelper.Setter.cs:219
WordHandler.ParagraphToNode (cognitive 1182)src/officecli/Handlers/Word/WordHandler.Navigation.cs:4006
WordHandler.QueryDispatch (cognitive 1164)src/officecli/Handlers/Word/WordHandler.Query.cs:1742
PowerPointHandler.SetRunOrShapeProperties (cognitive 1162)src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:165
ChartHelper.ReadChartProperties (cognitive 769)src/officecli/Core/Chart/ChartHelper.Reader.cs:31

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

What to do

  1. Bring the 1071 bodies over 15 down to 15 or less in Cognitive Complexity — start with ChartHelper.SetChartProperties (cognitive 1584), WordHandler.ParagraphToNode (cognitive 1182), WordHandler.QueryDispatch (cognitive 1164). — 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 1071 together lifts Cognitive Complexity from 2.0 to about 10.0/10, projected with the scoring formula itself and assuming each lands exactly at 15.
  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 Classes7.5 / 10Strong✓ Tool-verified

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

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

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

344 god class(es) detected.

MethodTooLong: ChartHelper.SetChartProperties · ×235src/officecli/Core/Chart/ChartHelper.Setter.cs:219
FileTooLong: Word/WordHandler.Navigation.cs · ×84src/officecli/Handlers/Word/WordHandler.Navigation.cs
TooManyMethods: WordHandler · ×20src/officecli/Handlers/Word/WordHandler.Navigation.cs
ClassTooLong: ChartExBuilder · ×4src/officecli/Core/Chart/ChartExBuilder.cs
FunctionTooLong: watch-sse-core.es.addEventListener("update")src/officecli/Resources/watch-sse-core.js:318

What to do

  1. Resolve the 235 MethodTooLong finding(s) in God Classes — start with ChartSvgRenderer.cs (8), WordHandler.Navigation.cs (6), WordHandler.Add.Structure.cs (6). — One of this dimension's main actionable groups (235 warning-level).
  2. Resolve the 84 FileTooLong finding(s) in God Classes — start with WordHandler.Navigation.cs, ChartSvgRenderer.cs, REDACTED. — One of this dimension's main actionable groups (84 warning-level).
  3. Resolve the 20 TooManyMethods finding(s) in God Classes — start with WordHandler.Navigation.cs, PowerPointHandler.HtmlPreview.Css.cs, ExcelHandler.HtmlPreview.cs. — One of this dimension's main actionable groups (20 warning-level).
  4. Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

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

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

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

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

1069 duplicated block group(s) detected. A further 52 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. 22 of the 1121 are in trees this repository does not ship — vendored, example/demo, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population.

Duplicated block (6 lines × 2) · ×92src/officecli/Core/Chart/ChartSvgRenderer.cs:5163
Duplicated block (5 lines × 2) · ×85src/officecli/Core/Formula/FormulaEvaluator.Spill.cs:341
Duplicated block (7 lines × 2) · ×66REDACTED:1810
Duplicated block (8 lines × 2) · ×57src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:548
Duplicated block (10 lines × 2) · ×39src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:353

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

What to do

  1. Resolve the 92 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with ChartSvgRenderer.cs (7), PowerPointHandler.HtmlPreview.Shapes.cs (6), ChartHelper.Builder.cs (4). — One of this dimension's main actionable groups (92 warning-level).
  2. Resolve the 85 Duplicated block (5 lines × 2) finding(s) in Code Duplication — start with FormulaEvaluator.Functions.cs (7), PowerPointHandler.HtmlPreview.Css.cs (4), ChartSvgRenderer.cs (4). — One of this dimension's main actionable groups (85 warning-level).
  3. Resolve the 66 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with PowerPointHandler.HtmlPreview.Css.cs (4), PivotTableHelper.Render.cs (3), ExcelHandler.Add.Tables.cs (2). — One of this dimension's main actionable groups (66 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

1 projects, 0 dependency cycle(s), 0 unstable depended-on project(s).

✓ On the Gold path — maintain.

Detailed fixes: d5_recommendation.md.

D6 · Cohesion (LCOM4)10.0 / 10Exemplary✓ 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

0 of 23 classes have LCOM4 above 3.

✓ On the Gold path — maintain.

Detailed fixes: d6_recommendation.md.

D8 · Code Coverage0.0 / 10Critical✓ Tool-verified

What it measures: How much of the code is actually exercised by tests.

Method: Coverage from coverlet runs or committed reports (Cobertura/OpenCover/lcov), computed per-file with structured exclusions for generated, trivial, and glue code. When the suite can't be built/run in-image AND no report is committed, coverage is reported NOT-MEASURED (excluded from the score) with the precondition to make it measurable — never a LoC-ratio proxy folded in as if measured. Deterministic.

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

No automated tests — no test code was found in this repository.

No automated tests

What to do

  1. Resolve the 1 No automated tests finding(s) in Code Coverage. — One of this dimension's main actionable groups (1 issue-level).
  2. Enforce Code Coverage in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

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

D9 · Test Distribution0.0 / 10Critical✓ 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 0.0 / 10 · rule-coverage 100% · ceiling Documented

No test suite found.

No tests found

What to do

  1. Resolve the 1 No tests found finding(s) in Test Distribution. — One of this dimension's main actionable groups (1 recommendation-level).

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

D13 · Secret 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

Secret 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 82 packages use a banned license. ★ DEPTH: this repository's MSBuild projects declare 2 direct `PackageReference`(s), and 80 further package(s) were reached beyond them by closing the graph over nuget.org's own nuspec dependency graph — so a banned licence pulled in only by a dependency's OWN dependencies is inside this verdict. A package whose licence nuget.org could not be asked for is not graded, and version ranges are taken at their lower bound, so this is the closure as that graph states it rather than a restored consumer's exact resolution. ★ COVERAGE OF THIS VERDICT: it grades this repository's NuGet package 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 Hotspots4.8 / 10Weak✓ Tool-verified

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

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

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

Top hotspots: src/officecli/Handlers/Word/WordHandler.Add.Text.cs (6×541=3246); src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs (5×565=2825); src/officecli/Core/Chart/ChartHelper.Setter.cs (3×809=2427) Repeated repair below the complexity floor: src/officecli/Handlers/Pptx/PowerPointHandler.Notes.cs (3 of 3 changes were fixes)

Hotspot: src/officecli/Handlers/Word/WordHandler.Add.Text.cs · ×54src/officecli/Handlers/Word/WordHandler.Add.Text.cs:13
Repeated repair: src/officecli/Handlers/Pptx/PowerPointHandler.Notes.cssrc/officecli/Handlers/Pptx/PowerPointHandler.Notes.cs:203

What to do

  1. Resolve the 54 Hotspot finding(s) in Churn × Complexity Hotspots — start with WordHandler.Add.Text.cs, PowerPointHandler.ShapeProperties.cs, ChartHelper.Setter.cs. — One of this dimension's main actionable groups (54 warning-level).
  2. Resolve the 1 Repeated repair finding(s) in Churn × Complexity Hotspots — start with PowerPointHandler.Notes.cs. — One of this dimension's main actionable groups (1 warning-level).

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

D17 · Explicit Debt6.7 / 10Adequate✓ 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 6.7 / 10 · rule-coverage 100% · ceiling Prevented

437 deducted debt markers + unmeasured dead symbols across 264139 LoC in the .NET projects (1.6/KLoC) → score 6.7. Dead code not measured: the solution did not load cleanly, so the reference search was skipped.

EmptyCatchBlock · ×430src/officecli/BlankDocCreator.cs:70
WriteOnlyPrivateFieldsrc/officecli/Core/Formula/ModernFunctionQualifier.cs:144
DeadLoopAccumulatorsrc/officecli/Core/RawXmlHelper.cs:1098
BarePragmaDisable · ×3src/officecli/Core/RawXmlHelper.cs:1265
TodoComment · ×2src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Text.cs:989

What to do

  1. Resolve the 430 EmptyCatchBlock finding(s) in Explicit Debt — start with ResidentServer.cs (31), REDACTED (27), UpdateChecker.cs (25). — One of this dimension's main actionable groups (430 issue-level).
  2. Resolve the 1 WriteOnlyPrivateField finding(s) in Explicit Debt — start with ModernFunctionQualifier.cs. — One of this dimension's main actionable groups (1 issue-level).
  3. Resolve the 1 DeadLoopAccumulator finding(s) in Explicit Debt — start with RawXmlHelper.cs. — One of this dimension's main actionable groups (1 issue-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.

D18 · Solution Shape8.0 / 10Strong✓ Tool-verified

What it measures: Whether the solution is laid out in a sensible, conventional structure.

Method: Solution structure: project count, decomposition, shell-project detection, build success (confirmed failures cap the score); traced to actual .sln files and binaries. Deterministic.

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

1 projects, 367 source files, 264139 hand-written lines of code (264139 production / 0 test — the split is derived per file: test is what its project, its own path, or a compile-guarded region marks as test, and a file carrying no test signal counts as production), 0 inter-project edges (build status unknown — did not finish).

Solution references a project that does not existofficecli.slnx
Single-project monolith

What to do

  1. Resolve the 1 Solution references a project that does not exist finding(s) in Solution Shape — start with officecli.slnx. — One of this dimension's main actionable groups (1 warning-level).
  2. Resolve the 1 Single-project monolith finding(s) in Solution Shape. — One of this dimension's main actionable groups (1 recommendation-level).

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

D19 · Documentation QualityExemplary◐ Sampled · advisory

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

Method: Judged by language model at low temperature (0.0-0.1) on a deterministic doc sample (READMEs plus first 25 architecture docs), with two-pass stability filtering. Advisory, sampled.

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

OfficeCLI's root README is a clear, well-structured overview of the project (what it does, its built-in HTML rendering engine that gives AI eyes, and internationalization) plus an extensive directory structure for each tier (examples/README.md, npm/README.md, schemas/README.md, sdk/node/README.md, sdk/python/README.md). The READMEs for examples/, schemas/, and the SDK are all focused on their own directories rather than the repository as a whole, which is consistent with the root's scope. There is no missing installation or usage documentation in any of these files; the only unshown content is the architecture/design docs (which exist but were clipped), so they do not carry penalty.

Documentation: no architecture or design documentationREADME.md
XML-doc coverage: officeclisrc/officecli/officecli.csproj

✓ On the Gold path — maintain.

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: Per-ADR judgment by language model at low temperature with two-pass stability; confidence is share of ADRs evaluated; enforcement-field presence detected deterministically. Advisory.

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

No architecture decision records were found.

No ADRs found

What to do

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

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

D21 · Naming ConsistencyExemplary◐ Sampled · advisory

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

Method: Judged by language model at low temperature (0.0-0.1) on a deterministic random symbol sample (fixed size, not exhaustive), with disclosed confidence band. Advisory, sampled.

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

0 naming inconsistencies across 200 sampled symbols.

✓ On the Gold path — maintain.

Detailed fixes: d21_recommendation.md.

D22 · Internal API ConsistencyWeak◐ Sampled · advisory

What it measures: Whether the internal API surface is consistent and coherent.

Method: Judged by language model at low temperature over a sample of the public API surface (IsPackable or .Contracts types). Sampled, advisory; confidence discounted by model uncertainty.

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

3 API inconsistencies across 7 exposed types.

Python SDK exposes both `create` and `open` as top-level module functions with identical signatures and likely identical implementation logic (instantiating a Document object). Similarly, the Node SDK exposes both `create` and `open` in the index. It is unclear if these represent distinct lifecycle states (e.g., creating a new process vs attaching to an existing one) or if they are redundant aliases. If they are aliases, having two public entry points for the same action is confusing. If they are distinct, the naming convention does not clearly convey the difference (e.g., `connect` vs `spawn`).
Inconsistent naming convention for the same utility function. Python uses snake_case (`pipe_paths`) while Node uses camelCase (`pipePaths`). While this is a standard language convention, the underlying operation name 'pipe_paths' is slightly ambiguous compared to 'pipePaths' (which might imply a single path or a list). More importantly, if this is a core utility, the semantic meaning of 'pipe_paths' (plural) vs 'pipePaths' (plural) is consistent, but the casing inconsistency across the API surface is a minor style violation that affects perceived consistency.
Inconsistent parameter naming and typing between Python and Node constructors. Python uses `path` and `timeout`, while Node uses `filePath` and `timeoutMs`. While `timeoutMs` is more explicit, `path` vs `filePath` is a minor inconsistency. More critically, the Node constructor has optional parameters (`binary?`, `timeoutMs?`) with defaults, while the Python constructor requires them. This creates a different usage pattern for the same object.

What to do

  1. Resolve the 1 Python SDK exposes both `create` and `open` as top-level module… finding(s) in Internal API Consistency. — One of this dimension's main actionable groups (1 warning-level).
  2. Resolve the 1 Inconsistent naming convention for the same utility function. Python… finding(s) in Internal API Consistency. — One of this dimension's main actionable groups (1 warning-level).
  3. Resolve the 1 Inconsistent parameter naming and typing between Python and Node… finding(s) in Internal API Consistency. — One of this dimension's main actionable groups (1 warning-level).

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

D24 · Comment ValueExemplary◐ Sampled · advisory

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

Method: Judged by language model at low temperature (0.0-0.1) on deterministically sampled inline comments with surrounding code; findings verified back to sampled comments by substring match. Advisory, sampled.

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

84 valuable / 0 redundant across 200 sampled comments.

✓ On the Gold path — maintain.

Detailed fixes: d24_recommendation.md.

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

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

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

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

1 of 1 projects 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.

D27 · Navigability8.3 / 10Strong✓ Tool-verified

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

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

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

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

81 % of calls cross a namespace and 2 % go through an interface, but 89 % of collaborators are co-located — so a call's collaborators sit together and tracing stays easy. Baseline: large — vertical-slice locality expected.

What to do

  1. Improve Navigability — currently 8.3/10. — 81 % of calls cross a namespace and 2 % go through an interface, but 89 % of collaborators are co-located — so a call's collaborators sit together and tracing stays easy. Baseline: large — vertical-slice locality expected.

Detailed fixes: d27_recommendation.md.

D28 · Secrets (history)4.0 / 10Weak✓ Tool-verified

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

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

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

6 finding(s): 0 critical, 6 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 6 High secret finding(s) in Secrets (history) — start with REDACTED (4), REDACTED (2). — One of this dimension's main actionable groups (6 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.5 / 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.5 / 10 · rule-coverage 100% · ceiling Documented

36 finding(s): 0 critical, 23 high, 13 medium, 0 low. 16 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 17 file(s) — `examples/ppt/shapes/shapes-typography.sh` (line 239), `examples/ppt/templates/styles/brand--aura-coffee/build.sh` (lines 131–151), `examples/ppt/templates/styles/future--2050-vision/build.sh` (lines 155–178), `examples/ppt/templates/styles/science--space-exploration/build.sh` (lines 212–256), `src/officecli/BatchTypes.cs` (lines 329–333), … (+12 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. In 1 of those file(s) — `src/officecli/Core/NativeRenderFailure.cs` — the break is a C# primary constructor, which semgrep's grammar cannot parse and which hides the type from every rule scoped to it; those files were re-scanned from a shadow copy with the constructor's parameter list blanked (line and column preserving), which restores the type to the rules, and 0 additional row(s) came from that pass. Only the header's own parameter list is unread in them. In 3 of those file(s) — `src/officecli/Core/Formula/FormulaEvaluator.Spill.cs`, `src/officecli/Core/Formula/FormulaEvaluator.cs`, `src/officecli/Handlers/Excel/ExcelBatchEmitter.cs` — the break is at a TYPE DECLARATION (a C# primary constructor semgrep's grammar cannot parse), so the loss is wider than the named lines: rules scoped to that type see no type to scope to and are blind over its whole body, while rules matching statements keep working there. Absence of a type-scoped finding in those types is not evidence of anything. Separately, one or more rules could not re-parse an embedded snippet in 3 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

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

What to do

  1. 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).
  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. No action in Static Analysis (SAST) — all 16 REDACTED finding(s) are reported here at file:line but scored by D36 (supply-chain provenance), so none is charged to this dimension. — One of this dimension's main actionable groups (16 issue-level, 0 of them charged here).

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

D30 · Dependency Vulnerabilities10.0 / 10Exemplary○ Nothing flagged

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 REDACTED.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05.

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

No known-vulnerable dependencies in the 1 ecosystem(s) that were scanned (npm). Partial dependency scan: 1 of 3 declared ecosystem(s) were scanned (npm), and the findings above are real and complete for them. nuget,REDACTED was not scanned (nuget: the solution did not restore on the analyzer's .NET SDK (an SDK/target-framework/restore mismatch, common for an older codebase), so there was no restored dependency graph to scan; REDACTED: the scanner produced no output at all, so no dependency was actually scanned), so this is not the whole dependency surface and the result is reported at reduced confidence.

REDACTED

✓ On the Gold path — maintain.

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

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d34_recommendation.md.

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

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

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

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

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

Strongest change-coupling: WatchServer.cs↔watch-sse-core.js 60%; ExcelHandler.cs↔WordHandler.cs 50%

Change coupling: WatchServer.cs ↔ watch-sse-core.js · ×2src/officecli/Core/Watch/WatchServer.cs:1

What to do

  1. Resolve the 2 Change coupling finding(s) in Change Coupling — start with WatchServer.cs, ExcelHandler.cs. — One of this dimension's main actionable groups (2 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
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 — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).
  3. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).

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

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.

D39 · IL Efficiency7.0 / 10Strong✓ Tool-verified

Method: IL instruction count per method, read from the BUILT first-party assemblies via Mono.Cecil (the target is compiled on a deep run); scored on the fraction of methods whose emitted IL body exceeds the size threshold. Sees compiler-generated bloat source can't; not-applicable when the target fails to build. Deterministic.

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

775 of 5221 first-party methods have an oversized IL body.

IL efficiency: 775 authored method(s) exceed the IL budgetsrc/officecli/Core/Chart/ChartHelper.Setter.cs:221

What to do

  1. Resolve the 1 IL efficiency finding(s) in IL Efficiency — start with ChartHelper.Setter.cs. — One of this dimension's main actionable groups (1 recommendation-level).
  2. Enforce IL Efficiency in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

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

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

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

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

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

No known-vulnerable dependencies in the 1 ecosystem(s) that were scanned (npm). Partial dependency scan: 1 of 2 declared ecosystem(s) were scanned (npm), and the findings above are real and complete for them. REDACTED was not scanned (REDACTED: the scanner produced no output at all, so no dependency was actually scanned), so this is not the whole dependency surface and the result is reported at reduced confidence.

REDACTED

✓ On the Gold path — maintain.

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

✓ On the Gold path — maintain.

Detailed fixes: d44_recommendation.md.

Frontend & cross-cutting dimensions

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

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

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

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 — check that business logic isn't leaking into the application/infrastructure layers (a thin domain is the anemic-domain smell).
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.

  • The namespaces OfficeCli ↔ OfficeCli.Core ↔ OfficeCli.Core.Plugins ↔ OfficeCli.Core.Rendering ↔ OfficeCli.Handlers ↔ OfficeCli.Handlers.Rendering depend on each other. The lightest dependency in the cycle is OfficeCli → OfficeCli.Core.Plugins (OfficeCli.CommandBuilder → OfficeCli.Core.Plugins.ResolvedPlugin, 1 type pair(s)); cut that one first, e.g. by moving the shared type to a namespace both can use or inverting it behind an interface. — src/officecli/CommandBuilder.Add.cs:11

What to do

  • Break namespace cycles inside a project by moving the shared type to a namespace both sides can use, or by inverting the back edge behind an interface.
AX4 · Dependency direction10.0 / 10Exemplary✓ Tool-verified

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

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

AX5 · Architecture & structure3.0 / 10Weak✓ 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.

  • ~264.1k production LoC (529 types) across 1 project(s) / 30 namespace(s) with no recognised architectural style or layering — at this size, deliberate module boundaries would help. No DDD/clean/vertical-slice/CQRS/transaction-script organisation was detected — code is likely organised ad hoc, which makes change and onboarding harder as it grows.

What to do

  • Introduce deliberate module boundaries — by feature (vertical slices) if your team prefers, or by layer (domain/application/infrastructure). Even splitting into a few cohesive projects with a clear dependency direction would help.
AX6 · Interface segregation8.7 / 10Strong✓ 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.

  • `IDocumentHandler` declares 21 members: `ViewAsText`, `ViewAsAnnotated`, `ViewAsOutline`, `ViewAsStats`, `ViewAsStatsJson`, `ViewAsOutlineJson`, `ViewAsTextJson`, `ViewAsIssues`, `Get`, `Query`, `Set`, `Add`, `Remove`, `Move`, `CopyFrom`, `Raw`, `RawSet`, `AddPart`, `Validate`, `TryExtractBinary`, `Save`. Counted as the author wrote them — a property is ONE member and its get/set accessors are not counted separately, and an event counts once. 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. — src/officecli/Core/IDocumentHandler.cs:65

What to do

  • Split fat interfaces into focused role-interfaces so clients depend only on what they use.
ED5 · Idempotency9.4 / 10Exemplary◐ Sampled · advisory

Other · Readiness — Whether retry-prone mutations (command handlers + message/event consumers) are idempotent so an at-least-once redelivery or client retry doesn't double-apply the effect — heuristic at-risk detection confirmed by language model, advisory.

Method: Roslyn heuristic (any mutation, ungated): command handlers and message/event consumers that mutate persistent state without a visible idempotency guard (exists/dedup check, upsert, idempotency-key/inbox, conditional/versioned write, fixed-value set) flagged as at-risk; each at-risk candidate then confirmed or cleared by a language model as genuinely non-idempotent versus naturally-idempotent. Advisory without a model (heuristic-only, degraded), per-candidate judged with one.

Coverage: Population: retry-prone mutations — command handlers (CQRS write side) + message/event consumers (IConsumer/I*EventHandler) — that mutate persistent state; runs on any repo with mutations, not only event-driven ones. The at-risk subset (no obvious guard) is a HEURISTIC candidate set, each then LLM-JUDGED non-idempotent vs safe; a handler outside those conventions, or a guard the LLM can't confirm, is bounded by the sample. Degrades to heuristic-only when no model is configured.

  • `Handlers.ExcelHandler.Import` mutates persistent state (a repository write) with no visible idempotency guard. Under a client retry or at-least-once redelivery a re-run could double-apply it — confirm it's safe to re-run, or add an exists/dedup check, an upsert, an idempotency-key/inbox, or a versioned write. — src/officecli/Handlers/Excel/ExcelHandler.Import.cs:25

What to do

  • Make retry-prone mutations idempotent — guard each write with an exists/dedup check, an upsert, an idempotency-key/inbox, or a versioned write, so a re-run doesn't double-apply.
GD1 · Unfinished & placeholder code10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Unreviewed-generation residue: shipped members still throwing NotImplementedException, and placeholder string literals left in 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 & stubs7.0 / 10Adequate✓ Tool-verified

Other · Code Health — Unfinished work detected by code SHAPE, not keywords: members that only throw a "not implemented" exception, methods that take inputs and return a constant, async methods that never await, dead `if (false)` / `#if false` branches, and skeleton types most of whose members are holes. A real, objective slice of technical debt.

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 `minY >= 0 ? … : …` are `niceMaxY`, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition. — src/officecli/Core/Chart/ChartSvgRenderer.cs:2470
  • The first 1 statement of the `if` and of the `else` are identical, so it runs on both paths regardless of the condition. Lift it above the `if` — leaving it duplicated inside makes the branches read as though they handled this differently. — src/officecli/Core/Formula/FormulaEvaluator.Helpers.cs:774
  • Both arms of `i < k ? … : …` are `Math.Exp(v)`, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition. — src/officecli/Core/Formula/FormulaEvaluator.Regression.cs:162
  • The first 2 statements of the `if` and of the `else` are identical, so they run on both paths regardless of the condition. Lift them above the `if` — leaving them duplicated inside makes the branches read as though they handled this differently. — src/officecli/Core/PivotTableHelper.Set.cs:231
  • Both arms of `dataFieldCount > 1 ? … : …` are `2`, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition. — src/officecli/Core/PivotTableHelper.cs:1797
  • 1 guard above `return value;` also returns `value`, so no input can make it matter. Implement the distinction that was intended, or delete the guard. — src/officecli/Core/TemplateMerger.cs:387
  • 1 guard above `return null;` also returns `null`, so no input can make it matter. Implement the distinction that was intended, or delete the guard. — src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.Shapes.cs:129
  • Both arms of `rows ? … : …` are `$"${parts[0]}:${parts[1]}"`, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition. — src/officecli/Handlers/Excel/ExcelHandler.Set.Sheet.cs:838
  • Both arms of `hex.StartsWith('#') ? … : …` are `$"{hex}{alphaByte:X2}"`, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition. — src/officecli/Handlers/Pptx/PowerPointHandler.Fill.cs:241
  • Control only reaches here when `run.Type != "field"` is false, because the guard on line 2185 exits otherwise. This test is therefore always false and everything it guards is unreachable. Implement the distinction that was intended, or delete the test. — src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:2347
  • 1 guard above `return 1;` also returns `1`, so no input can make it matter. Implement the distinction that was intended, or delete the guard. — src/officecli/Handlers/Word/WordHandler.Helpers.Style.cs:178
  • Both arms of `xAlign == "left" ? … : …` are `"left"`, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition. — src/officecli/Handlers/Word/WordHandler.HtmlPreview.Tables.cs:90
  • Control only reaches here when `isOleSelector` is false, because the guard on line 2319 exits otherwise. This test is therefore always false and everything it guards is unreachable. Implement the distinction that was intended, or delete the test. (×2) — src/officecli/Handlers/Word/WordHandler.Query.cs:2826, src/officecli/Handlers/Word/WordHandler.Query.cs:3118
  • 1 guard above `return true;` also returns `true`, so no input can make it matter. Implement the distinction that was intended, or delete the guard. — src/officecli/ResidentServer.cs:981

What to do

  • Remove the dead code that still moves this score: delete dead if(false) / #if false branches and either do the real async work or drop the async keyword from fake-async methods.
M1 · Documentation (README)7.3 / 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 a README to the 1 of 1 project(s) that lack one — worth up to 2 pts.
M2 · Architecture documentation3.0 / 10Weak✓ 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.

What to do

  • Start a test surface where your build system looks for one (tests/, test/, spec/, or your ecosystem's test source set) — the separation follows from putting the first tests in the right place.
M4 · Documentation accuracy8.0 / 10Strong◐ Sampled · advisory

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

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

  • README advertises Docker containerisation, but no Dockerfile/compose file exists — searched for: `dockerfile`, `docker-compose`, `compose.yaml`, `compose.yml`. Each was matched case- and separator-insensitively against file and directory NAMES anywhere in the tree, and against the CONTENTS of manifest and configuration files (package.json and other *.json, *.csproj, *.props, *.sln/*.slnx, *.yml, *.toml, *.config, tool configs such as eslint.config.js, Dockerfile); the README's own prose never counts, so a claim is never refuted by merely being made. Nothing outside that search was read — a footprint living only in a submodule, in a file type not listed here, or under a name none of those terms matches is not seen, and this row is then wrong. — README.md:191

What to do

  • Reconcile the README with reality: README advertises Docker containerisation, but no Dockerfile/compose file exists.
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.

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.

  • `src/officecli/Handlers/Excel/ExcelHandler.Add.Cells.cs` reports through `Console.Write…` at line 421 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters. — src/officecli/Handlers/Excel/ExcelHandler.Add.Cells.cs:421
  • `src/officecli/Handlers/Excel/ExcelHandler.Add.Cells.cs` reports through `Console.Write…` at line 427 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters. — src/officecli/Handlers/Excel/ExcelHandler.Add.Cells.cs:427
  • `src/officecli/Handlers/Excel/ExcelHandler.Add.Cells.cs` reports through `Console.Write…` at line 455 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters. — src/officecli/Handlers/Excel/ExcelHandler.Add.Cells.cs:455
  • `src/officecli/Handlers/Excel/ExcelHandler.Add.Cells.cs` reports through `Console.Write…` at line 543 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters. — src/officecli/Handlers/Excel/ExcelHandler.Add.Cells.cs:543
  • `src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs` reports through `Console.Write…` at line 131 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters. — src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:131
  • `src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs` reports through `Console.Write…` at line 142 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters. — src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:142
  • `src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs` reports through `Console.Write…` at line 311 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters. — src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:311
  • `src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs` reports through `Console.Write…` at line 610 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters. — src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:610
  • `src/officecli/Handlers/Excel/ExcelHandler.FormulaCache.cs` reports through `Console.Write…` at line 272 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters. — src/officecli/Handlers/Excel/ExcelHandler.FormulaCache.cs:272
  • `src/officecli/Handlers/Excel/ExcelHandler.Helpers.Cell.cs` reports through `Console.Write…` at line 334 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters. — src/officecli/Handlers/Excel/ExcelHandler.Helpers.Cell.cs:334
  • `src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs` reports through `Console.Write…` at line 1364 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters. — src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:1364
  • `src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs` reports through `Console.Write…` at line 1370 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters. — src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:1370
  • `src/officecli/Handlers/Excel/ExcelHandler.Helpers.Sheet.cs` reports through `Console.Write…` at line 552 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters. — src/officecli/Handlers/Excel/ExcelHandler.Helpers.Sheet.cs:552
  • `src/officecli/Handlers/Excel/ExcelHandler.Query.cs` reports through `Console.Write…` at line 1251 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters. — src/officecli/Handlers/Excel/ExcelHandler.Query.cs:1251
  • `src/officecli/Handlers/Excel/ExcelHandler.Set.Cells.cs` reports through `Console.Write…` at line 160 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters. — src/officecli/Handlers/Excel/ExcelHandler.Set.Cells.cs:160
  • `src/officecli/Handlers/Excel/ExcelHandler.Set.Cells.cs` reports through `Console.Write…` at line 197 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters. — src/officecli/Handlers/Excel/ExcelHandler.Set.Cells.cs:197
  • `src/officecli/Handlers/Excel/ExcelHandler.Set.Drawings.cs` reports through `Console.Write…` at line 212 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters. — src/officecli/Handlers/Excel/ExcelHandler.Set.Drawings.cs:212
  • `src/officecli/Handlers/Excel/ExcelHandler.Set.Tables.cs` reports through `Console.Write…` at line 798 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters. — src/officecli/Handlers/Excel/ExcelHandler.Set.Tables.cs:798
  • `src/officecli/Handlers/Excel/ExcelHandler.Slicer.cs` reports through `Console.Write…` at line 664 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters. — src/officecli/Handlers/Excel/ExcelHandler.Slicer.cs:664
  • `src/officecli/Handlers/ExcelHandler.cs` reports through `Console.Write…` at line 123 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters. — src/officecli/Handlers/ExcelHandler.cs:123
  • `src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs` reports through `Console.Write…` at line 1090 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters. — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1090
  • `src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs` reports through `Console.Write…` at line 922 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters. — src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:922
  • `src/officecli/Handlers/Pptx/PowerPointHandler.Effects.cs` reports through `Console.Write…` at line 850 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters. — src/officecli/Handlers/Pptx/PowerPointHandler.Effects.cs:850
  • `src/officecli/Handlers/Word/WordHandler.Add.Misc.cs` reports through `Console.Write…` at line 2030 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters. — src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:2030
  • `src/officecli/Handlers/Word/WordHandler.Helpers.Chart.cs` reports through `Console.Write…` at line 163 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters. — src/officecli/Handlers/Word/WordHandler.Helpers.Chart.cs:163
  • `src/officecli/Handlers/Word/WordHandler.Helpers.RunFormat.cs` reports through `Console.Write…` at line 242 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters. — src/officecli/Handlers/Word/WordHandler.Helpers.RunFormat.cs:242
  • `src/officecli/Handlers/Word/WordHandler.Helpers.RunFormat.cs` reports through `Console.Write…` at line 308 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters. — src/officecli/Handlers/Word/WordHandler.Helpers.RunFormat.cs:308

What to do

  • Replace `Console.Write…` in service code with the project's injected `ILogger<T>` (message templates with named properties), so delivery outcomes and failures reach the log pipeline with a level and a category.
  • For more than a log file, an `ActivitySource`/`EventSource` the user can switch on gives you a structured trace to attach to a bug report. A health-check endpoint does not apply here: nothing orchestrates or load-balances a binary the user launches.
P3 · Security & performance tooling0.0 / 10Critical✓ Tool-verified

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

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

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

What to do

  • Add a SAST step to CI running what this repository's stack ships: CodeQL's csharp pack, or a .NET security analyzer package — or `semgrep --config=auto`, which runs on any language — so a security regression fails the build instead of landing.
  • Enable Dependabot/Renovate or a dependency-review gate.
  • Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
P4 · Deployment & 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.

P6 · Release Hygiene10.0 / 10Exemplary✓ 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.

PF1 · Benchmark discipline6.0 / 10Adequate✓ Tool-verified

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

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

  • No benchmark suite was found by the two searches this check runs. FIRST, a BenchmarkDotNet package reference in any project file — every project the workspace loaded, plus a walk of project files on disk that never loaded, because a benchmark suite is exactly the project a partial load drops. SECOND, a script harness: a file whose name contains `benchmark` and ends `.py`, `.sh`, `.ps1`, `.bash`, `.rb`, `.js` or `.mjs`, credited ONLY when this repository's CI text also mentions benchmarks — a harness no pipeline runs is read as a fixture, deliberately. Neither search can see a benchmark suite in another ecosystem's idiom (a Go `testing.B` file, a JMH or criterion project, a pytest-benchmark run), so this is 'no benchmark found by those two searches', not a verdict that the repository has none. Where code is performance-sensitive, a benchmark guards against silent regressions — but it's a bonus here, not a deduction.

What to do

  • Add a benchmarking harness for the hot paths and run it in CI to catch regressions (for .NET, a BenchmarkDotNet project with [MemoryDiagnoser] to track allocations).
PF2 · Allocation hygiene6.0 / 10Adequate✓ Tool-verified

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

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

What to do

  • Raise allocation-aware density on the hot paths — currently 16 use(s) across 264,162 production line(s) (~0.1/1k). More Span/Memory, pooling (ArrayPool/ObjectPool), stackalloc and ValueTask on the allocation-heavy paths climbs this toward 10.
PF3 · Async & latency hygiene6.0 / 10Adequate✓ Tool-verified

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

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

  • `fs.readFileSync` in `verifyChecksum` 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. — npm/lib/install-binary.js:205
  • `fs.existsSync` in `ensureBinary` 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. — npm/lib/install-binary.js:217
  • `fs.statSync` in `ensureBinary` 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. — npm/lib/install-binary.js:217
  • `fs.mkdirSync` in `ensureBinary` 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. — npm/lib/install-binary.js:220
  • `fs.chmodSync` in `ensureBinary` 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. — npm/lib/install-binary.js:229
  • `fs.rmSync` in `ensureBinary` 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. — npm/lib/install-binary.js:235
  • `fs.existsSync` in `ensureCliBinary` 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. — sdk/node/index.js:365
  • 15 blocking call(s) on async work (.Wait()/.GetAwaiter().GetResult()) — these waste a thread and can deadlock wherever a synchronization context is in play (a UI thread, or a caller that has one).
  • `.GetAwaiter().GetResult()` blocks this thread until the async work completes — it wastes a thread-pool thread for as long as the work runs and can deadlock wherever a synchronization context is in play (a UI thread, or a caller that has one). (×15) — src/officecli/CommandBuilder.cs:173, src/officecli/CommandBuilder.Watch.cs:99, src/officecli/Core/Diagram/MermaidImageRenderer.cs:202, …

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.
  • Make the call chain async end-to-end and await it — never block on a Task with .Wait()/.GetAwaiter().GetResult().
R1 · Type Safety0.0 / 10Critical✓ 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.

  • 0 typed · 9 plain JS — the untyped files are npm/install.js, npm/lib/install-binary.js, npm/officecli.js, sdk/node/demo.js, sdk/node/index.js, sdk/node/smoke.js (+3 more).

What to do

  • Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
R10 · Code Duplication8.7 / 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.

  • src/officecli/Resources/watch-sse-core.js:155 · src/officecli/Resources/watch-sse-core.js:224 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — src/officecli/Resources/watch-sse-core.js:155
  • src/officecli/Resources/watch-overlay.js:824 · src/officecli/Resources/watch-overlay.js:864 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/officecli/Resources/watch-overlay.js:824
  • src/officecli/Resources/watch-sse-core.js:28 · src/officecli/Resources/watch-sse-core.js:77 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — src/officecli/Resources/watch-sse-core.js:28
  • sdk/node/index.js:323 · sdk/node/index.js:346 — the two spans are one implementation copied and then locally edited — 51 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. — sdk/node/index.js:323
  • src/officecli/Resources/watch-sse-core.js:41 · src/officecli/Resources/watch-sse-core.js:147 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/officecli/Resources/watch-sse-core.js:41
  • src/officecli/Resources/watch-overlay.js:669 · src/officecli/Resources/watch-overlay.js:674 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — src/officecli/Resources/watch-overlay.js:669
  • src/officecli/Resources/watch-sse-core.js:61 · src/officecli/Resources/watch-sse-core.js:66 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — src/officecli/Resources/watch-sse-core.js:61

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 Complexity0.0 / 10Critical✓ 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.

  • applyMarks has cyclomatic complexity 31 and cognitive complexity 82; 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. — src/officecli/Resources/watch-overlay.js:423
  • (anonymous) has cyclomatic complexity 28 and cognitive complexity 42; 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. — src/officecli/Resources/watch-sse-core.js:318
  • (anonymous) has cyclomatic complexity 26 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 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. — src/officecli/Resources/watch-overlay.js:822
  • (anonymous) has cyclomatic complexity 24 and cognitive complexity 35; 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. — src/officecli/Resources/watch-sse-core.js:147
  • (anonymous) has cyclomatic complexity 23 and cognitive complexity 25; 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. — src/officecli/Resources/watch-overlay.js:547
  • (anonymous) has cyclomatic complexity 22 and cognitive complexity 46; 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. — src/officecli/Resources/watch-sse-core.js:239
  • (anonymous) has cyclomatic complexity 17 and cognitive complexity 16; 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. — src/officecli/Resources/watch-overlay.js:642
  • ensureCliBinary has cyclomatic complexity 16 and cognitive complexity 21; 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. — sdk/node/index.js:346
  • (anonymous) has cyclomatic complexity 15 and cognitive complexity 34; 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. — src/officecli/Resources/watch-sse-core.js:355
  • (anonymous) has cyclomatic complexity 15 and cognitive complexity 18; 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. — src/officecli/Resources/preview.js:131
  • _positionSelOverlay has cyclomatic complexity 15 and cognitive complexity 18; 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. — src/officecli/Resources/watch-overlay.js:68
  • (anonymous) has cyclomatic complexity 14 and cognitive complexity 23; 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. — src/officecli/Resources/watch-overlay.js:774
  • (anonymous) has cyclomatic complexity 14 and cognitive complexity 20; 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. — src/officecli/Resources/watch-overlay.js:912
  • isMusl has cyclomatic complexity 13 and cognitive complexity 12; 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. — npm/lib/install-binary.js:42
  • detectAsset has cyclomatic complexity 12 and cognitive complexity 21; 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. — npm/lib/install-binary.js:63
  • _detectRect has cyclomatic complexity 11 and cognitive complexity 16; 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. — src/officecli/Resources/watch-overlay.js:23
  • (anonymous) has cyclomatic complexity 11 and cognitive complexity 12; 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. — src/officecli/Resources/watch-sse-core.js:41

What to do

  • Break down the listed branch-heavy functions; aim P95 cyclomatic ≤ 5.
R3 · Large Files0.0 / 10Critical✓ 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.

  • src/officecli/Resources/watch-overlay.js has 1013 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/officecli/Resources/watch-overlay.js:1
  • sdk/node/index.js has 604 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — sdk/node/index.js:1
  • src/officecli/Resources/watch-sse-core.js has 455 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/officecli/Resources/watch-sse-core.js:1

What to do

  • Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
R4 · Test Coverage2.5 / 10Weak✓ 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. (×6) — src/officecli/Resources/watch-overlay.js:1, src/officecli/Resources/watch-sse-core.js:1, src/officecli/Resources/preview.js:1, …

What to do

  • Add tests that import the unreached modules (directly or through their public entry).
R6 · Tooling0.0 / 10Critical✓ 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.

  • test ✗ · lint ✗ · typecheck ✗ — read from this repository's package.json scripts and corroborated against its CI workflows. A script counts when its name or command matches the step: `test` for the suite, `lint` or `prettier` for linting, `typecheck`/`type-check`/`tsc` for type checking. ✗ therefore means no script or CI step under those names was found, NOT that the step is absent from your pipeline — a task invoked by a runner this check does not read, or named something else entirely, is not seen and is worth confirming before acting on a cross. A ✓ means the wiring is DECLARED — a script or CI step under those names exists. It is not a statement that the step passes, or that it runs at all: nothing here installs a dependency or executes a suite.

What to do

  • Add a test runner (vitest / jest / playwright) and eslint and type checking (adopt TypeScript, or type-check the existing JavaScript with `checkJs`) as package.json scripts and run them in CI.
R7 · Dead Code9.7 / 10Exemplary✓ 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.

  • 3 file(s) (~1740 LoC) were excluded from dead-code analysis — declare main/module/exports or a conventional entry (src/index.*, an index.html script) so reachability can see this package.
  • Unreachable from the 5 application, 3 tooling and 1 test entry point(s) detected in this repo. This repository declares no build, type-check or test script, so nothing here would fail on a wrong deletion — confirm by hand that nothing loads each file (including by a path built at runtime) before removing it. An undetected custom entry would make these reachable.
  • no import path from any entry point (5 application, 3 tooling, 1 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 — sdk/node/demo.js

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 Hygiene10.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.

R9 · Circular Imports10.0 / 10Exemplary✓ 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.

X1 · Async correctness1.1 / 10Critical✓ Tool-verified

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.

  • Reading `.Result` of a task that has not completed blocks this thread until it does — the same block as `.Wait()`: under a synchronization context (Blazor, a UI thread, classic ASP.NET) it deadlocks, and on the thread pool it parks a thread for as long as the work runs. `await` the task instead (make the caller `async`); where a synchronous entry point must stay, keep the block in ONE documented bridge with a timeout. (×8) — src/officecli/BlankDocCreator.cs:75, src/officecli/CommandBuilder.Plugins.cs:172, src/officecli/CommandBuilder.Plugins.cs:173, …
  • Blocking on a Task with `.Wait()`/`.GetAwaiter().GetResult()` can deadlock (and wastes a thread). Prefer awaiting it: make the caller `async` and `await` instead. Where a synchronous entry point must stay — a public sync API you cannot break, or a process entry point that must not return until the work finishes — the block belongs in ONE documented bridge and never inside code that is already async; and where it already is that bridge, give the wait a TIMEOUT so a hung task fails the call instead of hanging the process. (×14) — src/officecli/CommandBuilder.cs:173, src/officecli/CommandBuilder.Watch.cs:99, src/officecli/Core/Diagram/MermaidImageRenderer.cs:202, …
  • `.Wait(…)` blocks this thread until the task completes or the bound expires — sync-over-async: it can deadlock under a synchronization context and it parks a thread while it waits. `await` the task (with `.WaitAsync(timeout, token)` where the bound matters). (×9) — REDACTED:293, src/officecli/Core/Plugins/PluginProcess.cs:124, src/officecli/Core/Plugins/PluginProcess.cs:125, …
  • Blocking on a Task with `.Wait()`/`.GetAwaiter().GetResult()` wastes a thread and, if the task needs a context this one is holding, deadlocks. `Dispose()` returns void by contract, so it cannot simply `await`: signal the work to stop first (cancel its token, set its stop flag) so the wait is short, give the wait a TIMEOUT so a hung task cannot hang shutdown, and — where callers can use it — add an awaitable teardown (`DisposeAsync`/`StopAsync`) beside the synchronous one and let `Dispose()` remain the bounded fallback. — REDACTED:344
  • `MemoryStream.Write` blocks the thread on I/O while `MemoryStream.WriteAsync` exists to wait without one — inside a method that is already `async`, await the twin. — src/officecli/Core/Watch/WatchServer.cs:2153

What to do

  • Sync-over-async (deadlock risk) through `.Result`
X12 · Unreachable branch8.0 / 10Strong✓ Tool-verified

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.

  • The switch subject is `key.ToLowerInvariant()`, so every value reaching these arms has already been lower-cased by `ToLower()/ToLowerInvariant()` (line 292). The label `"fontSize"` carries a letter of the opposite case, so it cannot equal that subject for ANY input — this arm is dead and whatever it was meant to handle silently falls through to the default. Match the normalised spelling (`"fontsize"`), or drop the normaliser and compare with `StringComparison.OrdinalIgnoreCase`. — src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:436
  • The switch subject is `key.ToLowerInvariant()`, so every value reaching these arms has already been lower-cased by `ToLower()/ToLowerInvariant()` (line 292). The label `"underlineColor"` carries a letter of the opposite case, so it cannot equal that subject for ANY input — this arm is dead and whatever it was meant to handle silently falls through to the default. Match the normalised spelling (`"underlinecolor"`), or drop the normaliser and compare with `StringComparison.OrdinalIgnoreCase`. — src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:563
  • The switch subject is `key.ToLowerInvariant()`, so every value reaching these arms has already been lower-cased by `ToLower()/ToLowerInvariant()` (line 2721). The label `"underlineColor"` carries a letter of the opposite case, so it cannot equal that subject for ANY input — this arm is dead and whatever it was meant to handle silently falls through to the default. Match the normalised spelling (`"underlinecolor"`), or drop the normaliser and compare with `StringComparison.OrdinalIgnoreCase`. — src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:3220
  • The switch subject is `key.ToLowerInvariant()`, so every value reaching these arms has already been lower-cased by `ToLower()/ToLowerInvariant()` (line 575). The label `"underlineColor"` carries a letter of the opposite case, so it cannot equal that subject for ANY input — this arm is dead and whatever it was meant to handle silently falls through to the default. Match the normalised spelling (`"underlinecolor"`), or drop the normaliser and compare with `StringComparison.OrdinalIgnoreCase`. — src/officecli/Handlers/Word/WordHandler.Helpers.RunFormat.cs:886

What to do

  • Each finding names the span that makes the branch dead and the span it is dead because of. Confirm from the two, then delete the dead arm or fix the predicate that was meant to be reachable.
X13 · Undrained process stream6.5 / 10Adequate✓ Tool-verified

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.

  • `RedirectStandardOutput` is set here, but nothing in this type ever reads `StandardOutput` — while `StandardError` is read to the end. The child blocks as soon as it fills the StandardOutput pipe (~4 KB, never more than 64 KB), and it can then never finish writing StandardError, so the read-to-end above never returns and the `WaitForExit` timeout beside it does not help: the timeout bounds the WAIT, not the read that precedes it. Drain both — read one stream on a background thread (`BeginErrorReadLine()` with an `ErrorDataReceived` handler, or a `Task` running the second `ReadToEndAsync()`) and await both before `WaitForExit()` — or stop redirecting the stream you do not consume. — src/officecli/CommandBuilder.cs:296

What to do

  • Each finding names the span that makes the branch dead and the span it is dead because of. Confirm from the two, then delete the dead arm or fix the predicate that was meant to be reachable.
X14 · Bypassable address classification3.5 / 10Weak✓ Tool-verified

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.

  • This method unwraps IPv4-MAPPED IPv6 (`IsIPv4MappedToIPv6`, line 112) and then rejects `10.0.0.0/8` on its IPv4 path — but the IPv6 branch at line 131 classifies the address as written, and IPv4 reaches IPv6 through three MORE embeddings this method never mentions: IPv4-compatible (`::a.b.c.d`), 6to4 (`2002::/16`) and NAT64 (`64:ff9b::/96`). So `::10.0.0.1`, `2002:0a00:0001::` and `64:ff9b::10.0.0.0` all name a host inside `10.0.0.0/8` — the range this same method declares non-public — and all reach the IPv6 branch un-unwrapped, taking the opposite verdict. Unwrap every embedding to its IPv4 form before classifying, or reject any IPv6 address carrying an embedded IPv4 outright. — src/officecli/Core/SsrfGuard.cs:131

What to do

  • Each finding names the IPv4 branch that rejects the host and the IPv6 branch that accepts the same host in another notation. Confirm from the two, then unwrap every IPv4-in-IPv6 embedding before classifying, or reject non-native IPv6 outright.
X15 · Unvalidated length from an untrusted reader3.5 / 10Weak✓ 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.

  • `chunkLen` is read from the stream being parsed at line 468 (`ReadUInt32`), then read in bulk from that same stream at line 470 — and nowhere in this method is `chunkLen` bounded from above — compared to a limit, clamped, or checked against the input that remains (a zero or sign test, or the loop that counts up to it, bounds nothing). A file the caller did not write therefore chooses the size directly: a value near `int.MaxValue` allocates until the process dies, and a value that overflows the cast to `int` goes negative and throws out of a parser whose failure path was written for malformed input, not for hostile input. Bound `chunkLen` against the bytes actually remaining in the stream before spending it. — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Model3D.cs:470

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 document10.0 / 10Exemplary○ Nothing flagged

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.

X18 · Disposal-pattern correctness7.4 / 10Strong✓ 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.

  • `_handler` is declared `IDisposable` and nothing more, and every assignment to it takes a constructor parameter — so `DeferredStdout` can do exactly one thing with it, which is the release performed here (line 46), and it is the only reference left that can perform it. That release is the tail of an unprotected sequence: `Console.SetOut(_original)` runs first (line 45), and nothing in `Dispose` catches it. A single throw from that call skips the release entirely — and because a bare `IDisposable` carries no state to inspect and no second holder to fall back on, whatever it represents (a lock taken for this instance, a semaphore lease, a scope) is then held for the remaining lifetime of the process, with nothing left that could ever give it back. Wrap the calls that precede it in a `try` and move the release into the `finally`, so the one statement that must happen is the one that always happens. — src/officecli/Core/DeferredStdout.cs:46
  • `WatchServer` implements `IDisposable` — so it has told every caller it holds something worth releasing — and it constructs `_tcpListener` itself (line 31), which makes that instance its own. But `_tcpListener` is named in none of the methods the disposal search covered: `Dispose` (line 3040), `StopAsync` (line 455) — that is `Dispose` plus every method `Dispose` calls BY NAME, so a release reached through an interface, a delegate or a base class is not followed and is worth checking before acting. On what was read, the type's disposal releases everything except the one thing it owns. A disposable the owner never disposes is held until finalization if its type has a finalizer, and forever if it does not — which for a synchronisation primitive, a timer, a stream or a handle means the resource accumulates once per instance for the life of the process. Release it in `Dispose` (`_tcpListener?.Dispose();`), or, if it truly does not need releasing, drop `IDisposable` from the type so the claim and the behaviour agree. — src/officecli/Core/Watch/WatchServer.cs:31
  • `WatchServer` implements `IDisposable` — so it has told every caller it holds something worth releasing — and it constructs `_switchLock` itself (line 55), which makes that instance its own. But `_switchLock` is named in none of the methods the disposal search covered: `Dispose` (line 3040), `StopAsync` (line 455) — that is `Dispose` plus every method `Dispose` calls BY NAME, so a release reached through an interface, a delegate or a base class is not followed and is worth checking before acting. On what was read, the type's disposal releases everything except the one thing it owns. A disposable the owner never disposes is held until finalization if its type has a finalizer, and forever if it does not — which for a synchronisation primitive, a timer, a stream or a handle means the resource accumulates once per instance for the life of the process. Release it in `Dispose` (`_switchLock?.Dispose();`), or, if it truly does not need releasing, drop `IDisposable` from the type so the claim and the behaviour agree. — src/officecli/Core/Watch/WatchServer.cs:55
  • `raw` is a `MemoryStream`, which implements `IDisposable`, and it is created here (line 2147). Every use of it in `ReadHttpRequestHeaderAsync` reads a member through it — it is never returned, never stored, never handed to anything else, and never disposed — so this method both creates the value and is the last thing that can release it, and does not. Nothing announces the leak: the object holds its resource until finalization if its type has a finalizer, and until the process ends if it does not, so the cost accumulates once per CALL rather than showing up as a failure. Declare it with `using` (`using var raw = …;`), which releases it at the end of the scope on every path including a throw. — src/officecli/Core/Watch/WatchServer.cs:2147

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 propagation9.2 / 10Exemplary✓ Tool-verified

Other · Code Health — Whether async methods accept a CancellationToken so work can be cancelled (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 27/31 async methods accept a CancellationToken, so in-flight work can't be stopped early when the caller gives up — whatever ends it in your host (shutdown signal, timeout, abandoned request, user cancel). Thread a token through the call chain and honour it at each await and loop; where a method genuinely cannot be interrupted, omitting it is a deliberate choice — judge against your hosting model.
  • No CancellationToken parameter — this work can't be stopped early once started. (×3) — src/officecli/Core/Watch/WatchServer.cs:455, src/officecli/ResidentServer.cs:2777, src/officecli/ResidentServer.cs:2785
  • No CancellationToken parameter — the body observes an ambient token instead (a field or a context object), so the work does stop on cancellation, but a caller cannot cancel this call independently of the owner that created that token. — src/officecli/McpServer.cs:27

What to do

  • Thread a CancellationToken through async methods so work stops promptly on cancellation.
X20 · Mistyped argument guard10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether an argument guard throws the exception its own condition describes — a guard that rejects a value for being EMPTY and reports it as `ArgumentNullException` tells the caller a parameter was null when it provably was not.

Method: Roslyn syntax: `throw new ArgumentNullException(nameof(p))` statements controlled by an `if`, whose condition is read for a test that is true of a NON-null `p` — an emptiness test that dereferences it (`p.Count == 0`, `!p.Any()`) or a BCL predicate documented true of the empty value (`string.IsNullOrEmpty(p)`). Deterministic, provable per finding. Advisory.

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

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

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

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

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

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

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

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

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

X24 · Document value interpolated into markup unescaped5.4 / 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.

  • `strokeColor` carries text this program read out of the document being converted, and it is written straight into the `stroke` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `strokeColor` at this site, or validate it against the shape the attribute accepts before interpolating it. (×2) — src/officecli/Core/Chart/ChartSvgRenderer.cs:781, src/officecli/Core/Chart/ChartSvgRenderer.cs:1084
  • `color` carries text this program read out of the document being converted, and it is written straight into the `fill` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `color` at this site, or validate it against the shape the attribute accepts before interpolating it. (×3) — src/officecli/Core/Chart/ChartSvgRenderer.cs:1527, src/officecli/Core/Chart/ChartSvgRenderer.cs:3010, src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:1638
  • `rl.Color` carries text this program read out of the document being converted, and it is written straight into the `stroke` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `rl.Color` at this site, or validate it against the shape the attribute accepts before interpolating it. (×2) — src/officecli/Core/Chart/ChartSvgRenderer.cs:1661, src/officecli/Core/Chart/ChartSvgRenderer.cs:5215
  • `color` carries text this program read out of the document being converted, and it is written straight into the `stroke` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `color` at this site, or validate it against the shape the attribute accepts before interpolating it. (×5) — src/officecli/Core/Chart/ChartSvgRenderer.cs:3008, src/officecli/Core/Chart/ChartSvgRenderer.cs:4935, src/officecli/Core/Chart/ChartSvgRenderer.cs:4949, …
  • `wickColor` carries text this program read out of the document being converted, and it is written straight into the `stroke` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `wickColor` at this site, or validate it against the shape the attribute accepts before interpolating it. (×2) — src/officecli/Core/Chart/ChartSvgRenderer.cs:3029, src/officecli/Core/Chart/ChartSvgRenderer.cs:3030
  • `fill` carries text this program read out of the document being converted, and it is written straight into the `fill` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `fill` at this site, or validate it against the shape the attribute accepts before interpolating it. (×4) — src/officecli/Core/Chart/ChartSvgRenderer.cs:5021, src/officecli/Core/Chart/ChartSvgRenderer.cs:5022, src/officecli/Core/Chart/ChartSvgRenderer.cs:5023, …
  • `stroke` carries text this program read out of the document being converted, and it is written straight into the `stroke` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `stroke` at this site, or validate it against the shape the attribute accepts before interpolating it. (×7) — src/officecli/Core/Chart/ChartSvgRenderer.cs:5021, src/officecli/Core/Chart/ChartSvgRenderer.cs:5022, src/officecli/Core/Chart/ChartSvgRenderer.cs:5023, …
  • `stroke` carries text this program read out of the document being converted, and it is written straight into the `fill` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `stroke` at this site, or validate it against the shape the attribute accepts before interpolating it. — src/officecli/Core/Chart/ChartSvgRenderer.cs:5028
  • `marker.Value` carries text this program read out of the document being converted, and it is written straight into the text of an element of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `marker.Value` at this site, or validate it against the shape the attribute accepts before interpolating it. — src/officecli/Core/RawXmlHelper.cs:1072
  • `seriesColor` carries text this program read out of the document being converted, and it is written straight into the `stroke` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `seriesColor` at this site, or validate it against the shape the attribute accepts before interpolating it. — src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:1651
  • `fldType` carries text this program read out of the document being converted, and it is written straight into the `type` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `fldType` at this site, or validate it against the shape the attribute accepts before interpolating it. — src/officecli/Handlers/Pptx/PowerPointHandler.View.cs:1117
  • `color` carries text this program read out of the document being converted, and it is written straight into the `w14:val` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `color` at this site, or validate it against the shape the attribute accepts before interpolating it. — src/officecli/Handlers/Word/WordHandler.Helpers.TextEffect.cs:54
  • `c2` carries text this program read out of the document being converted, and it is written straight into the `w14:val` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `c2` at this site, or validate it against the shape the attribute accepts before interpolating it. — src/officecli/Handlers/Word/WordHandler.Helpers.TextEffect.cs:69
  • `bgStyle` carries text this program read out of the document being converted, and it is written straight into the `style` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `bgStyle` at this site, or validate it against the shape the attribute accepts before interpolating it. — src/officecli/Handlers/Word/WordHandler.HtmlPreview.Charts.cs:91
  • `pageStyle` carries text this program read out of the document being converted, and it is written straight into the `style` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `pageStyle` at this site, or validate it against the shape the attribute accepts before interpolating it. — REDACTED:525
  • `style` carries text this program read out of the document being converted, and it is written straight into the `style` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `style` at this site, or validate it against the shape the attribute accepts before interpolating it. — REDACTED:1248
  • `txbxWrapStyle` carries text this program read out of the document being converted, and it is written straight into the `style` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `txbxWrapStyle` at this site, or validate it against the shape the attribute accepts before interpolating it. — REDACTED:1303
  • `w` carries text this program read out of the document being converted, and it is written straight into the `data-col-twips` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `w` at this site, or validate it against the shape the attribute accepts before interpolating it. (×2) — src/officecli/Handlers/Word/WordHandler.HtmlPreview.Tables.cs:395, src/officecli/Handlers/Word/WordHandler.HtmlPreview.Tables.cs:404
  • This type writes `vlabel` into generated markup in two ways. At src/officecli/Core/Chart/ChartSvgRenderer.cs:2267 it passes the value through `HtmlEncode` first; here it interpolates the same expression into the text of an element with nothing escaping it. Both sites are holes the surrounding literal itself delimits, so a value carrying `<` or `"` closes the markup at this site and does not at the other. Nothing about where the value came from is needed to call that a defect: the type has already stated, in its own code, that this expression needs escaping in this markup. Either escape `vlabel` here too, or remove the encoder call at the other site if the value was never able to carry markup. (×3) — src/officecli/Core/Chart/ChartSvgRenderer.cs:642, src/officecli/Core/Chart/ChartSvgRenderer.cs:691, src/officecli/Core/Chart/ChartSvgRenderer.cs:892

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 `foreach` leaves the collection it is walking alone — a body that adds to or removes from the very collection the loop is enumerating invalidates the enumerator it is holding, so the next `MoveNext` throws `InvalidOperationException` 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 element10.0 / 10Exemplary○ Nothing flagged

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.

X3 · Exception handling3.3 / 10Weak✓ Tool-verified

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

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

  • An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it. (×35) — src/officecli/BlankDocCreator.cs:70, src/officecli/CommandBuilder.Batch.cs:255, src/officecli/CommandBuilder.Batch.cs:546, …
  • `catch` does nothing with the exception it caught — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch. Log it through whatever this codebase already uses to report problems, or let it propagate; if one specific failure genuinely cannot matter, catch exactly that exception type and say why in a comment on the catch. (×5) — src/officecli/CommandBuilder.Batch.cs:488, src/officecli/CommandBuilder.Import.cs:243, src/officecli/CommandBuilder.Plugins.cs:342, …

What to do

  • Swallowed exception (empty catch)
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.

X32 · Type resolved by simple name across every loaded assembly10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a plugin lookup names the type it means — searching every assembly loaded into the process for a candidate whose SIMPLE name equals a string supplied at runtime, and taking the first one found, is decided by assembly LOAD ORDER rather than by this source, so the same name can resolve to a different type on the next run.

Method: Roslyn syntax only, no semantic model: every invocation of `First`/`FirstOrDefault`/`Single`/`SingleOrDefault` whose OWN expression subtree contains both a `GetAssemblies()` call and a `GetTypes()`/`GetExportedTypes()` call — a single-element pick out of every type loaded into the process. A nested selector in the same chain sees no `GetAssemblies()` in its own subtree and is outside the population, so one lookup counts once however many links its chain has. A finding additionally needs both remaining halves: the selector must be `First`/`FirstOrDefault` (`Single`/`SingleOrDefault` reports the ambiguity rather than resolving it, and is counted and never reported), and the chain must carry an `==` comparison of `<lambda parameter>.Name` against something that is not a literal. The receiver must be a plain identifier bound by one of the chain’s own lambdas, which places `assembly.GetName().Name == "X"` outside the rule by construction. One exemption: a `.Name` test joined by `&&` to a `FullName`/`AssemblyQualifiedName` test on the same identifier is spared; joined by `||` it is not. Deterministic, provable per finding. Advisory.

X5 · Nullable reference types9.2 / 10Exemplary✓ Tool-verified

Other · Code Health — Whether nullable reference types are enabled and not undermined by heavy `!` suppression.

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

  • ~1.1 `!` suppressions per 1k syntax nodes — 1633 suppression(s) across the 1554867 syntax node(s) in code where nullable warnings are ENABLED, which is the only code a `!` can suppress anything in (a `!` under `#nullable disable` is inert and is not counted, and its file's nodes are not in the denominator). Each one tells the compiler to trust you about null, suppressing the very safety NRTs provide.

What to do

  • Enable <Nullable>enable</Nullable> across all projects and resolve warnings rather than suppressing with `!`.

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 Health19%Critical — gated by D1, D2, R1, R2, R3, X1, X3Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture72%Adequate — gated by D26, AX5Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Maturity61%Adequate — gated by M2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Readiness26%Weak — gated by D8, D9, R4, R6, P3Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Security67%Adequate — gated by D29Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Performance60%AdequateStrongest area.
Unscored — 6 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 — this card publishes what the CI gate does with the test inventory rather than grading it. The findings above are its output.
  • SC1 Supply-chain hygiene — 2 observation(s) recorded · Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X10 Duplicated predicate — 25 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X6 Hand-rolled structured-format parsing — 8 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 16 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X9 Subsumed condition operand — 16 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 1 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.

  • P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 40 check(s) not relevant to this codebase

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

  • AC1 Text alternatives — No user-facing web UI (the repo is a library/CLI/worker/headless service) — accessibility is not applicable.
  • AC2 Forms & labels — No user-facing web UI (the repo is a library/CLI/worker/headless service) — accessibility is not applicable.
  • AC3 Page structure — No user-facing web UI (the repo is a library/CLI/worker/headless service) — accessibility is not applicable.
  • AC4 Keyboard semantics — No user-facing web UI (the repo is a library/CLI/worker/headless service) — accessibility is not applicable.
  • AC5 ARIA correctness — No user-facing web UI (the repo is a library/CLI/worker/headless service) — accessibility is not applicable.
  • AC6 Visual & motion safety — No user-facing web UI (the repo is a library/CLI/worker/headless service) — accessibility is not applicable.
  • AC7 A11y enforcement — No user-facing web UI (the repo is a library/CLI/worker/headless service) — accessibility is not applicable.
  • AX1 Captive dependencies — no DI registrations detected
  • AX2 Stateful singletons — no singleton implementations detected
  • AX7 Slice cohesion — not applicable — not a vertical-slice architecture
  • 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
  • AXB1 Runtime evidence locked — no reproducible boot — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • C1 Data Protection — No personal data detected in the analyzed source — no PII-typed entity/column names (Email, FirstName, DateOfBirth, …), no ASP.NET Identity / user-account model, and no stored user credentials. GDPR data-protection controls are therefore N/A here. If this is intentional, record the no-PII posture in an ADR; if the app does process personal data, name those fields conventionally so this dimension activates.
  • C2 Access Controls — No access-control surface detected in the analyzed source — no web/app surface to authorize (no HTTP API or web-UI project) and no authorization code at all (no [Authorize]/policies, no imperative guard methods). Access control is therefore N/A here — this is a library/CLI, which is authorized by its CALLER, not by itself. If this codebase grows request handlers, the dimension reactivates and a default-deny posture is expected then.
  • C3 Audit Trail — No personal data detected in the analyzed source — no PII-typed entity/column names (Email, FirstName, DateOfBirth, …), no ASP.NET Identity / user-account model, and no stored user credentials. GDPR data-protection controls are therefore N/A here. If this is intentional, record the no-PII posture in an ADR; if the app does process personal data, name those fields conventionally so this dimension activates.
  • C4 Data Retention — No personal data detected in the analyzed source — no PII-typed entity/column names (Email, FirstName, DateOfBirth, …), no ASP.NET Identity / user-account model, and no stored user credentials. GDPR data-protection controls are therefore N/A here. If this is intentional, record the no-PII posture in an ADR; if the app does process personal data, name those fields conventionally so this dimension activates.
  • C5 Data-Subject Rights — No personal data detected in the analyzed source — no PII-typed entity/column names (Email, FirstName, DateOfBirth, …), no ASP.NET Identity / user-account model, and no stored user credentials. GDPR data-protection controls are therefore N/A here. If this is intentional, record the no-PII posture in an ADR; if the app does process personal data, name those fields conventionally so this dimension activates.
  • D10 Test Quality — No tests were found in the analyzed repository to assess for quality.
  • D11 Test Reliability — No test suite was found to re-run, so reliability couldn't be assessed. Two searches produced that zero and both came back empty: the classifier that reads the loaded workspace recognised no suite it could run, and a walk of the source on disk — which covers the JS/TS `*.test.*` and `*.spec.*` conventions and probes for a Pester suite — found no test source in any other ecosystem either. Neither search reaches a suite that is missing from the loaded workspace and carries no name either walk recognises, so this is 'no suite found by those two searches', not a verdict that the repository has none.
  • D12 Dependency Hygiene — Dependency hygiene not measured
  • D16 Bus Factor — single-maintainer repository — bus factor is not applicable
  • D23 Boundary Type-Coupling — single shared-core project — no cross-context coupling to assess
  • D25 ADR Conformance — no ADRs to check
  • D31 IaC & Container Security — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
  • D32 Data Compliance (PII/GDPR) — 12 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
  • D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
  • D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
  • D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
  • D7 Architectural Integrity — no checkable ADRs and no dependency cycles — architectural integrity not assessed
  • DM1 Domain Modelling — not scored — this repository shows only 1 of the 3 signals this lens looks for (3 value object(s))
  • ED1 Event-Driven — not scored — this repository shows none of the 3 signals this lens looks for
  • ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
  • P7 Outbound HTTP resilience — not applicable — this isn't a service/API/worker
  • P8 Schema migrations — no EF Core usage detected
  • P9 Domain vs controller coverage — no coverage report found on disk — produce a coverage report in a standard format (Cobertura — `dotnet test --collect:"XPlat Code Coverage"` with a `coverlet.collector` PackageReference) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures, or wire coverage collection into CI, to enable this cross-layer check
  • R11 Import Boundaries — No recognizable feature-sliced/layered src layout — boundary rules not applicable.
  • R5 Dependency Freshness — no package-lock.json — dependency freshness not measured (would require an npm lockfile); JS/npm CVEs are scored in D30 (Dependency Vulnerabilities), which answers every ecosystem
  • S1 Web-Security Posture — No web surface detected in the analyzed source — no HTTP API or web-UI project (no controllers/minimal-API endpoints, no Razor/Blazor views) and no web middleware (HTTPS redirection, HSTS, security headers, cookies). Transport security, security headers, secure cookies, CSRF/input-validation and middleware-order controls are therefore N/A here — this is a library/CLI/worker, not a web app. Crypto hygiene was still checked and found nothing to flag. If this codebase becomes web-facing, the dimension reactivates automatically.
  • X4 Structured logging — This check asks whether log calls keep a message's values apart from its text, which needs a logger that can carry them as fields. This repository's C# was read, and every log call in it goes through a logger that takes one finished message — its own wrapper, log4net, Console or Debug — so an interpolated message there loses nothing the API could have kept. Calls through Microsoft.Extensions.Logging, Serilog, NLog or ZLogger, or any logger with a message-template overload, would be judged.

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 — 463 finding(s)
D17 · Explicit Debt · EmptyCatchBlock · ×430
  • EmptyCatchBlock src/officecli/BlankDocCreator.cs:70 — empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
  • EmptyCatchBlock src/officecli/CommandBuilder.Batch.cs:255 — empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
  • EmptyCatchBlock src/officecli/CommandBuilder.Batch.cs:546 — empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
  • EmptyCatchBlock src/officecli/CommandBuilder.Batch.cs:575 — empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
  • EmptyCatchBlock src/officecli/CommandBuilder.Batch.cs:597 — empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
  • EmptyCatchBlock src/officecli/CommandBuilder.Batch.cs:617 — empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
  • EmptyCatchBlock src/officecli/CommandBuilder.Batch.cs:638 — empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
  • EmptyCatchBlock src/officecli/CommandBuilder.Batch.cs:644 — empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
  • EmptyCatchBlock src/officecli/CommandBuilder.GetQuery.cs:138 — empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
  • EmptyCatchBlock src/officecli/CommandBuilder.GetQuery.cs:246 — empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
  • EmptyCatchBlock src/officecli/CommandBuilder.GetQuery.cs:408 — empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
  • EmptyCatchBlock src/officecli/CommandBuilder.Import.cs:362 — empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
  • EmptyCatchBlock src/officecli/CommandBuilder.Plugins.cs:171 — empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
  • EmptyCatchBlock src/officecli/CommandBuilder.View.cs:110 — empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
  • EmptyCatchBlock src/officecli/CommandBuilder.View.cs:188 — empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
  • EmptyCatchBlock src/officecli/CommandBuilder.View.cs:357 — empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
  • EmptyCatchBlock src/officecli/CommandBuilder.View.cs:358 — empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
  • EmptyCatchBlock src/officecli/CommandBuilder.View.cs:484 — empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
  • EmptyCatchBlock src/officecli/CommandBuilder.View.cs:512 — empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
  • EmptyCatchBlock src/officecli/CommandBuilder.View.cs:572 — empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
  • EmptyCatchBlock src/officecli/CommandBuilder.View.cs:601 — empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
  • EmptyCatchBlock src/officecli/CommandBuilder.View.cs:635 — empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
  • EmptyCatchBlock src/officecli/CommandBuilder.Watch.cs:56 — empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
  • EmptyCatchBlock src/officecli/CommandBuilder.cs:2102 — empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
  • EmptyCatchBlock src/officecli/Core/AtomicPackageWriter.cs:71 — empty catch block — the error is discarded with nothing recorded, so a failure here leaves no trace anywhere. Record it through whatever this codebase already uses to report problems, or let it propagate. Where swallowing one specific failure really is correct — as it often is on a teardown/dispose path where throwing would mask the original failure — catch exactly that exception type and write down WHY in a comment on the catch. Both are needed: a comment on a catch-all still swallows every failure nobody anticipated, and a note that only restates the swallow ("ignored", "do nothing") is read as no explanation at all.
  • + 405 more in this group — see findings.md.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D28 · Secrets (history) · High secret · ×6
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
AX3 · Project dependency cycles · Namespace dependency cycle · ×1
  • Namespace dependency cycle src/officecli/CommandBuilder.Add.cs:11 — The namespaces OfficeCli ↔ OfficeCli.Core ↔ OfficeCli.Core.Plugins ↔ OfficeCli.Core.Rendering ↔ OfficeCli.Handlers ↔ OfficeCli.Handlers.Rendering depend on each other. The lightest dependency in the cycle is OfficeCli → OfficeCli.Core.Plugins (OfficeCli.CommandBuilder → OfficeCli.Core.Plugins.ResolvedPlugin, 1 type pair(s)); cut that one first, e.g. by moving the shared type to a namespace both can use or inverting it behind an interface.
D17 · Explicit Debt · WriteOnlyPrivateField · ×1
  • WriteOnlyPrivateField src/officecli/Core/Formula/ModernFunctionQualifier.cs:144 — private Regex FunctionCallRegex — assigned 1 time(s), read never — this field is written and never read anywhere its type can be reached from, so the state it keeps answers no question: every assignment to it computes a value that nothing observes, on every instance, for the lifetime of each one. It reads as a flag the code branches on, and nothing branches on it. Delete the field and its assignments — or, if the value was MEANT to be consulted, the missing read is the defect this row is pointing at, and the branch that should have depended on it is not there.
D17 · Explicit Debt · DeadLoopAccumulator · ×1
  • DeadLoopAccumulator src/officecli/Core/RawXmlHelper.cs:1098 — int i = 0; … if (i < endpoint.Length && endpoint[i] == '$') — this reset runs at the top of every pass, so the value is back to its starting constant before the test below it is reached: the test is decided the same way on every iteration, and whatever the loop adds to this variable further down is wiped out before anything can read it. The threshold it is guarding can therefore never be crossed, however many times the loop goes round, which is why nothing has ever been seen to trip. Move the reset ABOVE the loop, so the count accumulates across iterations the way the test below assumes; if it really is meant to be per-iteration state, then the test belongs with it and the accumulation does not.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D8 · Code Coverage · No automated tests · ×1
  • No automated tests — No automated tests — no test code was found in this repository. Untested code is the largest single risk to changing it safely. Start with the code you change most often: add a suite in a framework a runner can collect (xUnit, NUnit or MSTest), and run it in CI so the gap cannot reopen.
Serious — 3611 finding(s)
D3 · God Classes · MethodTooLong · ×235
  • MethodTooLong: ChartHelper.SetChartProperties src/officecli/Core/Chart/ChartHelper.Setter.cs:219 — MethodTooLong — SetChartProperties runs 1923 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1823 over it, 19.23× 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: PowerPointHandler.SetRunOrShapeProperties src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:165 — MethodTooLong — SetRunOrShapeProperties runs 1329 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1229 over it, 13.29× 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: PowerPointHandler.Get REDACTED:18 — MethodTooLong — Get runs 982 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 882 over it, 9.82× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: WordHandler.ParagraphToNode src/officecli/Handlers/Word/WordHandler.Navigation.cs:4006 — MethodTooLong — ParagraphToNode runs 982 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 882 over it, 9.82× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: WordHandler.AddParagraph src/officecli/Handlers/Word/WordHandler.Add.Text.cs:13 — MethodTooLong — AddParagraph runs 861 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 761 over it, 8.61× 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: WordHandler.QueryDispatch src/officecli/Handlers/Word/WordHandler.Query.cs:1742 — MethodTooLong — QueryDispatch runs 854 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 754 over it, 8.54× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: PowerPointHandler.AddPartCore REDACTED:744 — MethodTooLong — AddPartCore runs 832 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 732 over it, 8.32× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ChartHelper.ReadChartProperties src/officecli/Core/Chart/ChartHelper.Reader.cs:31 — MethodTooLong — ReadChartProperties runs 801 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 701 over it, 8.01× 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: PowerPointHandler.SetTableCellProperties src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:2716 — MethodTooLong — SetTableCellProperties runs 711 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 611 over it, 7.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: PowerPointHandler.ShapeToNode src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:866 — MethodTooLong — ShapeToNode runs 641 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 541 over it, 6.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.
  • MethodTooLong: FormulaParser.ParseCommand src/officecli/Core/Formula/FormulaParser.cs:1284 — MethodTooLong — ParseCommand runs 613 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 513 over it, 6.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: ExcelHandler.Get src/officecli/Handlers/Excel/ExcelHandler.Query.cs:16 — MethodTooLong — Get runs 591 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 491 over it, 5.91× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ExcelHandler.RemoveCore src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:20 — MethodTooLong — RemoveCore runs 582 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 482 over it, 5.82× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ExcelHandler.SetSheetLevel src/officecli/Handlers/Excel/ExcelHandler.Set.Sheet.cs:31 — MethodTooLong — SetSheetLevel runs 573 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 473 over it, 5.73× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: WordHandler.AddRun src/officecli/Handlers/Word/WordHandler.Add.Text.cs:2193 — MethodTooLong — AddRun runs 506 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 406 over it, 5.06× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ChartSvgRenderer.ExtractChartInfo src/officecli/Core/Chart/ChartSvgRenderer.cs:3388 — MethodTooLong — ExtractChartInfo runs 505 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 405 over it, 5.05× 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: WordHandler.Get src/officecli/Handlers/Word/WordHandler.Query.cs:95 — MethodTooLong — Get runs 476 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 376 over it, 4.76× 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: PowerPointHandler.QueryDispatch REDACTED:1545 — MethodTooLong — QueryDispatch runs 469 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 369 over it, 4.69× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ChartSvgRenderer.RenderBarChartSvg src/officecli/Core/Chart/ChartSvgRenderer.cs:310 — MethodTooLong — RenderBarChartSvg runs 431 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 331 over it, 4.31× 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: ExcelHandler.QueryDispatch src/officecli/Handlers/Excel/ExcelHandler.Query.cs:1192 — MethodTooLong — QueryDispatch runs 430 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 330 over it, 4.30× 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: PowerPointHandler.RenderShape src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:21 — MethodTooLong — RenderShape runs 429 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 329 over it, 4.29× 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: WordHandler.RemoveCore src/officecli/Handlers/Word/WordHandler.Mutations.cs:21 — MethodTooLong — RemoveCore runs 426 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 326 over it, 4.26× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: CommandBuilder.BuildViewCommand src/officecli/CommandBuilder.View.cs:12 — MethodTooLong — BuildViewCommand runs 421 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 321 over it, 4.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: WordBatchEmitter.EmitTable src/officecli/Handlers/Word/WordBatchEmitter.Table.cs:102 — MethodTooLong — EmitTable runs 421 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 321 over it, 4.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: PowerPointHandler.RemoveCore src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:19 — MethodTooLong — RemoveCore runs 416 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 316 over it, 4.16× 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.
  • + 210 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×92
  • Duplicated block (6 lines × 2) src/officecli/Core/Chart/ChartSvgRenderer.cs:5163 — src/officecli/Core/Chart/ChartSvgRenderer.cs:5163-5168 | src/officecli/Core/Chart/ChartSvgRenderer.cs:5241-5246 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartSvgRenderer.cs:5163` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:546 — src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:546-551 | src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:903-908 — both copies are in the same file, so extract the 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) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Chart.cs:243 — src/officecli/Handlers/Excel/ExcelHandler.Helpers.Chart.cs:243-248 | src/officecli/Handlers/Excel/ExcelHandler.Set.Drawings.cs:185-190 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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) src/officecli/Handlers/Excel/ExcelHandler.SheetShift.cs:122 — src/officecli/Handlers/Excel/ExcelHandler.SheetShift.cs:122-127 | src/officecli/Handlers/Excel/ExcelHandler.SheetShift.cs:145-150 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.SheetShift.cs: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 (6 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:774 — src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:774-779 | src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:1436-1441 — both copies are in the same file, so extract the 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) src/officecli/CommandBuilder.View.cs:235 — src/officecli/CommandBuilder.View.cs:235-240 | src/officecli/ResidentServer.cs:1614-1619 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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) src/officecli/Core/Formula/FormulaEvaluator.Regression.cs:146 — src/officecli/Core/Formula/FormulaEvaluator.Regression.cs:146-151 | src/officecli/Core/Formula/FormulaEvaluator.Regression.cs:219-224 — both copies are in the same file, so extract the 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) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Chart.cs:261 — src/officecli/Handlers/Excel/ExcelHandler.Helpers.Chart.cs:261-266 | src/officecli/Handlers/Excel/ExcelHandler.Set.Drawings.cs:197-202 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) REDACTED:4300 — REDACTED:4300-4305 | REDACTED:5022-5027 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:4300` it begins part-way through the construct above it, so those exact lines 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) src/officecli/Handlers/Word/WordHandler.Set.Element.cs:702 — src/officecli/Handlers/Word/WordHandler.Set.Element.cs:702-707 | src/officecli/Handlers/Word/WordHandler.Set.Element.cs:713-718 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Set.Element.cs:702` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) src/officecli/Core/PivotTableHelper.Render.cs:655 — src/officecli/Core/PivotTableHelper.Render.cs:655-660 | src/officecli/Core/PivotTableHelper.Render.cs:986-991 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (6 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs:477 — src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs:477-482 | src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:903-908 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs:477` it does not close everything it opens, so those exact lines 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) src/officecli/Handlers/Excel/ExcelHandler.DumpSupport.cs:207 — src/officecli/Handlers/Excel/ExcelHandler.DumpSupport.cs:207-212 | src/officecli/Handlers/Excel/ExcelHandler.Helpers.Node.cs:954-959 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Excel/ExcelHandler.DumpSupport.cs:207` it does not close everything it opens, so those exact lines 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) src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2107 — src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2107-2112 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:2225-2230 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2107` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:161 — src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:161-166 | src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:172-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 (6 lines × 2) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:3497 — src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:3497-3502 | src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:712-717 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:3497` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) src/officecli/Handlers/WordHandler.cs:1025 — src/officecli/Handlers/WordHandler.cs:1025-1030 | src/officecli/Handlers/WordHandler.cs:1225-1230 — both copies are in the same file, so extract the 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) src/officecli/ResidentClient.cs:27 — src/officecli/ResidentClient.cs:27-32 | src/officecli/ResidentClient.cs:176-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. The matched lines also transfer control out of the body holding them, 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, `src/officecli/ResidentClient.cs:174` calls `ToString` and `src/officecli/ResidentClient.cs:25` 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) src/officecli/Core/Chart/ChartHelper.Builder.cs:1803 — src/officecli/Core/Chart/ChartHelper.Builder.cs:1803-1808 | src/officecli/Core/Chart/ChartHelper.Setter.cs:3674-3679 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Core/Chart/ChartHelper.Builder.cs:1803` it begins part-way through the construct above it, so those exact lines 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) src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:673 — src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:673-678 | src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:1167-1172 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:673` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:670` calls `ToLowerInvariant` and `src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:1164` 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) src/officecli/Core/Chart/ChartSvgRenderer.cs:567 — src/officecli/Core/Chart/ChartSvgRenderer.cs:567-572 | src/officecli/Core/Chart/ChartSvgRenderer.cs:828-833 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartSvgRenderer.cs:567` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) src/officecli/Core/Chart/ChartSvgRenderer.cs:826 — src/officecli/Core/Chart/ChartSvgRenderer.cs:826-831 | src/officecli/Core/Chart/ChartSvgRenderer.cs:2145-2150 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartSvgRenderer.cs:826` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (6 lines × 2) src/officecli/Core/PivotTableHelper.Parse.cs:19 — src/officecli/Core/PivotTableHelper.Parse.cs:19-24 | src/officecli/Core/PivotTableHelper.Parse.cs:43-48 — both copies are in the same file, so extract the 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) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:165 — src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:165-170 | src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:196-201 — both copies are in the same file, so extract the 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) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.Pictures.cs:26 — src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.Pictures.cs:26-31 | src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.Shapes.cs:27-32 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.Pictures.cs:26` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • + 67 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×85
  • Duplicated block (5 lines × 2) src/officecli/Core/Formula/FormulaEvaluator.Spill.cs:341 — src/officecli/Core/Formula/FormulaEvaluator.Spill.cs:341-345 | src/officecli/Core/Formula/FormulaEvaluator.Spill.cs:357-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. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Formula/FormulaEvaluator.Spill.cs:341` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) src/officecli/Handlers/Word/WordHandler.Navigation.cs:2376 — src/officecli/Handlers/Word/WordHandler.Navigation.cs:2376-2380 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:5998-6002 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Navigation.cs:2376` it begins part-way through the construct above it, so those exact lines 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) src/officecli/Core/Formula/FormulaParser.cs:486 — src/officecli/Core/Formula/FormulaParser.cs:486-490 | src/officecli/Core/Formula/FormulaParser.cs:869-873 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Formula/FormulaParser.cs:486` it begins part-way through the construct above it, so those exact lines 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) src/officecli/Handlers/Pptx/PowerPointHandler.Background.cs:675 — src/officecli/Handlers/Pptx/PowerPointHandler.Background.cs:675-679 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1138-1142 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Background.cs:675` it does not close everything it opens, so those exact lines 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) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1982 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1982-1986 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2123-2127 — both copies are in the same file, so extract the 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) src/officecli/Handlers/WordHandler.cs:1147 — src/officecli/Handlers/WordHandler.cs:1147-1151 | src/officecli/Handlers/WordHandler.cs:1372-1376 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/WordHandler.cs:1147` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) src/officecli/Core/Chart/ChartHelper.Reader.cs:2226 — src/officecli/Core/Chart/ChartHelper.Reader.cs:2226-2230 | src/officecli/Core/Chart/ChartHelper.Reader.cs:2285-2289 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartHelper.Reader.cs:2226` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) src/officecli/Core/Chart/ChartHelper.Setter.cs:1522 — src/officecli/Core/Chart/ChartHelper.Setter.cs:1522-1526 | src/officecli/Core/Chart/ChartHelper.Setter.cs:1543-1547 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartHelper.Setter.cs:1522` it does not close everything it opens, so those exact lines 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) src/officecli/Core/Chart/ChartSvgRenderer.CxExtract.cs:186 — src/officecli/Core/Chart/ChartSvgRenderer.CxExtract.cs:186-190 | src/officecli/Core/Chart/ChartSvgRenderer.cs:3715-3719 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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) REDACTED:2835 — REDACTED:2835-2839 | REDACTED:4551-4555 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:2835` it does not close everything it opens, so those exact lines 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) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1574 — src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1574-1578 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1643-1647 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1574` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (5 lines × 2) src/officecli/CommandBuilder.Add.cs:519 — src/officecli/CommandBuilder.Add.cs:519-523 | src/officecli/ResidentServer.cs:2490-2494 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (5 lines × 2) src/officecli/Core/Chart/ChartHelper.Setter.cs:3033 — src/officecli/Core/Chart/ChartHelper.Setter.cs:3033-3037 | src/officecli/Core/Chart/ChartHelper.Setter.cs:3095-3099 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) src/officecli/Core/Chart/ChartSvgRenderer.cs:1034 — src/officecli/Core/Chart/ChartSvgRenderer.cs:1034-1038 | src/officecli/Core/Chart/ChartSvgRenderer.cs:2279-2283 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) src/officecli/Core/Formula/FormulaEvaluator.Spill.cs:85 — src/officecli/Core/Formula/FormulaEvaluator.Spill.cs:85-89 | src/officecli/Core/Formula/FormulaEvaluator.SpillLambda.cs:110-114 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, 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) src/officecli/Core/Formula/FormulaParser.cs:2305 — src/officecli/Core/Formula/FormulaParser.cs:2305-2309 | src/officecli/Core/Formula/FormulaParser.cs:2347-2351 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Formula/FormulaParser.cs:2305` it does not close everything it opens, so those exact lines 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) src/officecli/Handlers/Excel/ExcelHandler.FormulaCache.cs:384 — src/officecli/Handlers/Excel/ExcelHandler.FormulaCache.cs:384-388 | src/officecli/Handlers/Excel/ExcelHandler.Helpers.Sheet.cs:675-679 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Shape.cs:395 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Shape.cs:395-399 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:911-915 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (5 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Align.cs:106 — src/officecli/Handlers/Pptx/PowerPointHandler.Align.cs:106-110 | src/officecli/Handlers/Pptx/PowerPointHandler.Align.cs:128-132 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Align.cs:106` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, 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) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1953 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1953-1957 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2039-2043 — both copies are in the same file, so extract the 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) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Text.cs:171 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Text.cs:171-175 | src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:1295-1299 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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) REDACTED:2549 — REDACTED:2549-2553 | REDACTED:2690-2694 — both copies are in the same file, so extract the 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) src/officecli/Handlers/Word/WordHandler.StyleList.cs:996 — src/officecli/Handlers/Word/WordHandler.StyleList.cs:996-1000 | src/officecli/Handlers/Word/WordHandler.StyleList.cs:1018-1022 — both copies are in the same file, so extract the 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) src/officecli/Core/Chart/ChartSvgRenderer.CxExtract.cs:179 — src/officecli/Core/Chart/ChartSvgRenderer.CxExtract.cs:179-183 | src/officecli/Core/Chart/ChartSvgRenderer.cs:3647-3651 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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) src/officecli/Core/Chart/ChartSvgRenderer.CxExtract.cs:213 — src/officecli/Core/Chart/ChartSvgRenderer.CxExtract.cs:213-217 | src/officecli/Core/Chart/ChartSvgRenderer.cs:3810-3814 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • + 60 more in this group — see findings.md.
D3 · God Classes · FileTooLong · ×84
  • FileTooLong: Word/WordHandler.Navigation.cs src/officecli/Handlers/Word/WordHandler.Navigation.cs — FileTooLong — 3346 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2846 over it, 6.69× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: Chart/ChartSvgRenderer.cs src/officecli/Core/Chart/ChartSvgRenderer.cs — FileTooLong — 3336 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2836 over it, 6.67× 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: REDACTED REDACTED — FileTooLong — 2778 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2278 over it, 5.56× 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: Chart/ChartHelper.Setter.cs src/officecli/Core/Chart/ChartHelper.Setter.cs — FileTooLong — 2657 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2157 over it, 5.31× 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: Pptx/PowerPointHandler.ShapeProperties.cs src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs — FileTooLong — 2303 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1803 over it, 4.61× 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: Word/WordBatchEmitter.Paragraph.cs src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs — FileTooLong — 2173 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1673 over it, 4.35× 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: Excel/ExcelHandler.HtmlPreview.cs src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs — FileTooLong — 2158 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1658 over it, 4.32× 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: Word/WordHandler.Set.Element.cs src/officecli/Handlers/Word/WordHandler.Set.Element.cs — FileTooLong — 2080 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1580 over it, 4.16× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: Word/WordHandler.Query.cs src/officecli/Handlers/Word/WordHandler.Query.cs — FileTooLong — 1947 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1447 over it, 3.89× 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: Formula/FormulaParser.cs src/officecli/Core/Formula/FormulaParser.cs — FileTooLong — 1895 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1395 over it, 3.79× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: Word/WordHandler.Add.Misc.cs src/officecli/Handlers/Word/WordHandler.Add.Misc.cs — FileTooLong — 1829 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1329 over it, 3.66× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: Pptx/PowerPointHandler.NodeBuilder.cs src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs — FileTooLong — 1786 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1286 over it, 3.57× 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: Pptx/PowerPointHandler.Animations.cs src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs — FileTooLong — 1780 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1280 over it, 3.56× 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: Pptx/PowerPointHandler.HtmlPreview.Css.cs src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs — FileTooLong — 1734 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1234 over it, 3.47× 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: Word/WordHandler.Add.Text.cs src/officecli/Handlers/Word/WordHandler.Add.Text.cs — FileTooLong — 1711 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1211 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: Word/WordHandler.HtmlPreview.Css.cs src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs — FileTooLong — 1666 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1166 over it, 3.33× 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: REDACTED REDACTED — FileTooLong — 1644 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1144 over it, 3.29× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: Pptx/PowerPointHandler.HtmlPreview.Shapes.cs src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs — FileTooLong — 1629 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1129 over it, 3.26× 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: Word/WordHandler.Add.Structure.cs src/officecli/Handlers/Word/WordHandler.Add.Structure.cs — FileTooLong — 1597 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1097 over it, 3.19× 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: Word/WordBatchEmitter.Resources.cs src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs — FileTooLong — 1577 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1077 over it, 3.15× 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: REDACTED REDACTED — FileTooLong — 1477 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 977 over it, 2.95× 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: Formula/FormulaEvaluator.Functions.cs src/officecli/Core/Formula/FormulaEvaluator.Functions.cs — FileTooLong — 1474 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 974 over it, 2.95× 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: Watch/WatchServer.cs src/officecli/Core/Watch/WatchServer.cs — FileTooLong — 1455 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 955 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: Word/WordHandler.Mutations.cs src/officecli/Handlers/Word/WordHandler.Mutations.cs — FileTooLong — 1446 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 946 over it, 2.89× 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: officecli/ResidentServer.cs src/officecli/ResidentServer.cs — FileTooLong — 1392 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 892 over it, 2.78× 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.
  • + 59 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×66
  • Duplicated block (7 lines × 2) REDACTED:1810 — REDACTED:1810-1816 | REDACTED:1867-1873 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1810` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) src/officecli/Handlers/Word/WordHandler.Set.Element.cs:461 — src/officecli/Handlers/Word/WordHandler.Set.Element.cs:461-467 | src/officecli/Handlers/Word/WordHandler.Set.Element.cs:487-493 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Set.Element.cs:461` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (7 lines × 2) src/officecli/Core/Chart/ChartExBuilder.Setter.cs:179 — src/officecli/Core/Chart/ChartExBuilder.Setter.cs:179-185 | src/officecli/Core/Chart/ChartExBuilder.Setter.cs:191-197 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartExBuilder.Setter.cs:179` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (7 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:944 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:944-950 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:974-980 — both copies are in the same file, so extract the 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 `part` to `OpenXmlPart` in one and `OpenXmlPart?` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (7 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Resolve.cs:56 — src/officecli/Handlers/Pptx/PowerPointHandler.Resolve.cs:56-62 | src/officecli/Handlers/Pptx/PowerPointHandler.Resolve.cs:137-143 — both copies are in the same file, so extract the 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 `slideIdx` to `ExtendedChartPart? extChartPart) ResolveChart(int` in one and `Drawing.Table table) ResolveTable(int` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (7 lines × 2) src/officecli/CommandBuilder.cs:2134 — src/officecli/CommandBuilder.cs:2134-2140 | src/officecli/ResidentServer.cs:1440-1446 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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) src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs:535 — src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs:535-541 | src/officecli/Handlers/Excel/ExcelHandler.Set.Tables.cs:220-226 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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) src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2535 — src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2535-2541 | src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2586-2592 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2535` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) src/officecli/Core/Chart/ChartHelper.Axis.cs:787 — src/officecli/Core/Chart/ChartHelper.Axis.cs:787-793 | src/officecli/Core/Chart/ChartHelper.Setter.cs:1119-1125 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/officecli/Core/Chart/ChartHelper.Axis.cs:796` calls `Add` and `src/officecli/Core/Chart/ChartHelper.Setter.cs:1126` 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) src/officecli/Core/PivotTableHelper.Render.cs:676 — src/officecli/Core/PivotTableHelper.Render.cs:676-682 | src/officecli/Core/PivotTableHelper.Render.cs:976-982 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (7 lines × 2) src/officecli/Core/PivotTableHelper.Render.cs:1370 — src/officecli/Core/PivotTableHelper.Render.cs:1370-1376 | src/officecli/Core/PivotTableHelper.Render.cs:1418-1424 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (7 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:489 — src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:489-495 | src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:915-921 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:489` it does not close everything it opens, so those exact lines 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) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:486 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:486-492 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1361-1367 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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) src/officecli/Handlers/Word/WordHandler.Add.Diagram.cs:391 — src/officecli/Handlers/Word/WordHandler.Add.Diagram.cs:391-397 | src/officecli/Handlers/Word/WordHandler.Add.Diagram.cs:435-441 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Add.Diagram.cs:391` it does not close everything it opens, so those exact lines 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) src/officecli/Handlers/Word/WordHandler.Mutations.cs:1307 — src/officecli/Handlers/Word/WordHandler.Mutations.cs:1307-1313 | src/officecli/Handlers/Word/WordHandler.Mutations.cs:1550-1556 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Mutations.cs:1307` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (7 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Query.cs:585 — src/officecli/Handlers/Excel/ExcelHandler.Query.cs:585-591 | src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:1159-1165 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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) src/officecli/Handlers/Pptx/PowerPointHandler.Comments.cs:209 — src/officecli/Handlers/Pptx/PowerPointHandler.Comments.cs:209-215 | src/officecli/Handlers/Pptx/PowerPointHandler.ModernComments.cs:148-154 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Comments.cs:209` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:3230 — src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:3230-3236 | src/officecli/Handlers/Word/WordHandler.Set.Element.cs:3378-3384 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:3230` it does not close everything it opens, so those exact lines 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) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Text.cs:38 — src/officecli/Handlers/Word/WordHandler.HtmlPreview.Text.cs:38-44 | src/officecli/Handlers/Word/WordHandler.HtmlPreview.Text.cs:63-69 — both copies are in the same file, so extract the 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) src/officecli/Handlers/Word/WordHandler.Navigation.cs:4288 — src/officecli/Handlers/Word/WordHandler.Navigation.cs:4288-4294 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:4328-4334 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Navigation.cs:4288` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) src/officecli/Handlers/WordHandler.cs:2344 — src/officecli/Handlers/WordHandler.cs:2344-2350 | src/officecli/Handlers/WordHandler.cs:2409-2415 — both copies are in the same file, so extract the 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, `src/officecli/Handlers/WordHandler.cs:2351` calls `Where`, `ToList`, `TrackMax` and `src/officecli/Handlers/WordHandler.cs:2416` 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) src/officecli/CommandBuilder.View.cs:391 — src/officecli/CommandBuilder.View.cs:391-397 | src/officecli/ResidentServer.cs:1731-1737 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/CommandBuilder.View.cs:391` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (7 lines × 2) src/officecli/Core/Chart/ChartHelper.Reader.cs:630 — src/officecli/Core/Chart/ChartHelper.Reader.cs:630-636 | src/officecli/Core/Chart/ChartHelper.Reader.cs:660-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. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartHelper.Reader.cs:630` it does not close everything it opens, so those exact lines 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) src/officecli/Core/Chart/ChartHelper.Setter.cs:1011 — src/officecli/Core/Chart/ChartHelper.Setter.cs:1011-1017 | src/officecli/Core/Chart/ChartHelper.Setter.cs:1980-1986 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartHelper.Setter.cs:1011` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) src/officecli/Core/Chart/ChartHelper.Setter.cs:1727 — src/officecli/Core/Chart/ChartHelper.Setter.cs:1727-1733 | src/officecli/Core/Chart/ChartHelper.Setter.cs:1765-1771 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartHelper.Setter.cs:1727` it begins part-way through the construct above it, so those 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.
  • + 41 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×57
  • Duplicated block (8 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:548 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:548-555 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:705-712 — both copies are in the same file, so extract the 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) src/officecli/Core/Formula/FormulaParser.cs:2121 — src/officecli/Core/Formula/FormulaParser.cs:2121-2128 | src/officecli/Core/Formula/FormulaParser.cs:2145-2152 — both copies are in the same file, so extract the 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) src/officecli/Core/Chart/ChartHelper.Advanced.cs:157 — src/officecli/Core/Chart/ChartHelper.Advanced.cs:157-164 | src/officecli/Core/Chart/ChartHelper.Advanced.cs:645-652 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartHelper.Advanced.cs:157` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1343 — src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1343-1350 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1402-1409 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1343` it begins part-way through the construct above it, so those 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) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Table.cs:382 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Table.cs:382-389 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Table.cs:405-412 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Set.Table.cs:382` it does not close everything it opens, so those exact lines 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) src/officecli/CommandBuilder.Mark.cs:33 — src/officecli/CommandBuilder.Mark.cs:33-40 | src/officecli/CommandBuilder.Mark.cs:255-262 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/CommandBuilder.Mark.cs:33` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) src/officecli/Core/PivotTableHelper.Render.cs:644 — src/officecli/Core/PivotTableHelper.Render.cs:644-651 | src/officecli/Core/PivotTableHelper.Render.cs:965-972 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (8 lines × 2) src/officecli/Core/PivotTableHelper.Render.cs:1359 — src/officecli/Core/PivotTableHelper.Render.cs:1359-1366 | src/officecli/Core/PivotTableHelper.Render.cs:1380-1387 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (8 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Effects.cs:832 — src/officecli/Handlers/Pptx/PowerPointHandler.Effects.cs:832-839 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:3791-3798 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:3895 — src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:3895-3902 | src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:3937-3944 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:3895` it does not close everything it opens, so those 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) src/officecli/Handlers/Word/WordHandler.Add.Text.cs:699 — src/officecli/Handlers/Word/WordHandler.Add.Text.cs:699-706 | src/officecli/Handlers/Word/WordHandler.Set.Element.cs:1695-1702 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (8 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.ChartCache.cs:205 — src/officecli/Handlers/Excel/ExcelHandler.ChartCache.cs:205-212 | src/officecli/Handlers/Excel/ExcelHandler.ChartCache.cs:248-255 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.ChartCache.cs:205` it begins part-way through the construct above it, so those exact lines 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) src/officecli/Handlers/Excel/ExcelHandler.View.cs:271 — src/officecli/Handlers/Excel/ExcelHandler.View.cs:271-278 | src/officecli/Handlers/Excel/ExcelHandler.View.cs:329-336 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.View.cs: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. The matched lines also transfer control out of the body holding them, 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) src/officecli/Handlers/Word/WordHandler.Helpers.TextEffect.cs:291 — src/officecli/Handlers/Word/WordHandler.Helpers.TextEffect.cs:291-298 | src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:1998-2005 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Word/WordHandler.Helpers.TextEffect.cs:291` it begins part-way through the construct above it, so those exact lines 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) src/officecli/Core/Chart/ChartExBuilder.Setter.cs:103 — src/officecli/Core/Chart/ChartExBuilder.Setter.cs:103-110 | src/officecli/Core/Chart/ChartExBuilder.Setter.cs: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. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartExBuilder.Setter.cs:103` it begins part-way through the construct above it, so those 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) src/officecli/Core/Chart/ChartHelper.Advanced.cs:466 — src/officecli/Core/Chart/ChartHelper.Advanced.cs:466-473 | src/officecli/Core/Chart/ChartHelper.Setter.cs:3394-3403 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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) src/officecli/Core/Chart/ChartHelper.Builder.cs:1123 — src/officecli/Core/Chart/ChartHelper.Builder.cs:1123-1130 | src/officecli/Core/Chart/ChartHelper.Builder.cs:1148-1156 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartHelper.Builder.cs:1148` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/officecli/Core/Chart/ChartHelper.Builder.cs:1159` calls `AppendChild`, `SeriesLines` and `src/officecli/Core/Chart/ChartHelper.Builder.cs:1131` 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) src/officecli/Core/Chart/ChartHelper.Reader.cs:1988 — src/officecli/Core/Chart/ChartHelper.Reader.cs:1988-1995 | src/officecli/Core/Chart/ChartHelper.Reader.cs:1998-2005 — both copies are in the same file, so extract the 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) src/officecli/Core/Chart/ChartHelper.Reader.cs:2011 — src/officecli/Core/Chart/ChartHelper.Reader.cs:2011-2018 | src/officecli/Core/Chart/ChartHelper.Reader.cs:2020-2027 — both copies are in the same file, so extract the 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) src/officecli/Core/Chart/ChartHelper.Reader.cs:2420 — src/officecli/Core/Chart/ChartHelper.Reader.cs:2420-2427 | src/officecli/Core/Chart/ChartHelper.Reader.cs:2428-2435 — both copies are in the same file, so extract the 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) src/officecli/Core/Chart/ChartHelper.Setter.cs:1275 — src/officecli/Core/Chart/ChartHelper.Setter.cs:1275-1286 | src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:591-598 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Core/Chart/ChartHelper.Setter.cs:1275` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (8 lines × 2) src/officecli/Core/Chart/ChartHelper.Setter.cs:3362 — src/officecli/Core/Chart/ChartHelper.Setter.cs:3362-3369 | src/officecli/Core/Chart/ChartHelper.Setter.cs:3409-3416 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartHelper.Setter.cs:3362` it does not close everything it opens, so those exact lines 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) src/officecli/Core/Chart/ChartSvgRenderer.cs:1549 — src/officecli/Core/Chart/ChartSvgRenderer.cs:1549-1556 | src/officecli/Core/Chart/ChartSvgRenderer.cs:2637-2644 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartSvgRenderer.cs:1549` it begins part-way through the construct above it, so those exact lines 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) src/officecli/Core/ExcelStyleManager.cs:1124 — src/officecli/Core/ExcelStyleManager.cs:1124-1131 | src/officecli/Core/ExcelStyleManager.cs:1783-1790 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/ExcelStyleManager.cs:1124` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) src/officecli/Core/FontMetricsReader.cs:46 — src/officecli/Core/FontMetricsReader.cs:46-53 | src/officecli/Core/FontMetricsReader.cs:447-454 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/FontMetricsReader.cs:46` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • + 32 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Hotspot · ×54
  • Hotspot: src/officecli/Handlers/Word/WordHandler.Add.Text.cs src/officecli/Handlers/Word/WordHandler.Add.Text.cs:13 — src/officecli/Handlers/Word/WordHandler.Add.Text.cs changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 541 in WordHandler.AddParagraph at line 13. 5 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 21:59:06 +08:00' --until='2026-10-20 21:59:06 +08:00' --full-history --no-merges -- src/officecli/Handlers/Word/WordHandler.Add.Text.cs`: 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: src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:165 — src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 565 in PowerPointHandler.SetRunOrShapeProperties at line 165. 4 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 21:59:06 +08:00' --until='2026-10-20 21:59:06 +08:00' --full-history --no-merges -- src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs`: 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: src/officecli/Core/Chart/ChartHelper.Setter.cs src/officecli/Core/Chart/ChartHelper.Setter.cs:219 — src/officecli/Core/Chart/ChartHelper.Setter.cs changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 809 in ChartHelper.SetChartProperties at line 219. 3 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 21:59:06 +08:00' --until='2026-10-20 21:59:06 +08:00' --full-history --no-merges -- src/officecli/Core/Chart/ChartHelper.Setter.cs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: REDACTED REDACTED:744 — REDACTED changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 461 in PowerPointHandler.AddPartCore at line 744. 5 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 21:59:06 +08:00' --until='2026-10-20 21:59:06 +08:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/officecli/Core/Markdown/MarkdownParser.cs src/officecli/Core/Markdown/MarkdownParser.cs:630 — src/officecli/Core/Markdown/MarkdownParser.cs changed 31 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 72 in MarkdownParser.ParseInlines at line 630. 31 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 21:59:06 +08:00' --until='2026-10-20 21:59:06 +08:00' --full-history --no-merges -- src/officecli/Core/Markdown/MarkdownParser.cs`: 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: src/officecli/CommandBuilder.cs src/officecli/CommandBuilder.cs:945 — src/officecli/CommandBuilder.cs changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 126 in CommandBuilder.ExecuteBatchItem at line 945. 11 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 21:59:06 +08:00' --until='2026-10-20 21:59:06 +08:00' --full-history --no-merges -- src/officecli/CommandBuilder.cs`: 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: src/officecli/Handlers/Word/WordHandler.Navigation.cs src/officecli/Handlers/Word/WordHandler.Navigation.cs:1184 — src/officecli/Handlers/Word/WordHandler.Navigation.cs changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 180 in WordHandler.NavigateToElement at line 1184. 7 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 21:59:06 +08:00' --until='2026-10-20 21:59:06 +08:00' --full-history --no-merges -- src/officecli/Handlers/Word/WordHandler.Navigation.cs`: 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: src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:866 — src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 350 in PowerPointHandler.ShapeToNode at line 866. 2 of those changes were fix/bug commits, and the other 2 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 21:59:06 +08:00' --until='2026-10-20 21:59:06 +08:00' --full-history --no-merges -- src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs`: 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: src/officecli/Handlers/Excel/ExcelHandler.Query.cs src/officecli/Handlers/Excel/ExcelHandler.Query.cs:16 — src/officecli/Handlers/Excel/ExcelHandler.Query.cs changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 228 in ExcelHandler.Get at line 16. 6 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 21:59:06 +08:00' --until='2026-10-20 21:59:06 +08:00' --full-history --no-merges -- src/officecli/Handlers/Excel/ExcelHandler.Query.cs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: REDACTED REDACTED:18 — REDACTED changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 399 in PowerPointHandler.Get at line 18. 3 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 21:59:06 +08:00' --until='2026-10-20 21:59:06 +08:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/officecli/Handlers/Word/WordHandler.Set.cs src/officecli/Handlers/Word/WordHandler.Set.cs:1156 — src/officecli/Handlers/Word/WordHandler.Set.cs changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 117 in WordHandler.ApplyParagraphLevelProperty at line 1156. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 21:59:06 +08:00' --until='2026-10-20 21:59:06 +08:00' --full-history --no-merges -- src/officecli/Handlers/Word/WordHandler.Set.cs`: 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: src/officecli/ResidentServer.cs src/officecli/ResidentServer.cs:1521 — src/officecli/ResidentServer.cs changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 119 in ResidentServer.ExecuteView at line 1521. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 21:59:06 +08:00' --until='2026-10-20 21:59:06 +08:00' --full-history --no-merges -- src/officecli/ResidentServer.cs`: 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: src/officecli/Handlers/Word/WordHandler.Add.Table.cs src/officecli/Handlers/Word/WordHandler.Add.Table.cs:45 — src/officecli/Handlers/Word/WordHandler.Add.Table.cs changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 168 in WordHandler.AddTable at line 45. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 21:59:06 +08:00' --until='2026-10-20 21:59:06 +08:00' --full-history --no-merges -- src/officecli/Handlers/Word/WordHandler.Add.Table.cs`: 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: src/officecli/CommandBuilder.Batch.cs src/officecli/CommandBuilder.Batch.cs:175 — src/officecli/CommandBuilder.Batch.cs changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 73 in CommandBuilder.BuildBatchCommand at line 175. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 21:59:06 +08:00' --until='2026-10-20 21:59:06 +08:00' --full-history --no-merges -- src/officecli/CommandBuilder.Batch.cs`: 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: src/officecli/Core/Chart/ChartHelper.Reader.cs src/officecli/Core/Chart/ChartHelper.Reader.cs:31 — src/officecli/Core/Chart/ChartHelper.Reader.cs changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 399 in ChartHelper.ReadChartProperties at line 31. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 21:59:06 +08:00' --until='2026-10-20 21:59:06 +08:00' --full-history --no-merges -- src/officecli/Core/Chart/ChartHelper.Reader.cs`: 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: src/officecli/Handlers/Excel/ExcelHandler.SheetShift.cs src/officecli/Handlers/Excel/ExcelHandler.SheetShift.cs:67 — src/officecli/Handlers/Excel/ExcelHandler.SheetShift.cs changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 158 in ExcelHandler.ApplySheetRangeMutations at line 67. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 21:59:06 +08:00' --until='2026-10-20 21:59:06 +08:00' --full-history --no-merges -- src/officecli/Handlers/Excel/ExcelHandler.SheetShift.cs`: 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: src/officecli/Handlers/Word/WordHandler.Mutations.cs src/officecli/Handlers/Word/WordHandler.Mutations.cs:21 — src/officecli/Handlers/Word/WordHandler.Mutations.cs changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 193 in WordHandler.RemoveCore at line 21. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 21:59:06 +08:00' --until='2026-10-20 21:59:06 +08:00' --full-history --no-merges -- src/officecli/Handlers/Word/WordHandler.Mutations.cs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: REDACTED REDACTED:2465 — REDACTED changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 164 in WordHandler.RenderBodyHtml at line 2465. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 21:59:06 +08:00' --until='2026-10-20 21:59:06 +08:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/officecli/Handlers/Excel/ExcelHandler.Helpers.Node.cs src/officecli/Handlers/Excel/ExcelHandler.Helpers.Node.cs:295 — src/officecli/Handlers/Excel/ExcelHandler.Helpers.Node.cs changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 155 in ExcelHandler.CellToNode at line 295. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 21:59:06 +08:00' --until='2026-10-20 21:59:06 +08:00' --full-history --no-merges -- src/officecli/Handlers/Excel/ExcelHandler.Helpers.Node.cs`: 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: src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:336 — src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 147 in WordHandler.GetParagraphInlineCss at line 336. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 21:59:06 +08:00' --until='2026-10-20 21:59:06 +08:00' --full-history --no-merges -- src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs`: 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: src/officecli/Handlers/Excel/ExcelHandler.Remove.cs src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:20 — src/officecli/Handlers/Excel/ExcelHandler.Remove.cs changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 190 in ExcelHandler.RemoveCore at line 20. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 21:59:06 +08:00' --until='2026-10-20 21:59:06 +08:00' --full-history --no-merges -- src/officecli/Handlers/Excel/ExcelHandler.Remove.cs`: 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: src/officecli/CommandBuilder.View.cs src/officecli/CommandBuilder.View.cs:12 — src/officecli/CommandBuilder.View.cs changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 163 in CommandBuilder.BuildViewCommand at line 12. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 21:59:06 +08:00' --until='2026-10-20 21:59:06 +08:00' --full-history --no-merges -- src/officecli/CommandBuilder.View.cs`: 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: src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:840 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 115 in PowerPointHandler.ApplyConnectorProps at line 840. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 21:59:06 +08:00' --until='2026-10-20 21:59:06 +08:00' --full-history --no-merges -- src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs`: 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: src/officecli/Handlers/Word/WordHandler.Set.Element.cs src/officecli/Handlers/Word/WordHandler.Set.Element.cs:1281 — src/officecli/Handlers/Word/WordHandler.Set.Element.cs changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 115 in WordHandler.SetElementParagraph at line 1281. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 21:59:06 +08:00' --until='2026-10-20 21:59:06 +08:00' --full-history --no-merges -- src/officecli/Handlers/Word/WordHandler.Set.Element.cs`: 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: src/officecli/Handlers/Excel/ExcelHandler.Set.Cells.cs src/officecli/Handlers/Excel/ExcelHandler.Set.Cells.cs:90 — src/officecli/Handlers/Excel/ExcelHandler.Set.Cells.cs changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 151 in ExcelHandler.ApplyCellProperties at line 90. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 21:59:06 +08:00' --until='2026-10-20 21:59:06 +08:00' --full-history --no-merges -- src/officecli/Handlers/Excel/ExcelHandler.Set.Cells.cs`: 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.
  • + 29 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×39
  • Duplicated block (10 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:353 — src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:353-362 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:60-69 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:353` it begins part-way through the construct above it, so those exact lines 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) src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:1712 — src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:1712-1721 | src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:1758-1767 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:1712` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) src/officecli/Handlers/Word/WordHandler.Helpers.Field.cs:43 — src/officecli/Handlers/Word/WordHandler.Helpers.Field.cs:43-52 | src/officecli/Handlers/Word/WordHandler.Helpers.Field.cs:125-134 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Helpers.Field.cs:43` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, 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) src/officecli/Core/Chart/ChartHelper.Builder.cs:1988 — src/officecli/Core/Chart/ChartHelper.Builder.cs:1988-1997 | src/officecli/Core/DrawingColorBuilder.cs:235-244 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (10 lines × 2) src/officecli/Core/ExcelStyleManager.cs:1246 — src/officecli/Core/ExcelStyleManager.cs:1246-1255 | src/officecli/Core/ExcelStyleManager.cs:1270-1279 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/ExcelStyleManager.cs:1246` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:384 — src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:384-393 | src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:650-659 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:384` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Zoom3D.cs:129 — src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Zoom3D.cs:129-138 | src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Zoom3D.cs:221-230 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) src/officecli/Core/Chart/ChartSvgRenderer.cs:5146 — src/officecli/Core/Chart/ChartSvgRenderer.cs:5146-5155 | src/officecli/Core/Chart/ChartSvgRenderer.cs:5219-5228 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartSvgRenderer.cs:5146` it does not close everything it opens, so those exact lines 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) REDACTED:112 — REDACTED:112-121 | src/officecli/Handlers/WordHandler.cs:274-283 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (10 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1552 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1552-1561 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1832-1841 — both copies are in the same file, so extract the 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) src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:682 — src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:682-691 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:702-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. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:682` it does not close everything it opens, so those 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, `src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:681` calls `ParseLineWidth` and `src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:698` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 2) src/officecli/Core/Chart/ChartHelper.Setter.cs:967 — src/officecli/Core/Chart/ChartHelper.Setter.cs:967-976 | src/officecli/Core/Chart/ChartHelper.Setter.cs:984-993 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartHelper.Setter.cs:967` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/officecli/Core/Chart/ChartHelper.Setter.cs:996` calls `PrimaryValueAxis` and `src/officecli/Core/Chart/ChartHelper.Setter.cs:979` 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) src/officecli/Core/Chart/ChartHelper.Setter.cs:2892 — src/officecli/Core/Chart/ChartHelper.Setter.cs:2892-2901 | src/officecli/Core/Chart/ChartHelper.Setter.cs:2902-2911 — both copies are in the same file, so extract the 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) src/officecli/Core/Chart/ChartSvgRenderer.cs:835 — src/officecli/Core/Chart/ChartSvgRenderer.cs:835-844 | src/officecli/Core/Chart/ChartSvgRenderer.cs:2154-2163 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartSvgRenderer.cs:835` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (10 lines × 2) src/officecli/Core/PivotTableHelper.Render.cs:1193 — src/officecli/Core/PivotTableHelper.Render.cs:1193-1203 | src/officecli/Core/PivotTableHelper.Render.cs:1657-1666 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/PivotTableHelper.Render.cs:1193` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (10 lines × 2) src/officecli/Core/WordPdfBackend.cs:441 — src/officecli/Core/WordPdfBackend.cs:441-450 | src/officecli/Core/WordPdfBackend.cs:474-483 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/WordPdfBackend.cs:441` it does not close everything it opens, so those exact lines 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) src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:1121 — src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:1121-1130 | src/officecli/Handlers/Excel/ExcelHandler.Helpers.ConditionalFormat.cs:74-83 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (10 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs:775 — src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs:775-784 | src/officecli/Handlers/Excel/ExcelHandler.Set.RowsCols.cs:429-438 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs:775` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (10 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.DumpSupport.cs:333 — src/officecli/Handlers/Excel/ExcelHandler.DumpSupport.cs:333-342 | src/officecli/Handlers/Excel/ExcelHandler.Query.cs:556-570 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Excel/ExcelHandler.DumpSupport.cs:333` it does not close everything it opens, so those exact lines 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) src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:1203 — src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:1203-1213 | src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:1355-1364 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:1203` it does not close everything it opens, so those 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 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Set.Sheet.cs:690 — src/officecli/Handlers/Excel/ExcelHandler.Set.Sheet.cs:690-699 | src/officecli/Handlers/Excel/ExcelHandler.Set.Sheet.cs:758-769 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.Set.Sheet.cs:690` it begins part-way through the construct above it, so those exact lines 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) src/officecli/Handlers/Excel/ExcelHandler.View.cs:48 — src/officecli/Handlers/Excel/ExcelHandler.View.cs:48-57 | src/officecli/Handlers/Excel/ExcelHandler.View.cs:151-160 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `null` to `string? range =` in one and `HashSet<string>? cols =` 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) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2776 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2776-2785 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2864-2873 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2776` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (10 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:280 — src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:280-290 | REDACTED:1029-1038 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:280` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (10 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:437 — src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:437-447 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:768-777 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 14 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×37
  • Duplicated block (9 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Comments.cs:72 — src/officecli/Handlers/Pptx/PowerPointHandler.Comments.cs:72-80 | src/officecli/Handlers/Pptx/PowerPointHandler.ModernComments.cs:237-245 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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) src/officecli/Core/Chart/ChartSvgRenderer.cs:2841 — src/officecli/Core/Chart/ChartSvgRenderer.cs:2841-2849 | src/officecli/Core/Chart/ChartSvgRenderer.cs:2859-2867 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartSvgRenderer.cs:2841` it does not close everything it opens, so those exact lines 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) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Text.cs:506 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Text.cs:506-514 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Text.cs:649-657 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) src/officecli/Handlers/Word/WordHandler.Navigation.cs:2164 — src/officecli/Handlers/Word/WordHandler.Navigation.cs:2164-2172 | src/officecli/Handlers/Word/WordHandler.Query.cs:2412-2420 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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) src/officecli/Handlers/Excel/ExcelHandler.Query.cs:834 — src/officecli/Handlers/Excel/ExcelHandler.Query.cs:834-842 | src/officecli/Handlers/Excel/ExcelHandler.Set.Tables.cs:300-308 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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) src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:1156 — src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:1156-1164 | src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:1178-1186 — both copies are in the same file, so extract the 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) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:2502 — src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:2502-2510 | src/officecli/Handlers/Word/WordBatchEmitter.Table.cs:32-40 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 (9 lines × 2) src/officecli/Core/Chart/ChartHelper.Builder.cs:193 — src/officecli/Core/Chart/ChartHelper.Builder.cs:193-201 | src/officecli/Core/Chart/ChartHelper.Builder.cs:219-227 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartHelper.Builder.cs:193` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) src/officecli/Core/PivotTableHelper.Render.cs:664 — src/officecli/Core/PivotTableHelper.Render.cs:664-672 | src/officecli/Core/PivotTableHelper.Render.cs:995-1003 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (9 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.CheckGeneralPrecision.cs:77 — src/officecli/Handlers/Excel/ExcelHandler.CheckGeneralPrecision.cs:77-85 | src/officecli/Handlers/Excel/ExcelHandler.CheckNumericOverflow.cs:80-88 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Excel/ExcelHandler.CheckGeneralPrecision.cs:77` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, 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) src/officecli/ResidentServer.cs:1720 — src/officecli/ResidentServer.cs:1720-1728 | src/officecli/ResidentServer.cs:1751-1759 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/ResidentServer.cs:1720` it begins part-way through the construct above it, so those exact lines 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) src/officecli/Core/DrawingEffectsHelper.cs:190 — src/officecli/Core/DrawingEffectsHelper.cs:190-198 | src/officecli/Core/DrawingEffectsHelper.cs:213-221 — both copies are in the same file, so extract the 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) src/officecli/Core/Formula/FormulaEvaluator.cs:489 — src/officecli/Core/Formula/FormulaEvaluator.cs:489-497 | src/officecli/Core/Formula/FormulaEvaluator.cs:543-551 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Formula/FormulaEvaluator.cs:489` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) src/officecli/Core/PivotTableHelper.Set.cs:637 — src/officecli/Core/PivotTableHelper.Set.cs:637-645 | src/officecli/Core/PivotTableHelper.cs:2182-2190 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Core/PivotTableHelper.Set.cs:637` it does not close everything it opens, so those exact lines 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) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:2979 — src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:2979-2987 | src/officecli/Handlers/Word/WordHandler.HtmlPreview.Tables.cs:754-762 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:2979` it begins part-way through the construct above it, so those exact lines 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) src/officecli/Core/AttributeFilter.cs:247 — src/officecli/Core/AttributeFilter.cs:247-255 | src/officecli/Core/AttributeFilter.cs:885-893 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/AttributeFilter.cs:247` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `nodes` to `List<FilterDiagnostic> Warnings) ApplyWithWarnings( List<DocumentNode>` in one and `List<FilterDiagnostic> Warnings) ApplyExprWithWarnings( List<DocumentNode>` 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) src/officecli/Core/Chart/ChartHelper.Setter.cs:3255 — src/officecli/Core/Chart/ChartHelper.Setter.cs:3255-3263 | src/officecli/Core/Chart/ChartHelper.Setter.cs:3308-3316 — both copies are in the same file, so extract the 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) src/officecli/Core/Chart/ChartHelper.Setter.cs:3332 — src/officecli/Core/Chart/ChartHelper.Setter.cs:3332-3341 | src/officecli/Core/Chart/ChartHelper.Setter.cs:4649-4657 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartHelper.Setter.cs:3332` it does not close everything it opens, so those exact lines 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) src/officecli/Core/Chart/ChartSvgRenderer.cs:1709 — src/officecli/Core/Chart/ChartSvgRenderer.cs:1709-1723 | src/officecli/Core/Chart/ChartSvgRenderer.cs:5280-5288 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartSvgRenderer.cs:1709` it does not close everything it opens, so those 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) src/officecli/Core/ExcelStyleManager.cs:144 — src/officecli/Core/ExcelStyleManager.cs:144-153 | src/officecli/Core/ExcelStyleManager.cs:1115-1123 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/ExcelStyleManager.cs:144` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, 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, `src/officecli/Core/ExcelStyleManager.cs:144` calls `ContainsKey` and `src/officecli/Core/ExcelStyleManager.cs:1115` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 2) src/officecli/Core/Formula/FormulaEvaluator.Statistics.cs:269 — src/officecli/Core/Formula/FormulaEvaluator.Statistics.cs:269-284 | src/officecli/Core/Formula/FormulaEvaluator.Statistics.cs:313-321 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs:502 — src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs:502-511 | src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs:1656-1664 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs:502` it does not close everything it opens, so those 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 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs:1378 — src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs:1378-1386 | src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs:1552-1560 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs:1378` it does not close everything it opens, so those exact lines 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) src/officecli/Handlers/Excel/ExcelHandler.Query.cs:528 — src/officecli/Handlers/Excel/ExcelHandler.Query.cs:528-536 | src/officecli/Handlers/Excel/ExcelHandler.Set.cs:244-252 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Excel/ExcelHandler.Query.cs:528` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (9 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Set.RowsCols.cs:71 — src/officecli/Handlers/Excel/ExcelHandler.Set.RowsCols.cs:71-84 | src/officecli/Handlers/Excel/ExcelHandler.Set.RowsCols.cs:219-227 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 12 more in this group — see findings.md.
X24 · Document value interpolated into markup unescaped · Document value reaches a markup attribute unescaped · ×37
  • Document value reaches a markup attribute unescaped src/officecli/Core/Chart/ChartSvgRenderer.cs:781 — `strokeColor` carries text this program read out of the document being converted, and it is written straight into the `stroke` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `strokeColor` at this site, or validate it against the shape the attribute accepts before interpolating it.
  • Document value reaches a markup attribute unescaped src/officecli/Core/Chart/ChartSvgRenderer.cs:1084 — `strokeColor` carries text this program read out of the document being converted, and it is written straight into the `stroke` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `strokeColor` at this site, or validate it against the shape the attribute accepts before interpolating it.
  • Document value reaches a markup attribute unescaped src/officecli/Core/Chart/ChartSvgRenderer.cs:1527 — `color` carries text this program read out of the document being converted, and it is written straight into the `fill` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `color` at this site, or validate it against the shape the attribute accepts before interpolating it.
  • Document value reaches a markup attribute unescaped src/officecli/Core/Chart/ChartSvgRenderer.cs:1661 — `rl.Color` carries text this program read out of the document being converted, and it is written straight into the `stroke` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `rl.Color` at this site, or validate it against the shape the attribute accepts before interpolating it.
  • Document value reaches a markup attribute unescaped src/officecli/Core/Chart/ChartSvgRenderer.cs:3008 — `color` carries text this program read out of the document being converted, and it is written straight into the `stroke` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `color` at this site, or validate it against the shape the attribute accepts before interpolating it.
  • Document value reaches a markup attribute unescaped src/officecli/Core/Chart/ChartSvgRenderer.cs:3010 — `color` carries text this program read out of the document being converted, and it is written straight into the `fill` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `color` at this site, or validate it against the shape the attribute accepts before interpolating it.
  • Document value reaches a markup attribute unescaped src/officecli/Core/Chart/ChartSvgRenderer.cs:3029 — `wickColor` carries text this program read out of the document being converted, and it is written straight into the `stroke` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `wickColor` at this site, or validate it against the shape the attribute accepts before interpolating it.
  • Document value reaches a markup attribute unescaped src/officecli/Core/Chart/ChartSvgRenderer.cs:3030 — `wickColor` carries text this program read out of the document being converted, and it is written straight into the `stroke` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `wickColor` at this site, or validate it against the shape the attribute accepts before interpolating it.
  • Document value reaches a markup attribute unescaped src/officecli/Core/Chart/ChartSvgRenderer.cs:4935 — `color` carries text this program read out of the document being converted, and it is written straight into the `stroke` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `color` at this site, or validate it against the shape the attribute accepts before interpolating it.
  • Document value reaches a markup attribute unescaped src/officecli/Core/Chart/ChartSvgRenderer.cs:4949 — `color` carries text this program read out of the document being converted, and it is written straight into the `stroke` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `color` at this site, or validate it against the shape the attribute accepts before interpolating it.
  • Document value reaches a markup attribute unescaped src/officecli/Core/Chart/ChartSvgRenderer.cs:5021 — `fill` carries text this program read out of the document being converted, and it is written straight into the `fill` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `fill` at this site, or validate it against the shape the attribute accepts before interpolating it.
  • Document value reaches a markup attribute unescaped src/officecli/Core/Chart/ChartSvgRenderer.cs:5021 — `stroke` carries text this program read out of the document being converted, and it is written straight into the `stroke` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `stroke` at this site, or validate it against the shape the attribute accepts before interpolating it.
  • Document value reaches a markup attribute unescaped src/officecli/Core/Chart/ChartSvgRenderer.cs:5022 — `fill` carries text this program read out of the document being converted, and it is written straight into the `fill` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `fill` at this site, or validate it against the shape the attribute accepts before interpolating it.
  • Document value reaches a markup attribute unescaped src/officecli/Core/Chart/ChartSvgRenderer.cs:5022 — `stroke` carries text this program read out of the document being converted, and it is written straight into the `stroke` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `stroke` at this site, or validate it against the shape the attribute accepts before interpolating it.
  • Document value reaches a markup attribute unescaped src/officecli/Core/Chart/ChartSvgRenderer.cs:5023 — `fill` carries text this program read out of the document being converted, and it is written straight into the `fill` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `fill` at this site, or validate it against the shape the attribute accepts before interpolating it.
  • Document value reaches a markup attribute unescaped src/officecli/Core/Chart/ChartSvgRenderer.cs:5023 — `stroke` carries text this program read out of the document being converted, and it is written straight into the `stroke` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `stroke` at this site, or validate it against the shape the attribute accepts before interpolating it.
  • Document value reaches a markup attribute unescaped src/officecli/Core/Chart/ChartSvgRenderer.cs:5025 — `stroke` carries text this program read out of the document being converted, and it is written straight into the `stroke` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `stroke` at this site, or validate it against the shape the attribute accepts before interpolating it.
  • Document value reaches a markup attribute unescaped src/officecli/Core/Chart/ChartSvgRenderer.cs:5026 — `stroke` carries text this program read out of the document being converted, and it is written straight into the `stroke` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `stroke` at this site, or validate it against the shape the attribute accepts before interpolating it.
  • Document value reaches a markup attribute unescaped src/officecli/Core/Chart/ChartSvgRenderer.cs:5027 — `stroke` carries text this program read out of the document being converted, and it is written straight into the `stroke` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `stroke` at this site, or validate it against the shape the attribute accepts before interpolating it.
  • Document value reaches a markup attribute unescaped src/officecli/Core/Chart/ChartSvgRenderer.cs:5028 — `stroke` carries text this program read out of the document being converted, and it is written straight into the `fill` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `stroke` at this site, or validate it against the shape the attribute accepts before interpolating it.
  • Document value reaches a markup attribute unescaped src/officecli/Core/Chart/ChartSvgRenderer.cs:5030 — `fill` carries text this program read out of the document being converted, and it is written straight into the `fill` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `fill` at this site, or validate it against the shape the attribute accepts before interpolating it.
  • Document value reaches a markup attribute unescaped src/officecli/Core/Chart/ChartSvgRenderer.cs:5030 — `stroke` carries text this program read out of the document being converted, and it is written straight into the `stroke` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `stroke` at this site, or validate it against the shape the attribute accepts before interpolating it.
  • Document value reaches a markup attribute unescaped src/officecli/Core/Chart/ChartSvgRenderer.cs:5215 — `rl.Color` carries text this program read out of the document being converted, and it is written straight into the `stroke` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `rl.Color` at this site, or validate it against the shape the attribute accepts before interpolating it.
  • Document value reaches a markup attribute unescaped src/officecli/Core/RawXmlHelper.cs:1072 — `marker.Value` carries text this program read out of the document being converted, and it is written straight into the text of an element of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `marker.Value` at this site, or validate it against the shape the attribute accepts before interpolating it.
  • Document value reaches a markup attribute unescaped src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:1638 — `color` carries text this program read out of the document being converted, and it is written straight into the `fill` attribute of generated markup with nothing escaping it on the way. The value is chosen by whoever authored the file, not by this program, so it can close the attribute it sits in and open another — a crafted document becomes markup in the output this renderer produces. Escape `color` at this site, or validate it against the shape the attribute accepts before interpolating it.
  • + 12 more in this group — see findings.md.
X3 · Exception handling · Swallowed exception (empty catch) · ×35
  • Swallowed exception (empty catch) src/officecli/BlankDocCreator.cs:70 — 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) src/officecli/CommandBuilder.Batch.cs:255 — 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) src/officecli/CommandBuilder.Batch.cs:546 — 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) src/officecli/CommandBuilder.Batch.cs:575 — 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) src/officecli/CommandBuilder.Batch.cs:597 — 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) src/officecli/CommandBuilder.Batch.cs:617 — 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) src/officecli/CommandBuilder.Batch.cs:638 — 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) src/officecli/CommandBuilder.Batch.cs:644 — 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) src/officecli/CommandBuilder.cs:2102 — 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) src/officecli/CommandBuilder.GetQuery.cs:138 — 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) src/officecli/CommandBuilder.GetQuery.cs:246 — 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) src/officecli/CommandBuilder.GetQuery.cs:408 — 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) src/officecli/CommandBuilder.Import.cs:362 — 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) src/officecli/CommandBuilder.Plugins.cs:171 — 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) src/officecli/CommandBuilder.View.cs:110 — 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) src/officecli/CommandBuilder.View.cs:188 — 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) src/officecli/CommandBuilder.View.cs:357 — 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) src/officecli/CommandBuilder.View.cs:358 — 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) src/officecli/CommandBuilder.View.cs:484 — 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) src/officecli/CommandBuilder.View.cs:512 — 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) src/officecli/CommandBuilder.View.cs:572 — 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) src/officecli/CommandBuilder.View.cs:601 — 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) src/officecli/CommandBuilder.View.cs:635 — 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) src/officecli/CommandBuilder.Watch.cs:56 — 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) src/officecli/Core/AtomicPackageWriter.cs:71 — 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.
  • + 10 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×32
  • Duplicated block (11 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Query.cs:1472 — src/officecli/Handlers/Excel/ExcelHandler.Query.cs:1472-1482 | src/officecli/Handlers/Excel/ExcelHandler.Query.cs:1507-1517 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.Query.cs:1472` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:531 — src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:531-541 | src/officecli/Handlers/Excel/ExcelHandler.Set.Tables.cs:1089-1099 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (11 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.CheckGeneralPrecision.cs:58 — src/officecli/Handlers/Excel/ExcelHandler.CheckGeneralPrecision.cs:58-68 | src/officecli/Handlers/Excel/ExcelHandler.CheckNumericOverflow.cs:42-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. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.CheckGeneralPrecision.cs:58` it does not close everything it opens, so those 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) REDACTED:3280 — REDACTED:3280-3290 | REDACTED:3354-3364 — both copies are in the same file, so extract the 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 `slideIdx` to `int` in one and `IReadOnlyList<ActiveXImage> Images) GetActiveXOnSlide(int` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (11 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1075 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1075-1085 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:1258-1268 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1075` it does not close everything it opens, so those 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, `src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:1253` calls `ArgumentException` and `src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1073` 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) src/officecli/Handlers/Word/WordBatchEmitter.Table.cs:27 — src/officecli/Handlers/Word/WordBatchEmitter.Table.cs:27-37 | src/officecli/Handlers/Word/WordBatchEmitter.Table.cs:82-92 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordBatchEmitter.Table.cs:27` it does not close everything it opens, so those exact lines 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) src/officecli/Handlers/Word/WordHandler.Navigation.cs:4363 — src/officecli/Handlers/Word/WordHandler.Navigation.cs:4363-4373 | src/officecli/Handlers/Word/WordHandler.Query.cs:937-947 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (11 lines × 2) src/officecli/Handlers/Word/WordHandler.Query.cs:2640 — src/officecli/Handlers/Word/WordHandler.Query.cs:2640-2650 | src/officecli/Handlers/Word/WordHandler.Query.cs:2712-2722 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Query.cs:2640` it does not close everything it opens, so those exact lines 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) src/officecli/Core/WordPdfBackend.cs:635 — src/officecli/Core/WordPdfBackend.cs:635-645 | src/officecli/Core/WordPdfBackend.cs:675-685 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/WordPdfBackend.cs:635` it begins part-way through the construct above it, so those exact lines 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) src/officecli/Core/WordTocBuilder.cs:74 — src/officecli/Core/WordTocBuilder.cs:74-84 | src/officecli/Handlers/Word/WordHandler.Helpers.Style.cs:192-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. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/WordTocBuilder.cs:74` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Set.RowsCols.cs:96 — src/officecli/Handlers/Excel/ExcelHandler.Set.RowsCols.cs:96-106 | src/officecli/Handlers/Excel/ExcelHandler.Set.RowsCols.cs:363-373 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, 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) REDACTED:2639 — REDACTED:2639-2649 | REDACTED:3256-3266 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (11 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Background.cs:163 — src/officecli/Handlers/Pptx/PowerPointHandler.Background.cs:163-173 | src/officecli/Handlers/Pptx/PowerPointHandler.Background.cs:210-220 — both copies are in the same file, so extract the 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) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1947 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1947-1957 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1976-1986 — both copies are in the same file, so extract the 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) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Markers.cs:267 — src/officecli/Handlers/Word/WordHandler.HtmlPreview.Markers.cs:267-277 | src/officecli/Handlers/Word/WordHandler.HtmlPreview.Markers.cs:284-294 — both copies are in the same file, so extract the 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) src/officecli/Handlers/Word/WordHandler.Mutations.cs:2503 — src/officecli/Handlers/Word/WordHandler.Mutations.cs:2503-2513 | src/officecli/Handlers/Word/WordHandler.Set.Revision.cs:1407-1417 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 (11 lines × 2) src/officecli/Handlers/Word/WordHandler.Query.cs:573 — src/officecli/Handlers/Word/WordHandler.Query.cs:573-583 | src/officecli/Handlers/Word/WordHandler.Query.cs:2288-2298 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Query.cs:573` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (11 lines × 2) src/officecli/Handlers/Word/WordHandler.Set.cs:1670 — src/officecli/Handlers/Word/WordHandler.Set.cs:1670-1680 | src/officecli/Handlers/Word/WordHandler.Set.cs:1767-1777 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Set.cs:1670` it does not close everything it opens, so those exact lines 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) src/officecli/Core/Formula/FormulaEvaluator.Spill.cs:182 — src/officecli/Core/Formula/FormulaEvaluator.Spill.cs:182-193 | src/officecli/Core/Formula/FormulaEvaluator.Spill.cs:201-211 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Formula/FormulaEvaluator.Spill.cs:182` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (11 lines × 2) REDACTED:218 — REDACTED:218-228 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:6348-6358 — 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) src/officecli/Core/PivotTableHelper.Render.cs:2475 — src/officecli/Core/PivotTableHelper.Render.cs:2475-2485 | src/officecli/Core/PivotTableHelper.Render.cs:2519-2529 — both copies are in the same file, so extract the 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) src/officecli/Handlers/Excel/ExcelHandler.Query.cs:1792 — src/officecli/Handlers/Excel/ExcelHandler.Query.cs:1792-1806 | src/officecli/Handlers/Excel/ExcelHandler.Query.cs:1992-2002 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.Query.cs:1792` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/officecli/Handlers/Excel/ExcelHandler.Query.cs:2004` calls `FormulaEvaluator` and `src/officecli/Handlers/Excel/ExcelHandler.Query.cs:1808` 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) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1370 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1370-1380 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1382-1396 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1370` it begins part-way through the construct above it, so those exact lines 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) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1971 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1971-1981 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Model3D.cs:59-69 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (11 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:3065 — src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:3065-3077 | src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:3120-3130 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:3065` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • + 7 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×24
  • Duplicated block (12 lines × 2) src/officecli/Handlers/Word/WordHandler.Mutations.cs:2261 — src/officecli/Handlers/Word/WordHandler.Mutations.cs:2261-2272 | src/officecli/Handlers/Word/WordHandler.Mutations.cs:2531-2542 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Mutations.cs:2261` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (12 lines × 2) src/officecli/Core/Chart/ChartHelper.Builder.cs:1332 — src/officecli/Core/Chart/ChartHelper.Builder.cs:1332-1343 | src/officecli/Core/Chart/ChartHelper.Builder.cs:2089-2100 — both copies are in the same file, so extract the 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, `src/officecli/Core/Chart/ChartHelper.Builder.cs:1330` calls `ApplySeriesColor` and `src/officecli/Core/Chart/ChartHelper.Builder.cs:2087` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Query.cs:2109 — src/officecli/Handlers/Excel/ExcelHandler.Query.cs:2109-2120 | src/officecli/Handlers/Excel/ExcelHandler.Set.Tables.cs:1112-1123 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Excel/ExcelHandler.Query.cs:2109` it does not close everything it opens, so those exact lines 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) src/officecli/Core/Plugins/FormatHandlerProxy.cs:203 — src/officecli/Core/Plugins/FormatHandlerProxy.cs:203-214 | src/officecli/Core/Plugins/FormatHandlerProxy.cs:223-234 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (12 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs:1382 — src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs:1382-1393 | src/officecli/Handlers/Excel/ExcelHandler.Set.Tables.cs:718-729 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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) REDACTED:190 — REDACTED:190-201 | REDACTED:1863-1874 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:190` it does not close everything it opens, so those exact lines 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) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:614 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:614-625 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:742-753 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:614` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (12 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:1862 — src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:1862-1873 | src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:1902-1913 — both copies are in the same file, so extract the 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) src/officecli/Handlers/Pptx/PptxBatchEmitter.Charts.cs:24 — src/officecli/Handlers/Pptx/PptxBatchEmitter.Charts.cs:24-35 | src/officecli/Handlers/Word/WordBatchEmitter.Charts.cs:15-26 — 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 `src/officecli/Handlers/Pptx/PptxBatchEmitter.Charts.cs:24` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) src/officecli/Core/Chart/ChartSvgRenderer.cs:4403 — src/officecli/Core/Chart/ChartSvgRenderer.cs:4403-4419 | src/officecli/Core/Chart/ChartSvgRenderer.cs:4428-4439 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartSvgRenderer.cs:4403` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (12 lines × 2) src/officecli/Core/PivotTableHelper.Set.cs:482 — src/officecli/Core/PivotTableHelper.Set.cs:482-493 | src/officecli/Core/PivotTableHelper.cs:1000-1011 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/PivotTableHelper.Set.cs:482` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:729 — src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:729-740 | src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:836-847 — both copies are in the same file, so extract the 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) src/officecli/Handlers/Excel/ExcelHandler.Query.cs:759 — src/officecli/Handlers/Excel/ExcelHandler.Query.cs:759-771 | src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:737-748 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Excel/ExcelHandler.Query.cs:759` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (12 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.SheetShift.cs:83 — src/officecli/Handlers/Excel/ExcelHandler.SheetShift.cs:83-94 | src/officecli/Handlers/Excel/ExcelHandler.SheetShift.cs:167-178 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.SheetShift.cs:83` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (12 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Background.cs:627 — src/officecli/Handlers/Pptx/PowerPointHandler.Background.cs:627-638 | src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.RunFormat.cs:402-413 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Background.cs:627` it does not close everything it opens, so those exact lines 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) src/officecli/Handlers/Pptx/PowerPointHandler.Chart.cs:163 — src/officecli/Handlers/Pptx/PowerPointHandler.Chart.cs:163-174 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:472-483 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Chart.cs:163` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (12 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1511 — src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1511-1526 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:3236-3247 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1511` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) REDACTED:553 — REDACTED:553-564 | REDACTED:570-581 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:553` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (12 lines × 2) REDACTED:655 — REDACTED:655-666 | REDACTED:675-686 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:655` it does not close everything it opens, so those exact lines 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) src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:49 — src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:49-60 | src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:350-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. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:49` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:61` calls `InsertAfterSelf` and `src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:362` 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 (12 lines × 2) src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:1827 — src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:1827-1838 | src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:2170-2183 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:1827` it does not close everything it opens, so those 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, `src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:2170` calls `WrapRunsInRevision` and `src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:1827` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 2) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:1731 — src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:1731-1742 | src/officecli/Handlers/Word/WordHandler.Add.Text.cs:505-517 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:1731` it does not close everything it opens, so those exact lines 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) src/officecli/Handlers/Word/WordHandler.Add.Text.cs:1588 — src/officecli/Handlers/Word/WordHandler.Add.Text.cs:1588-1608 | src/officecli/Handlers/Word/WordHandler.Add.Text.cs:1647-1658 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Add.Text.cs:1588` it does not close everything it opens, so those exact lines 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) examples/ppt/charts/charts-line.py:52 — examples/ppt/charts/charts-line.py:52-63 | examples/ppt/charts/charts-stock.py:53-64 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. 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 · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×23
  • Members sharing a duplicated core (4 members, 50+ identical tokens) src/officecli/Core/Chart/ChartHelper.Setter.cs:4128 — src/officecli/Core/Chart/ChartHelper.Setter.cs:4128-4139 | src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:667-678 | src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:1161-1172 | src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:1179-1191 — 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) src/officecli/Core/Chart/ChartSvgRenderer.cs:1709 — src/officecli/Core/Chart/ChartSvgRenderer.cs:1709-1844 | src/officecli/Core/Chart/ChartSvgRenderer.cs:1858-1928 | src/officecli/Core/Chart/ChartSvgRenderer.cs:1942-2051 | src/officecli/Core/Chart/ChartSvgRenderer.cs:5280-5380 — 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) src/officecli/Core/Chart/ChartSvgRenderer.cs:4366 — src/officecli/Core/Chart/ChartSvgRenderer.cs:4366-4444 | src/officecli/Core/Chart/ChartSvgRenderer.cs:4449-4471 | src/officecli/Core/Chart/ChartSvgRenderer.cs:4489-4514 | REDACTED:561-617 — 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) src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:1890 — src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:1890-1897 | src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:1900-1907 | src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:1910-1917 | src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:1920-1927 — 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) src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:430 — src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:430-510 | src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:513-629 | src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:632-966 | src/officecli/Handlers/Excel/ExcelHandler.Set.Tables.cs:1063-1081 — 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) src/officecli/Handlers/Excel/ExcelHandler.DumpSupport.cs:60 — src/officecli/Handlers/Excel/ExcelHandler.DumpSupport.cs:60-167 | src/officecli/Handlers/Excel/ExcelHandler.Helpers.Node.cs:133-255 | src/officecli/Handlers/Excel/ExcelHandler.Query.cs:17-990 | src/officecli/Handlers/Excel/ExcelHandler.Query.cs:1193-2026 — 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) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Cell.cs:359 — src/officecli/Handlers/Excel/ExcelHandler.Helpers.Cell.cs:359-413 | src/officecli/Handlers/Excel/ExcelHandler.Helpers.Chart.cs:405-612 | src/officecli/Handlers/Excel/ExcelHandler.Helpers.Chart.cs:630-689 | src/officecli/Handlers/Excel/ExcelHandler.Helpers.Chart.cs:763-805 — 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) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:164 — src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:164-172 | src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:179-189 | src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:195-206 | src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:3458-3471 — 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) src/officecli/Handlers/Excel/ExcelHandler.Query.cs:17 — src/officecli/Handlers/Excel/ExcelHandler.Query.cs:17-990 | src/officecli/Handlers/Excel/ExcelHandler.Query.cs:1193-2026 | src/officecli/Handlers/Word/WordHandler.Query.cs:96-977 | src/officecli/Handlers/Word/WordHandler.Query.cs:1743-3242 — 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) src/officecli/Handlers/Excel/ExcelHandler.Query.RowWhere.cs:61 — src/officecli/Handlers/Excel/ExcelHandler.Query.RowWhere.cs:61-255 | src/officecli/Handlers/Excel/ExcelHandler.Query.RowWhere.cs:391-439 | src/officecli/Handlers/Excel/ExcelHandler.Query.RowWhere.cs:476-536 | src/officecli/Handlers/Excel/ExcelHandler.Query.RowWhere.cs:545-570 — 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) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:645 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:645-834 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:18-504 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1185-1607 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Table.cs:18-272 — 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) src/officecli/Handlers/Pptx/PowerPointHandler.Effects.cs:266 — src/officecli/Handlers/Pptx/PowerPointHandler.Effects.cs:266-292 | src/officecli/Handlers/Pptx/PowerPointHandler.Fill.cs:327-365 | src/officecli/Handlers/Pptx/PowerPointHandler.Fill.cs:928-954 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:170-2605 — 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) src/officecli/Handlers/Pptx/PowerPointHandler.Fill.cs:247 — src/officecli/Handlers/Pptx/PowerPointHandler.Fill.cs:247-295 | src/officecli/Handlers/Pptx/PowerPointHandler.Fill.cs:304-315 | src/officecli/Handlers/Pptx/PowerPointHandler.Fill.cs:327-365 | src/officecli/Handlers/Pptx/PowerPointHandler.Fill.cs:375-384 — 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) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2276 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2276-2378 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2387-2421 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2491-2576 | src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:982-1033 — 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) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1513 — src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1513-1578 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1584-1647 | src/officecli/Handlers/Word/WordHandler.Mutations.cs:2666-2727 | src/officecli/Handlers/Word/WordHandler.Mutations.cs:2730-2787 — 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) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:2281 — src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:2281-2292 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:19-48 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:142-170 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:173-201 — 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) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1663 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1663-1693 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1717-1740 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1770-1792 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1801-1825 — 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) src/officecli/Handlers/Pptx/PptxBatchEmitter.Notes.cs:27 — src/officecli/Handlers/Pptx/PptxBatchEmitter.Notes.cs:27-165 | src/officecli/Handlers/Pptx/PptxBatchEmitter.Notes.cs:176-212 | src/officecli/Handlers/Pptx/PptxBatchEmitter.Notes.cs:221-283 | src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:1484-1505 — 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) src/officecli/Handlers/Pptx/PptxBatchEmitter.Shape.cs:145 — src/officecli/Handlers/Pptx/PptxBatchEmitter.Shape.cs:145-155 | src/officecli/Handlers/Pptx/PptxBatchEmitter.Shape.cs:188-390 | src/officecli/Handlers/Pptx/PptxBatchEmitter.Shape.cs:394-525 | src/officecli/Handlers/Pptx/PptxBatchEmitter.Shape.cs:529-698 — 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) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:2493 — src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:2493-2516 | src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:2525-2558 | src/officecli/Handlers/Word/WordBatchEmitter.Table.cs:23-46 | src/officecli/Handlers/Word/WordBatchEmitter.Table.cs:77-100 — 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) src/officecli/Handlers/Word/WordHandler.Navigation.cs:2012 — src/officecli/Handlers/Word/WordHandler.Navigation.cs:2012-2073 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:2106-2154 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:3111-3173 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:6556-6886 — 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) src/officecli/Handlers/Word/WordHandler.Navigation.cs:3870 — src/officecli/Handlers/Word/WordHandler.Navigation.cs:3870-3907 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:6556-6886 | src/officecli/Handlers/Word/WordHandler.Query.cs:1507-1592 | src/officecli/Handlers/Word/WordHandler.Query.cs:1595-1669 — 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) src/officecli/Handlers/Word/WordHandler.View.cs:82 — src/officecli/Handlers/Word/WordHandler.View.cs:82-154 | src/officecli/Handlers/Word/WordHandler.View.cs:162-220 | src/officecli/Handlers/Word/WordHandler.View.cs:231-326 | src/officecli/Handlers/Word/WordHandler.View.cs:699-750 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×23
  • Duplicated block (13 lines × 2) src/officecli/Handlers/Word/WordHandler.Mutations.cs:2709 — src/officecli/Handlers/Word/WordHandler.Mutations.cs:2709-2721 | src/officecli/Handlers/Word/WordHandler.Mutations.cs:2764-2776 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Mutations.cs:2709` it begins part-way through the construct above it, so those 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, `src/officecli/Handlers/Word/WordHandler.Mutations.cs:2779` calls `foreach`, `AssignParaId` and `src/officecli/Handlers/Word/WordHandler.Mutations.cs:2723` 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) src/officecli/Handlers/Pptx/PowerPointHandler.ModernComments.cs:327 — src/officecli/Handlers/Pptx/PowerPointHandler.ModernComments.cs:327-339 | src/officecli/Handlers/Pptx/PowerPointHandler.ModernComments.cs:364-376 — both copies are in the same file, so extract the 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) src/officecli/CommandBuilder.Add.cs:72 — src/officecli/CommandBuilder.Add.cs:72-84 | src/officecli/CommandBuilder.Add.cs:450-462 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.FindReplace.cs:201 — src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.FindReplace.cs:201-213 | src/officecli/Handlers/Word/WordHandler.Helpers.FindReplace.cs:693-705 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.FindReplace.cs:201` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, 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) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:2494 — src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:2494-2506 | src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:2526-2538 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:2494` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 2) src/officecli/BlankDocCreator.cs:730 — src/officecli/BlankDocCreator.cs:730-742 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Slide.cs:565-577 — 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 `src/officecli/BlankDocCreator.cs:730` it begins part-way through the construct above it, so those exact lines 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) src/officecli/Core/WordPdfBackend.cs:610 — src/officecli/Core/WordPdfBackend.cs:610-622 | src/officecli/Core/WordPdfBackend.cs:653-665 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/WordPdfBackend.cs:610` it does not close everything it opens, so those exact lines 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) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:3147 — src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:3147-3159 | src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:3309-3321 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:3147` it does not close everything it opens, so those exact lines 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) src/officecli/Handlers/Excel/ExcelHandler.Set.Tables.cs:339 — src/officecli/Handlers/Excel/ExcelHandler.Set.Tables.cs:339-351 | src/officecli/Handlers/Excel/ExcelHandler.Set.Tables.cs:597-609 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.Set.Tables.cs:339` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) src/officecli/Core/BatchCompat.cs:127 — src/officecli/Core/BatchCompat.cs:127-139 | src/officecli/Core/BatchCompat.cs:141-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 `src/officecli/Core/BatchCompat.cs:127` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (13 lines × 2) src/officecli/Core/ExcelStyleManager.cs:194 — src/officecli/Core/ExcelStyleManager.cs:194-206 | src/officecli/Core/ExcelStyleManager.cs:216-233 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/ExcelStyleManager.cs:194` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (13 lines × 2) src/officecli/Core/Formula/FormulaParser.cs:1180 — src/officecli/Core/Formula/FormulaParser.cs:1180-1192 | src/officecli/Core/Formula/FormulaParser.cs:1204-1216 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Formula/FormulaParser.cs:1180` it does not close everything it opens, so those exact lines 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) src/officecli/Core/PivotTableHelper.Parse.cs:678 — src/officecli/Core/PivotTableHelper.Parse.cs:678-698 | src/officecli/Core/PivotTableHelper.Parse.cs:709-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. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/PivotTableHelper.Parse.cs:678` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (13 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Query.cs:1101 — src/officecli/Handlers/Excel/ExcelHandler.Query.cs:1101-1113 | src/officecli/Handlers/Excel/ExcelHandler.Query.cs:1264-1283 — both copies are in the same file, so extract the 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 (13 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Text.cs:344 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Text.cs:344-356 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Text.cs:738-750 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Add.Text.cs:738` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (13 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1025 — src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1025-1037 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1058-1070 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1025` it does not close everything it opens, so those 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, `src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1072` calls `InvalidOperationException` and `src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1038` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1680 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1680-1692 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1779-1791 — both copies are in the same file, so extract the 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.
  • Duplicated block (13 lines × 2) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:2279 — src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:2279-2291 | src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:2423-2435 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:2279` it does not close everything it opens, so those exact lines 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) src/officecli/Handlers/Word/WordHandler.Add.Text.cs:1952 — src/officecli/Handlers/Word/WordHandler.Add.Text.cs:1952-1964 | src/officecli/Handlers/Word/WordHandler.Add.Text.cs:2106-2120 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Add.Text.cs:2106` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (13 lines × 2) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:349 — src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:349-361 | src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:1491-1503 — both copies are in the same file, so extract the 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) src/officecli/Handlers/Word/WordHandler.ImageHelpers.cs:68 — src/officecli/Handlers/Word/WordHandler.ImageHelpers.cs:68-88 | src/officecli/Handlers/Word/WordHandler.ImageHelpers.cs:208-220 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.ImageHelpers.cs:68` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (13 lines × 2) src/officecli/Handlers/Word/WordHandler.StyleList.cs:105 — src/officecli/Handlers/Word/WordHandler.StyleList.cs:105-117 | src/officecli/Handlers/Word/WordHandler.StyleList.cs:153-165 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.StyleList.cs:105` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (13 lines × 2) src/officecli/Help/SchemaHelpFlatRenderer.cs:56 — src/officecli/Help/SchemaHelpFlatRenderer.cs:56-68 | src/officecli/Help/SchemaHelpFlatRenderer.cs:129-141 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Help/SchemaHelpFlatRenderer.cs:56` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
PF3 · Async & latency hygiene · Sync-over-async blocking · ×23
  • Sync-over-async blocking npm/lib/install-binary.js:205 — `fs.readFileSync` in `verifyChecksum` 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.
  • Sync-over-async blocking npm/lib/install-binary.js:217 — `fs.existsSync` in `ensureBinary` 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.
  • Sync-over-async blocking npm/lib/install-binary.js:217 — `fs.statSync` in `ensureBinary` 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.
  • Sync-over-async blocking npm/lib/install-binary.js:220 — `fs.mkdirSync` in `ensureBinary` 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.
  • Sync-over-async blocking npm/lib/install-binary.js:229 — `fs.chmodSync` in `ensureBinary` 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.
  • Sync-over-async blocking npm/lib/install-binary.js:235 — `fs.rmSync` in `ensureBinary` 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.
  • Sync-over-async blocking sdk/node/index.js:365 — `fs.existsSync` in `ensureCliBinary` 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.
  • Sync-over-async blocking — 15 blocking call(s) on async work (.Wait()/.GetAwaiter().GetResult()) — these waste a thread and can deadlock wherever a synchronization context is in play (a UI thread, or a caller that has one).
  • Sync-over-async blocking src/officecli/CommandBuilder.cs:173 — `.GetAwaiter().GetResult()` blocks this thread until the async work completes — it wastes a thread-pool thread for as long as the work runs and can deadlock wherever a synchronization context is in play (a UI thread, or a caller that has one).
  • Sync-over-async blocking src/officecli/CommandBuilder.Watch.cs:99 — `.GetAwaiter().GetResult()` blocks this thread until the async work completes — it wastes a thread-pool thread for as long as the work runs and can deadlock wherever a synchronization context is in play (a UI thread, or a caller that has one).
  • Sync-over-async blocking src/officecli/Core/Diagram/MermaidImageRenderer.cs:202 — `.GetAwaiter().GetResult()` blocks this thread until the async work completes — it wastes a thread-pool thread for as long as the work runs and can deadlock wherever a synchronization context is in play (a UI thread, or a caller that has one).
  • Sync-over-async blocking src/officecli/Core/Diagram/MermaidImageRenderer.cs:205 — `.GetAwaiter().GetResult()` blocks this thread until the async work completes — it wastes a thread-pool thread for as long as the work runs and can deadlock wherever a synchronization context is in play (a UI thread, or a caller that has one).
  • Sync-over-async blocking src/officecli/Core/Diagram/MermaidImageRenderer.cs:410 — `.GetAwaiter().GetResult()` blocks this thread until the async work completes — it wastes a thread-pool thread for as long as the work runs and can deadlock wherever a synchronization context is in play (a UI thread, or a caller that has one).
  • Sync-over-async blocking src/officecli/Core/FileSource.cs:101 — `.GetAwaiter().GetResult()` blocks this thread until the async work completes — it wastes a thread-pool thread for as long as the work runs and can deadlock wherever a synchronization context is in play (a UI thread, or a caller that has one).
  • Sync-over-async blocking src/officecli/Core/HtmlScreenshot.cs:587 — `.GetAwaiter().GetResult()` blocks this thread until the async work completes — it wastes a thread-pool thread for as long as the work runs and can deadlock wherever a synchronization context is in play (a UI thread, or a caller that has one).
  • Sync-over-async blocking src/officecli/Core/ImageSource.cs:156 — `.GetAwaiter().GetResult()` blocks this thread until the async work completes — it wastes a thread-pool thread for as long as the work runs and can deadlock wherever a synchronization context is in play (a UI thread, or a caller that has one).
  • Sync-over-async blocking REDACTED:310 — `.GetAwaiter().GetResult()` blocks this thread until the async work completes — it wastes a thread-pool thread for as long as the work runs and can deadlock wherever a synchronization context is in play (a UI thread, or a caller that has one).
  • Sync-over-async blocking REDACTED:344 — `.GetAwaiter().GetResult()` blocks this thread until the async work completes — it wastes a thread-pool thread for as long as the work runs and can deadlock wherever a synchronization context is in play (a UI thread, or a caller that has one).
  • Sync-over-async blocking src/officecli/Core/UpdateChecker.cs:149 — `.GetAwaiter().GetResult()` blocks this thread until the async work completes — it wastes a thread-pool thread for as long as the work runs and can deadlock wherever a synchronization context is in play (a UI thread, or a caller that has one).
  • Sync-over-async blocking src/officecli/Core/UpdateChecker.cs:202 — `.GetAwaiter().GetResult()` blocks this thread until the async work completes — it wastes a thread-pool thread for as long as the work runs and can deadlock wherever a synchronization context is in play (a UI thread, or a caller that has one).
  • Sync-over-async blocking src/officecli/Core/UpdateChecker.cs:627 — `.GetAwaiter().GetResult()` blocks this thread until the async work completes — it wastes a thread-pool thread for as long as the work runs and can deadlock wherever a synchronization context is in play (a UI thread, or a caller that has one).
  • Sync-over-async blocking src/officecli/Core/UpdateChecker.cs:630 — `.GetAwaiter().GetResult()` blocks this thread until the async work completes — it wastes a thread-pool thread for as long as the work runs and can deadlock wherever a synchronization context is in play (a UI thread, or a caller that has one).
  • Sync-over-async blocking src/officecli/Core/Watch/WatchNotifier.cs:313 — `.GetAwaiter().GetResult()` blocks this thread until the async work completes — it wastes a thread-pool thread for as long as the work runs and can deadlock wherever a synchronization context is in play (a UI thread, or a caller that has one).
D4 · Code Duplication · Duplicated block (6 lines × 3) · ×21
  • Duplicated block (6 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Table.cs:549 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Table.cs:549-554 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:244-249 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1636-1641 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (6 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Path.cs:299 — src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Path.cs:299-304 | REDACTED:219-224 | REDACTED:299-304 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (6 lines × 3) src/officecli/Handlers/Excel/ExcelHandler.View.cs:252 — src/officecli/Handlers/Excel/ExcelHandler.View.cs:252-257 | src/officecli/Handlers/Excel/ExcelHandler.View.cs:301-306 | src/officecli/Handlers/Excel/ExcelHandler.View.cs:353-358 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Chart.cs:91 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Chart.cs:91-96 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1624-1629 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Table.cs:238-243 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Set.Chart.cs:91` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (6 lines × 3) src/officecli/Core/WordNumFmtRenderer.cs:427 — src/officecli/Core/WordNumFmtRenderer.cs:427-432 | src/officecli/Core/WordNumFmtRenderer.cs:543-548 | src/officecli/Core/WordNumFmtRenderer.cs:569-574 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (6 lines × 3) src/officecli/Handlers/Excel/ExcelHandler.Query.cs:585 — src/officecli/Handlers/Excel/ExcelHandler.Query.cs:585-590 | src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:1159-1164 | src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:1181-1186 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (6 lines × 3) REDACTED:2951 — REDACTED:2951-2956 | REDACTED:2982-2987 | REDACTED:3149-3154 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 3) REDACTED:3428 — REDACTED:3428-3433 | REDACTED:3691-3696 | REDACTED:3809-3814 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 3) src/officecli/Handlers/WordHandler.cs:1025 — src/officecli/Handlers/WordHandler.cs:1025-1030 | src/officecli/Handlers/WordHandler.cs:1196-1201 | src/officecli/Handlers/WordHandler.cs:1225-1230 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 3) src/officecli/Core/Chart/ChartHelper.Setter.cs:1347 — src/officecli/Core/Chart/ChartHelper.Setter.cs:1347-1358 | src/officecli/Core/Chart/ChartHelper.Setter.cs:3363-3368 | src/officecli/Core/Chart/ChartHelper.Setter.cs:3410-3415 — 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 `src/officecli/Core/Chart/ChartHelper.Setter.cs:1347` it does not close everything it opens, so those 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 × 3) src/officecli/Core/Chart/ChartHelper.Setter.cs:3801 — src/officecli/Core/Chart/ChartHelper.Setter.cs:3801-3807 | src/officecli/Core/Chart/ChartHelper.Setter.cs:3862-3867 | src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:1003-1009 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (6 lines × 3) src/officecli/Core/Chart/ChartSvgRenderer.cs:1746 — src/officecli/Core/Chart/ChartSvgRenderer.cs:1746-1752 | src/officecli/Core/Chart/ChartSvgRenderer.cs:1874-1880 | src/officecli/Core/Chart/ChartSvgRenderer.cs:5335-5340 — 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 `src/officecli/Core/Chart/ChartSvgRenderer.cs:1746` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 3) src/officecli/Core/PivotTableHelper.Render.cs:1371 — src/officecli/Core/PivotTableHelper.Render.cs:1371-1376 | src/officecli/Core/PivotTableHelper.Render.cs:1409-1414 | src/officecli/Core/PivotTableHelper.Render.cs:1419-1424 — 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 `src/officecli/Core/PivotTableHelper.Render.cs:1371` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/officecli/Core/PivotTableHelper.Render.cs:1406` calls `foreach` and `src/officecli/Core/PivotTableHelper.Render.cs:1370` 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) src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2494 — src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2494-2499 | src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2535-2540 | src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2586-2591 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2494` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (6 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2137 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2137-2142 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2162-2167 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2324-2329 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2137` it does not close everything it opens, so those 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 × 3) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:309 — src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:309-314 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2905-2910 | REDACTED:1479-1484 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (6 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:2935 — src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:2935-2944 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:3840-3845 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:3864-3869 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 3) src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:1262 — src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:1262-1273 | src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:2763-2768 | src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:2959-2964 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (6 lines × 3) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Text.cs:39 — src/officecli/Handlers/Word/WordHandler.HtmlPreview.Text.cs:39-44 | src/officecli/Handlers/Word/WordHandler.HtmlPreview.Text.cs:64-69 | src/officecli/Handlers/Word/WordHandler.HtmlPreview.Text.cs:1015-1020 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 3) src/officecli/Handlers/Word/WordHandler.Navigation.cs:2026 — src/officecli/Handlers/Word/WordHandler.Navigation.cs:2026-2031 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:2114-2119 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:3148-3155 — 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 `src/officecli/Handlers/Word/WordHandler.Navigation.cs:2026` it does not close everything it opens, so those 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 × 3) src/officecli/Handlers/Word/WordHandler.Navigation.cs:3162 — src/officecli/Handlers/Word/WordHandler.Navigation.cs:3162-3167 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:6879-6884 | src/officecli/Handlers/Word/WordHandler.Query.cs:741-748 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (5 lines × 3) · ×21
  • Duplicated block (5 lines × 3) src/officecli/Core/Chart/ChartHelper.Advanced.cs:158 — src/officecli/Core/Chart/ChartHelper.Advanced.cs:158-162 | src/officecli/Core/Chart/ChartHelper.Advanced.cs:646-650 | src/officecli/Core/Chart/ChartHelper.Setter.cs:4333-4337 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (5 lines × 3) src/officecli/Core/PivotTableHelper.Render.cs:604 — src/officecli/Core/PivotTableHelper.Render.cs:604-608 | src/officecli/Core/PivotTableHelper.Render.cs:927-931 | src/officecli/Core/PivotTableHelper.Render.cs:1318-1322 — 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 `src/officecli/Core/PivotTableHelper.Render.cs:604` it does not close everything it opens, so those exact lines 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) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Table.cs:209 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Table.cs:209-213 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Table.cs:448-452 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Table.cs:528-532 — 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 (5 lines × 3) src/officecli/Core/Chart/ChartExBuilder.cs:531 — src/officecli/Core/Chart/ChartExBuilder.cs:531-535 | src/officecli/Core/DrawingEffectsHelper.cs:189-193 | src/officecli/Core/DrawingEffectsHelper.cs:212-216 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (5 lines × 3) src/officecli/Core/Formula/FormulaEvaluator.Securities.cs:328 — src/officecli/Core/Formula/FormulaEvaluator.Securities.cs:328-332 | src/officecli/Core/Formula/FormulaEvaluator.Securities.cs:338-342 | src/officecli/Core/Formula/FormulaEvaluator.Securities.cs:348-352 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 3) REDACTED:3011 — REDACTED:3011-3015 | REDACTED:3040-3044 | REDACTED:3074-3078 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 3) REDACTED:4287 — REDACTED:4287-4291 | REDACTED:4371-4375 | REDACTED:5009-5013 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.Fill.cs:309 — src/officecli/Handlers/Pptx/PowerPointHandler.Fill.cs:309-313 | src/officecli/Handlers/Pptx/PowerPointHandler.Fill.cs:353-357 | src/officecli/Handlers/Pptx/PowerPointHandler.Fill.cs:378-382 — 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 (5 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1982 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1982-1986 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2068-2072 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2123-2127 — 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 (5 lines × 3) src/officecli/Handlers/Word/WordHandler.Set.cs:997 — src/officecli/Handlers/Word/WordHandler.Set.cs:997-1001 | src/officecli/Handlers/Word/WordHandler.Set.cs:1018-1022 | src/officecli/Handlers/Word/WordHandler.Set.cs:1033-1037 — 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 (5 lines × 3) src/officecli/Core/Chart/ChartHelper.Builder.cs:1297 — src/officecli/Core/Chart/ChartHelper.Builder.cs:1297-1302 | src/officecli/Core/Chart/ChartHelper.Builder.cs:1307-1312 | src/officecli/Core/Chart/ChartHelper.Builder.cs:1349-1353 — 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 `src/officecli/Core/Chart/ChartHelper.Builder.cs:1349` it begins part-way through the construct above it, so those exact lines 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) src/officecli/Core/PivotTableHelper.Set.cs:447 — src/officecli/Core/PivotTableHelper.Set.cs:447-452 | src/officecli/Core/PivotTableHelper.Set.cs:454-458 | src/officecli/Core/PivotTableHelper.Set.cs:460-467 — 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 `src/officecli/Core/PivotTableHelper.Set.cs:447` it does not close everything it opens, so those exact lines 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) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:166 — src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:166-170 | src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:182-186 | src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:197-201 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1001 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1001-1005 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1006-1010 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1011-1015 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1919 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1919-1923 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2034-2038 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2063-2067 — 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.
  • Duplicated block (5 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:43 — src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:43-47 | src/officecli/Handlers/Word/WordHandler.Mutations.cs:44-48 | src/officecli/Handlers/Word/WordHandler.Set.cs:132-142 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:43` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:60 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:60-64 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:1084-1088 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:857-861 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (5 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:20 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:20-24 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:88-92 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:133-137 — 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 (5 lines × 3) src/officecli/Handlers/Word/WordHandler.Navigation.cs:2328 — src/officecli/Handlers/Word/WordHandler.Navigation.cs:2328-2332 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:5992-5996 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:6404-6408 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/officecli/Handlers/Word/WordHandler.Navigation.cs:2346` calls `CaptureNestedDeletion` and `src/officecli/Handlers/Word/WordHandler.Navigation.cs:6411` 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 × 3) src/officecli/Handlers/Word/WordHandler.Navigation.cs:2381 — src/officecli/Handlers/Word/WordHandler.Navigation.cs:2381-2385 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:6003-6007 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:6414-6418 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/officecli/Handlers/Word/WordHandler.Navigation.cs:2387` calls `ToString` and `src/officecli/Handlers/Word/WordHandler.Navigation.cs:6008` 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 × 3) examples/ppt/ole/ole-embed.py:136 — examples/ppt/ole/ole-embed.py:136-140 | examples/ppt/ole/ole-embed.py:148-152 | examples/ppt/ole/ole-embed.py:167-171 — 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 `examples/ppt/ole/ole-embed.py:136` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D3 · God Classes · TooManyMethods · ×20
  • TooManyMethods: WordHandler src/officecli/Handlers/Word/WordHandler.Navigation.cs — TooManyMethods — 33737 significant lines (blank, comment-only and punctuation-only lines excluded), 966 methods, declared across 47 files: Word/WordHandler.Navigation.cs (72), Word/WordHandler.HtmlPreview.Css.cs (71), Handlers/WordHandler.cs (64), Word/WordHandler.Add.Misc.cs (57), +43 more file(s). The bar is 30 methods; this is 936 over it, 32.20× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: PowerPointHandler src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs — TooManyMethods — 31110 significant lines (blank, comment-only and punctuation-only lines excluded), 887 methods, declared across 53 files: Pptx/PowerPointHandler.HtmlPreview.Css.cs (97), REDACTED (89), Pptx/PowerPointHandler.Animations.cs (59), Pptx/PowerPointHandler.Effects.cs (44), +49 more file(s). The bar is 30 methods; this is 857 over it, 29.57× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ExcelHandler src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs — TooManyMethods — 19274 significant lines (blank, comment-only and punctuation-only lines excluded), 583 methods, declared across 46 files: Excel/ExcelHandler.HtmlPreview.cs (92), Excel/ExcelHandler.Helpers.Drawing.cs (40), Excel/ExcelHandler.Remove.cs (30), Excel/ExcelHandler.Helpers.Cell.cs (27), +42 more file(s). The bar is 30 methods; this is 553 over it, 19.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: FormulaEvaluator src/officecli/Core/Formula/FormulaEvaluator.Functions.cs — TooManyMethods — 4219 significant lines (blank, comment-only and punctuation-only lines excluded), 402 methods, declared across 14 files: Formula/FormulaEvaluator.Functions.cs (104), Formula/FormulaEvaluator.Helpers.cs (65), Formula/FormulaEvaluator.cs (58), Formula/FormulaEvaluator.Securities.cs (39), +10 more file(s). The bar is 30 methods; this is 372 over it, 13.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: ChartHelper src/officecli/Core/Chart/ChartHelper.Builder.cs — TooManyMethods — 7517 significant lines (blank, comment-only and punctuation-only lines excluded), 190 methods, declared across 7 files: Chart/ChartHelper.Builder.cs (47), Chart/ChartHelper.SetterHelpers.cs (38), Chart/ChartHelper.Setter.cs (36), Chart/ChartHelper.Reader.cs (35), +3 more file(s). The bar is 30 methods; this is 160 over it, 6.33× the bar. The type holds no instance state, so there is no shared data to group its members by. To reduce it, split it by area instead: give each cohesive family of members its own smaller type, so no one type has to be read whole to change one of them.
  • TooManyMethods: WordBatchEmitter src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs — TooManyMethods — 5558 significant lines (blank, comment-only and punctuation-only lines excluded), 157 methods, declared across 8 files: Word/WordBatchEmitter.Paragraph.cs (63), Word/WordBatchEmitter.Resources.cs (55), Word/WordBatchEmitter.cs (12), Word/WordBatchEmitter.Table.cs (11), +4 more file(s). The bar is 30 methods; this is 127 over it, 5.23× the bar. The type holds no instance state, so there is no shared data to group its members by. To reduce it, split it by area instead: give each cohesive family of members its own smaller type, so no one type has to be read whole to change one of them.
  • TooManyMethods: PivotTableHelper src/officecli/Core/PivotTableHelper.cs — TooManyMethods — 4386 significant lines (blank, comment-only and punctuation-only lines excluded), 119 methods, declared across 6 files: Core/PivotTableHelper.cs (32), Core/PivotTableHelper.Cache.cs (25), Core/PivotTableHelper.Definition.cs (20), Core/PivotTableHelper.Parse.cs (20), +2 more file(s). The bar is 30 methods; this is 89 over it, 3.97× the bar. The type holds no instance state, so there is no shared data to group its members by. To reduce it, split it by area instead: give each cohesive family of members its own smaller type, so no one type has to be read whole to change one of them.
  • TooManyMethods: CommandBuilder src/officecli/CommandBuilder.cs — TooManyMethods — 3643 significant lines (blank, comment-only and punctuation-only lines excluded), 98 methods, declared across 14 files: officecli/CommandBuilder.cs (48), officecli/CommandBuilder.Import.cs (8), officecli/CommandBuilder.Plugins.cs (7), officecli/CommandBuilder.Batch.cs (6), +10 more file(s). The bar is 30 methods; this is 68 over it, 3.27× the bar. The type holds no instance state, so there is no shared data to group its members by. To reduce it, split it by area instead: give each cohesive family of members its own smaller type, so no one type has to be read whole to change one of them.
  • TooManyMethods: ChartSvgRenderer src/officecli/Core/Chart/ChartSvgRenderer.cs — TooManyMethods — 3582 significant lines (blank, comment-only and punctuation-only lines excluded), 82 methods, declared across 2 files: Chart/ChartSvgRenderer.cs (67), Chart/ChartSvgRenderer.CxExtract.cs (15). The bar is 30 methods; this is 52 over it, 2.73× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: WatchServer src/officecli/Core/Watch/WatchServer.cs — TooManyMethods — 1449 significant lines (blank, comment-only and punctuation-only lines excluded), 79 methods. The bar is 30 methods; this is 49 over it, 2.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: PptxBatchEmitter src/officecli/Handlers/Pptx/PptxBatchEmitter.cs — TooManyMethods — 2593 significant lines (blank, comment-only and punctuation-only lines excluded), 68 methods, declared across 7 files: Pptx/PptxBatchEmitter.cs (26), Pptx/PptxBatchEmitter.Shape.cs (15), Pptx/PptxBatchEmitter.Resources.cs (10), Pptx/PptxBatchEmitter.Media.cs (9), +3 more file(s). The bar is 30 methods; this is 38 over it, 2.27× the bar. The type holds no instance state, so there is no shared data to group its members by. To reduce it, split it by area instead: give each cohesive family of members its own smaller type, so no one type has to be read whole to change one of them.
  • TooManyMethods: ResidentServer src/officecli/ResidentServer.cs — TooManyMethods — 1357 significant lines (blank, comment-only and punctuation-only lines excluded), 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: AttributeFilter src/officecli/Core/AttributeFilter.cs — TooManyMethods — 573 significant lines (blank, comment-only and punctuation-only lines excluded), 44 methods. The bar is 30 methods; this is 14 over it, 1.47× the bar. The type holds no instance state, so there is no shared data to group its members by. To reduce it, split it by area instead: give each cohesive family of members its own smaller type, so no one type has to be read whole to change one of them.
  • TooManyMethods: WordPdfBackend src/officecli/Core/WordPdfBackend.cs — TooManyMethods — 505 significant lines (blank, comment-only and punctuation-only lines excluded), 44 methods. The bar is 30 methods; this is 14 over it, 1.47× the bar. The type holds no instance state, so there is no shared data to group its members by. To reduce it, split it by area instead: give each cohesive family of members its own smaller type, so no one type has to be read whole to change one of them.
  • TooManyMethods: FormulaParser src/officecli/Core/Formula/FormulaParser.cs — TooManyMethods — 1886 significant lines (blank, comment-only and punctuation-only lines excluded), 43 methods. The bar is 30 methods; this is 13 over it, 1.43× the bar. The type holds no instance state, so there is no shared data to group its members by. To reduce it, split it by area instead: give each cohesive family of members its own smaller type, so no one type has to be read whole to change one of them.
  • TooManyMethods: ExcelBatchEmitter src/officecli/Handlers/Excel/ExcelBatchEmitter.cs — TooManyMethods — 1106 significant lines (blank, comment-only and punctuation-only lines excluded), 43 methods, declared across 2 files: Excel/ExcelBatchEmitter.cs (23), Excel/ExcelBatchEmitter.Elements.cs (20). The bar is 30 methods; this is 13 over it, 1.43× the bar. The type holds no instance state, so there is no shared data to group its members by. To reduce it, split it by area instead: give each cohesive family of members its own smaller type, so no one type has to be read whole to change one of them.
  • TooManyMethods: ExcelStyleManager src/officecli/Core/ExcelStyleManager.cs — TooManyMethods — 1056 significant lines (blank, comment-only and punctuation-only lines excluded), 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: WordNumFmtRenderer src/officecli/Core/WordNumFmtRenderer.cs — TooManyMethods — 355 significant lines (blank, comment-only and punctuation-only lines excluded), 34 methods. The bar is 30 methods; this is 4 over it, 1.13× the bar. The type holds no instance state, so there is no shared data to group its members by. To reduce it, split it by area instead: give each cohesive family of members its own smaller type, so no one type has to be read whole to change one of them.
  • TooManyMethods: FormatHandlerProxy src/officecli/Core/Plugins/FormatHandlerProxy.cs — TooManyMethods — 202 significant lines (blank, comment-only and punctuation-only lines excluded), 34 methods. The bar is 30 methods; this is 4 over it, 1.13× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ParseHelpers src/officecli/Core/ParseHelpers.cs — TooManyMethods — 437 significant lines (blank, comment-only and punctuation-only lines excluded), 33 methods. The bar is 30 methods; this is 3 over it, 1.10× the bar. The type holds no instance state, so there is no shared data to group its members by. To reduce it, split it by area instead: give each cohesive family of members its own smaller type, so no one type has to be read whole to change one of them.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×20
  • Duplicated block (14 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:1402 — src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:1402-1415 | src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:1509-1522 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Helpers.cs:380 — src/officecli/Handlers/Excel/ExcelHandler.Helpers.cs:380-393 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2588-2601 — 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 `src/officecli/Handlers/Excel/ExcelHandler.Helpers.cs:380` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:895 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:895-908 | src/officecli/Handlers/Pptx/SlideComposition.cs:271-284 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:895` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2186 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2186-2199 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2205-2218 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (14 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Hyperlinks.cs:229 — src/officecli/Handlers/Pptx/PowerPointHandler.Hyperlinks.cs:229-242 | src/officecli/Handlers/Pptx/PowerPointHandler.Hyperlinks.cs:253-266 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Hyperlinks.cs:229` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) src/officecli/Core/Watch/WatchMark.cs:34 — src/officecli/Core/Watch/WatchMark.cs:34-47 | src/officecli/Core/Watch/WatchMark.cs:67-80 — both copies are in the same file, so extract the 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, `src/officecli/Core/Watch/WatchMark.cs:31` calls `JsonPropertyName` and `src/officecli/Core/Watch/WatchMark.cs:66` 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) src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:1468 — src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:1468-1481 | src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:1560-1573 — both copies are in the same file, so extract the 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) REDACTED:3691 — REDACTED:3691-3704 | REDACTED:3809-3822 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:3691` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Add.cs:22 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.cs:22-36 | src/officecli/Handlers/Word/WordHandler.Add.cs:29-42 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (14 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.cs:762 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.cs:762-783 | src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:199-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. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.cs:762` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (14 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Set.cs:74 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.cs:74-87 | src/officecli/Handlers/Word/WordHandler.Set.cs:171-188 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Set.cs:74` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:238 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:238-253 | src/officecli/Handlers/Word/WordHandler.ImageHelpers.cs:660-673 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:238` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (14 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:943 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:943-961 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1056-1069 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:943` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (14 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:990 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:990-1003 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:1181-1195 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:990` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (14 lines × 2) src/officecli/Handlers/Pptx/PptxBatchEmitter.Shape.cs:222 — src/officecli/Handlers/Pptx/PptxBatchEmitter.Shape.cs:222-235 | src/officecli/Handlers/Pptx/PptxBatchEmitter.Shape.cs:397-410 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PptxBatchEmitter.Shape.cs:222` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (14 lines × 2) src/officecli/Handlers/Word/WordBatchEmitter.Filters.cs:382 — src/officecli/Handlers/Word/WordBatchEmitter.Filters.cs:382-395 | src/officecli/Handlers/Word/WordBatchEmitter.Filters.cs:398-413 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordBatchEmitter.Filters.cs:382` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (14 lines × 2) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:809 — src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:809-825 | src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:916-929 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) src/officecli/Handlers/Word/WordHandler.Add.Table.cs:1037 — src/officecli/Handlers/Word/WordHandler.Add.Table.cs:1037-1061 | src/officecli/Handlers/Word/WordHandler.Add.Table.cs:1534-1547 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Add.Table.cs:1037` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (14 lines × 2) src/officecli/Handlers/Word/WordHandler.Navigation.cs:258 — src/officecli/Handlers/Word/WordHandler.Navigation.cs:258-271 | src/officecli/Handlers/Word/WordHandler.Query.cs:987-1000 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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) src/officecli/Handlers/Word/WordHandler.Navigation.cs:4213 — src/officecli/Handlers/Word/WordHandler.Navigation.cs:4213-4226 | src/officecli/Handlers/Word/WordHandler.Query.cs:877-890 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Word/WordHandler.Navigation.cs:4213` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
X1 · Async correctness · Sync-over-async (deadlock risk) · ×15
  • Sync-over-async (deadlock risk) src/officecli/CommandBuilder.cs:173 — Blocking on a Task with `.Wait()`/`.GetAwaiter().GetResult()` can deadlock (and wastes a thread). Prefer awaiting it: make the caller `async` and `await` instead. Where a synchronous entry point must stay — a public sync API you cannot break, or a process entry point that must not return until the work finishes — the block belongs in ONE documented bridge and never inside code that is already async; and where it already is that bridge, give the wait a TIMEOUT so a hung task fails the call instead of hanging the process.
  • Sync-over-async (deadlock risk) src/officecli/CommandBuilder.Watch.cs:99 — Blocking on a Task with `.Wait()`/`.GetAwaiter().GetResult()` can deadlock (and wastes a thread). Prefer awaiting it: make the caller `async` and `await` instead. Where a synchronous entry point must stay — a public sync API you cannot break, or a process entry point that must not return until the work finishes — the block belongs in ONE documented bridge and never inside code that is already async; and where it already is that bridge, give the wait a TIMEOUT so a hung task fails the call instead of hanging the process.
  • Sync-over-async (deadlock risk) src/officecli/Core/Diagram/MermaidImageRenderer.cs:202 — Blocking on a Task with `.Wait()`/`.GetAwaiter().GetResult()` can deadlock (and wastes a thread). Prefer awaiting it: make the caller `async` and `await` instead. Where a synchronous entry point must stay — a public sync API you cannot break, or a process entry point that must not return until the work finishes — the block belongs in ONE documented bridge and never inside code that is already async; and where it already is that bridge, give the wait a TIMEOUT so a hung task fails the call instead of hanging the process.
  • Sync-over-async (deadlock risk) src/officecli/Core/Diagram/MermaidImageRenderer.cs:205 — Blocking on a Task with `.Wait()`/`.GetAwaiter().GetResult()` can deadlock (and wastes a thread). Prefer awaiting it: make the caller `async` and `await` instead. Where a synchronous entry point must stay — a public sync API you cannot break, or a process entry point that must not return until the work finishes — the block belongs in ONE documented bridge and never inside code that is already async; and where it already is that bridge, give the wait a TIMEOUT so a hung task fails the call instead of hanging the process.
  • Sync-over-async (deadlock risk) src/officecli/Core/Diagram/MermaidImageRenderer.cs:410 — Blocking on a Task with `.Wait()`/`.GetAwaiter().GetResult()` can deadlock (and wastes a thread). Prefer awaiting it: make the caller `async` and `await` instead. Where a synchronous entry point must stay — a public sync API you cannot break, or a process entry point that must not return until the work finishes — the block belongs in ONE documented bridge and never inside code that is already async; and where it already is that bridge, give the wait a TIMEOUT so a hung task fails the call instead of hanging the process.
  • Sync-over-async (deadlock risk) src/officecli/Core/FileSource.cs:101 — Blocking on a Task with `.Wait()`/`.GetAwaiter().GetResult()` can deadlock (and wastes a thread). Prefer awaiting it: make the caller `async` and `await` instead. Where a synchronous entry point must stay — a public sync API you cannot break, or a process entry point that must not return until the work finishes — the block belongs in ONE documented bridge and never inside code that is already async; and where it already is that bridge, give the wait a TIMEOUT so a hung task fails the call instead of hanging the process.
  • Sync-over-async (deadlock risk) src/officecli/Core/HtmlScreenshot.cs:587 — Blocking on a Task with `.Wait()`/`.GetAwaiter().GetResult()` can deadlock (and wastes a thread). Prefer awaiting it: make the caller `async` and `await` instead. Where a synchronous entry point must stay — a public sync API you cannot break, or a process entry point that must not return until the work finishes — the block belongs in ONE documented bridge and never inside code that is already async; and where it already is that bridge, give the wait a TIMEOUT so a hung task fails the call instead of hanging the process.
  • Sync-over-async (deadlock risk) src/officecli/Core/ImageSource.cs:156 — Blocking on a Task with `.Wait()`/`.GetAwaiter().GetResult()` can deadlock (and wastes a thread). Prefer awaiting it: make the caller `async` and `await` instead. Where a synchronous entry point must stay — a public sync API you cannot break, or a process entry point that must not return until the work finishes — the block belongs in ONE documented bridge and never inside code that is already async; and where it already is that bridge, give the wait a TIMEOUT so a hung task fails the call instead of hanging the process.
  • Sync-over-async (deadlock risk) REDACTED:310 — Blocking on a Task with `.Wait()`/`.GetAwaiter().GetResult()` can deadlock (and wastes a thread). Prefer awaiting it: make the caller `async` and `await` instead. Where a synchronous entry point must stay — a public sync API you cannot break, or a process entry point that must not return until the work finishes — the block belongs in ONE documented bridge and never inside code that is already async; and where it already is that bridge, give the wait a TIMEOUT so a hung task fails the call instead of hanging the process.
  • Sync-over-async (deadlock risk) REDACTED:344 — Blocking on a Task with `.Wait()`/`.GetAwaiter().GetResult()` wastes a thread and, if the task needs a context this one is holding, deadlocks. `Dispose()` returns void by contract, so it cannot simply `await`: signal the work to stop first (cancel its token, set its stop flag) so the wait is short, give the wait a TIMEOUT so a hung task cannot hang shutdown, and — where callers can use it — add an awaitable teardown (`DisposeAsync`/`StopAsync`) beside the synchronous one and let `Dispose()` remain the bounded fallback.
  • Sync-over-async (deadlock risk) src/officecli/Core/UpdateChecker.cs:149 — Blocking on a Task with `.Wait()`/`.GetAwaiter().GetResult()` can deadlock (and wastes a thread). Prefer awaiting it: make the caller `async` and `await` instead. Where a synchronous entry point must stay — a public sync API you cannot break, or a process entry point that must not return until the work finishes — the block belongs in ONE documented bridge and never inside code that is already async; and where it already is that bridge, give the wait a TIMEOUT so a hung task fails the call instead of hanging the process.
  • Sync-over-async (deadlock risk) src/officecli/Core/UpdateChecker.cs:202 — Blocking on a Task with `.Wait()`/`.GetAwaiter().GetResult()` can deadlock (and wastes a thread). Prefer awaiting it: make the caller `async` and `await` instead. Where a synchronous entry point must stay — a public sync API you cannot break, or a process entry point that must not return until the work finishes — the block belongs in ONE documented bridge and never inside code that is already async; and where it already is that bridge, give the wait a TIMEOUT so a hung task fails the call instead of hanging the process.
  • Sync-over-async (deadlock risk) src/officecli/Core/UpdateChecker.cs:627 — Blocking on a Task with `.Wait()`/`.GetAwaiter().GetResult()` can deadlock (and wastes a thread). Prefer awaiting it: make the caller `async` and `await` instead. Where a synchronous entry point must stay — a public sync API you cannot break, or a process entry point that must not return until the work finishes — the block belongs in ONE documented bridge and never inside code that is already async; and where it already is that bridge, give the wait a TIMEOUT so a hung task fails the call instead of hanging the process.
  • Sync-over-async (deadlock risk) src/officecli/Core/UpdateChecker.cs:630 — Blocking on a Task with `.Wait()`/`.GetAwaiter().GetResult()` can deadlock (and wastes a thread). Prefer awaiting it: make the caller `async` and `await` instead. Where a synchronous entry point must stay — a public sync API you cannot break, or a process entry point that must not return until the work finishes — the block belongs in ONE documented bridge and never inside code that is already async; and where it already is that bridge, give the wait a TIMEOUT so a hung task fails the call instead of hanging the process.
  • Sync-over-async (deadlock risk) src/officecli/Core/Watch/WatchNotifier.cs:313 — Blocking on a Task with `.Wait()`/`.GetAwaiter().GetResult()` can deadlock (and wastes a thread). Prefer awaiting it: make the caller `async` and `await` instead. Where a synchronous entry point must stay — a public sync API you cannot break, or a process entry point that must not return until the work finishes — the block belongs in ONE documented bridge and never inside code that is already async; and where it already is that bridge, give the wait a TIMEOUT so a hung task fails the call instead of hanging the process.
D4 · Code Duplication · Duplicated block (16 lines × 2) · ×12
  • Duplicated block (16 lines × 2) src/officecli/Core/PivotTableHelper.Render.cs:614 — src/officecli/Core/PivotTableHelper.Render.cs:614-629 | src/officecli/Core/PivotTableHelper.Render.cs:937-952 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/PivotTableHelper.Render.cs:614` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) src/officecli/Core/FontMetricsReader.cs:422 — src/officecli/Core/FontMetricsReader.cs:422-437 | src/officecli/Core/FontMetricsReader.cs:743-758 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/FontMetricsReader.cs:422` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `fontFamily` to `double descentPctEm) GetSplitAscDscOverride(string` in one and `double descentPct) GetAscentDescentOverride(string` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (16 lines × 2) src/officecli/ResidentClient.cs:298 — src/officecli/ResidentClient.cs:298-313 | src/officecli/ResidentServer.cs:2681-2696 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 (16 lines × 2) src/officecli/Core/Chart/ChartHelper.Advanced.cs:575 — src/officecli/Core/Chart/ChartHelper.Advanced.cs:575-590 | src/officecli/Core/Chart/ChartHelper.Builder.cs:972-987 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (16 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Set.Drawings.cs:523 — src/officecli/Handlers/Excel/ExcelHandler.Set.Drawings.cs:523-538 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:3204-3219 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (16 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:252 — src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:252-267 | REDACTED:689-704 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:252` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (16 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:307 — src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:307-322 | REDACTED:1476-1491 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:307` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) src/officecli/Handlers/Pptx/PptxBatchEmitter.cs:1548 — src/officecli/Handlers/Pptx/PptxBatchEmitter.cs:1548-1567 | src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:81-96 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (16 lines × 2) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:446 — src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:446-461 | src/officecli/Handlers/Word/WordHandler.Set.SectionLayout.cs:247-262 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (16 lines × 2) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:2699 — src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:2699-2714 | src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:2899-2914 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:2699` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) src/officecli/Handlers/Word/WordHandler.Navigation.cs:358 — src/officecli/Handlers/Word/WordHandler.Navigation.cs:358-375 | src/officecli/Handlers/Word/WordHandler.Query.cs:1150-1165 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Word/WordHandler.Navigation.cs:358` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) examples/ppt/shapes/shapes-effects.py:45 — examples/ppt/shapes/shapes-effects.py:45-60 | examples/ppt/tables/tables-basic.py:62-77 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `examples/ppt/shapes/shapes-effects.py:45` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (7 lines × 3) · ×12
  • Duplicated block (7 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2318 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2318-2324 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2405-2411 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2524-2530 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2318` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 3) src/officecli/Core/Chart/ChartHelper.Setter.cs:2810 — src/officecli/Core/Chart/ChartHelper.Setter.cs:2810-2816 | src/officecli/Core/Chart/ChartHelper.Setter.cs:2837-2843 | src/officecli/Core/Chart/ChartHelper.Setter.cs:2859-2865 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2773 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2773-2779 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2812-2818 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2831-2837 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2773` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 3) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Ole.cs:28 — src/officecli/Handlers/Excel/ExcelHandler.Helpers.Ole.cs:28-34 | src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Ole.cs:24-30 | src/officecli/Handlers/Word/WordHandler.Query.cs:33-39 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 3) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:420 — src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:420-426 | src/officecli/Handlers/Pptx/PowerPointHandler.Background.cs:715-721 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2986-2992 — 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 `src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:420` it does not close everything it opens, so those exact lines 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) src/officecli/Handlers/Pptx/PowerPointHandler.Fill.cs:288 — src/officecli/Handlers/Pptx/PowerPointHandler.Fill.cs:288-295 | src/officecli/Handlers/Pptx/PowerPointHandler.Fill.cs:309-315 | src/officecli/Handlers/Pptx/PowerPointHandler.Fill.cs:378-384 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Fill.cs:288` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:217 — src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:217-224 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:285-291 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:375-381 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:217` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (7 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:2281 — src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:2281-2287 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:142-148 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:173-180 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:2281` it does not close everything it opens, so those exact lines 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) REDACTED:440 — REDACTED:440-446 | REDACTED:454-460 | REDACTED:1033-1040 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:440` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (7 lines × 3) src/officecli/Handlers/Word/WordHandler.Add.Media.cs:725 — src/officecli/Handlers/Word/WordHandler.Add.Media.cs:725-732 | src/officecli/Handlers/Word/WordHandler.Add.Media.cs:941-947 | src/officecli/Handlers/Word/WordHandler.Add.Media.cs:1536-1542 — 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 `src/officecli/Handlers/Word/WordHandler.Add.Media.cs:725` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (7 lines × 3) src/officecli/Handlers/Word/WordHandler.Helpers.Text.cs:92 — src/officecli/Handlers/Word/WordHandler.Helpers.Text.cs:92-98 | src/officecli/Handlers/Word/WordHandler.Helpers.Text.cs:122-128 | src/officecli/Handlers/Word/WordHandler.Helpers.Text.cs:171-177 — 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 `src/officecli/Handlers/Word/WordHandler.Helpers.Text.cs:92` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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, `src/officecli/Handlers/Word/WordHandler.Helpers.Text.cs:98` calls `IsRunContainerWrapper`, `AppendWrapperRunText` and `src/officecli/Handlers/Word/WordHandler.Helpers.Text.cs:177` does not — after which the two agree again for 5 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) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:1154 — src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:1154-1160 | src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:1189-1195 | src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:1257-1263 — 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 `src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:1154` it does not close everything it opens, so those 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 × 2) · ×10
  • Duplicated block (15 lines × 2) src/officecli/Handlers/Word/WordHandler.Mutations.cs:2667 — src/officecli/Handlers/Word/WordHandler.Mutations.cs:2667-2681 | src/officecli/Handlers/Word/WordHandler.Mutations.cs:2731-2745 — both copies are in the same file, so extract the 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) REDACTED:1296 — REDACTED:1296-1310 | REDACTED:1735-1749 — both copies are in the same file, so extract the 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) src/officecli/CommandBuilder.Dump.cs:136 — src/officecli/CommandBuilder.Dump.cs:136-152 | src/officecli/CommandBuilder.Dump.cs:159-173 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/CommandBuilder.Dump.cs: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.
  • Duplicated block (15 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:731 — src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:731-745 | src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:845-859 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:731` it begins part-way through the construct above it, so those exact lines 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) src/officecli/Handlers/Excel/ExcelHandler.Add.cs:433 — src/officecli/Handlers/Excel/ExcelHandler.Add.cs:433-447 | src/officecli/Handlers/Excel/ExcelHandler.Add.cs:931-945 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:939 — src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:939-953 | src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:969-983 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:939` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, 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) src/officecli/Handlers/Pptx/PptxBatchEmitter.Notes.cs:195 — src/officecli/Handlers/Pptx/PptxBatchEmitter.Notes.cs:195-210 | src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:1489-1503 — 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 `src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:1489` it begins part-way through the construct above it, so those exact lines 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) src/officecli/Handlers/Word/WordHandler.Navigation.cs:342 — src/officecli/Handlers/Word/WordHandler.Navigation.cs:342-356 | src/officecli/Handlers/Word/WordHandler.Query.cs:1075-1094 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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) examples/ppt/charts/charts-combo.py:57 — examples/ppt/charts/charts-combo.py:57-71 | examples/ppt/charts/charts-doughnut.py:53-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 (15 lines × 2) examples/ppt/transitions/transitions-basic.py:39 — examples/ppt/transitions/transitions-basic.py:39-55 | examples/ppt/transitions/transitions-random.py:40-54 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. 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 (11–12 lines × 2) · ×10
  • Duplicated block (11–12 lines × 2) src/officecli/Core/Chart/ChartHelper.Setter.cs:4128 — src/officecli/Core/Chart/ChartHelper.Setter.cs:4128-4138 | src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:1179-1190 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Core/Chart/ChartHelper.Setter.cs:4128` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (11–12 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:1103 — src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:1103-1114 | src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:1131-1141 — both copies are in the same file, so extract the 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–12 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Query.RowWhere.cs:88 — src/officecli/Handlers/Excel/ExcelHandler.Query.RowWhere.cs:88-99 | src/officecli/Handlers/Excel/ExcelHandler.Query.RowWhere.cs:546-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. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.Query.RowWhere.cs:88` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (11–12 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:775 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:775-786 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:822-832 — both copies are in the same file, so extract the 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 (11–12 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.cs:743 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.cs:743-754 | src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:190-200 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.cs:743` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11–12 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1265 — src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1265-1276 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2260-2270 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1265` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11–12 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.View.cs:270 — src/officecli/Handlers/Pptx/PowerPointHandler.View.cs:270-281 | src/officecli/Handlers/Pptx/PowerPointHandler.View.cs:381-391 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.View.cs:270` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11–12 lines × 2) src/officecli/Handlers/Word/WordHandler.Navigation.cs:5519 — src/officecli/Handlers/Word/WordHandler.Navigation.cs:5519-5529 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:6138-6149 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11–12 lines × 2) src/officecli/Handlers/Word/WordHandler.Query.cs:2663 — src/officecli/Handlers/Word/WordHandler.Query.cs:2663-2673 | src/officecli/Handlers/Word/WordHandler.Query.cs:2724-2735 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Query.cs:2663` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (11–12 lines × 2) examples/ppt/transitions/transitions-directional.py:45 — examples/ppt/transitions/transitions-directional.py:45-55 | examples/ppt/transitions/transitions-timing.py:44-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.
D4 · Code Duplication · Duplicated block (11 lines × 3) · ×9
  • Duplicated block (11 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.View.cs:204 — src/officecli/Handlers/Pptx/PowerPointHandler.View.cs:204-214 | src/officecli/Handlers/Pptx/PowerPointHandler.View.cs:302-312 | src/officecli/Handlers/Pptx/PowerPointHandler.View.cs:398-408 — 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 (11 lines × 3) src/officecli/Core/Chart/ChartHelper.Builder.cs:1849 — src/officecli/Core/Chart/ChartHelper.Builder.cs:1849-1859 | src/officecli/Core/Chart/ChartHelper.Setter.cs:395-405 | src/officecli/Core/Chart/ChartHelper.Setter.cs:3726-3736 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (11 lines × 3) REDACTED:4309 — REDACTED:4309-4319 | REDACTED:5031-5041 | src/officecli/Handlers/WordHandler.cs:509-522 — 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 `REDACTED:4309` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/officecli/Handlers/WordHandler.cs:509` calls `ResolveImageHostPart` and `REDACTED:4309` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:2076 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:2076-2086 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:2154-2164 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Model3D.cs:178-188 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (11 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:1209 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:1209-1219 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:1231-1241 | src/officecli/Handlers/Pptx/PowerPointHandler.StyleList.cs:232-242 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (11 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:404 — src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:404-414 | REDACTED:553-563 | REDACTED:570-580 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:404` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (11 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1679 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1679-1689 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1778-1788 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1811-1821 — 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 (11 lines × 3) src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:48 — src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:48-58 | src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:304-314 | src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:349-359 — 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 `src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:48` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. 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, `src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:61` calls `InsertAfterSelf` and `src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:362` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11 lines × 3) src/officecli/Handlers/Word/WordHandler.Add.Text.cs:1590 — src/officecli/Handlers/Word/WordHandler.Add.Text.cs:1590-1609 | src/officecli/Handlers/Word/WordHandler.Add.Text.cs:1649-1659 | src/officecli/Handlers/Word/WordHandler.Add.Text.cs:1701-1714 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (10–11 lines × 2) · ×9
  • Duplicated block (10–11 lines × 2) src/officecli/CommandBuilder.Check.cs:15 — src/officecli/CommandBuilder.Check.cs:15-24 | src/officecli/CommandBuilder.Refresh.cs:15-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 both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/CommandBuilder.Check.cs:15` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10–11 lines × 2) src/officecli/Core/Chart/ChartHelper.Axis.cs:691 — src/officecli/Core/Chart/ChartHelper.Axis.cs:691-701 | src/officecli/Core/Chart/ChartHelper.Setter.cs:1967-1976 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Core/Chart/ChartHelper.Axis.cs: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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/officecli/Core/Chart/ChartHelper.Axis.cs:703` calls `Add` and `src/officecli/Core/Chart/ChartHelper.Setter.cs:1977` 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–11 lines × 2) src/officecli/Core/Chart/ChartSvgRenderer.cs:2995 — src/officecli/Core/Chart/ChartSvgRenderer.cs:2995-3005 | src/officecli/Core/Chart/ChartSvgRenderer.cs:3019-3028 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartSvgRenderer.cs:2995` it does not close everything it opens, so those 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) src/officecli/Core/PivotTableHelper.Definition.cs:1684 — src/officecli/Core/PivotTableHelper.Definition.cs:1684-1693 | src/officecli/Core/PivotTableHelper.Parse.cs:769-779 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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–11 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Query.RowWhere.cs:394 — src/officecli/Handlers/Excel/ExcelHandler.Query.RowWhere.cs:394-404 | src/officecli/Handlers/Excel/ExcelHandler.Query.RowWhere.cs:481-490 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.Query.RowWhere.cs:394` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10–11 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:1110 — src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:1110-1120 | src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:1405-1414 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:1110` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10–11 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Table.cs:470 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Table.cs:470-479 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:201-211 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Add.Table.cs:470` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10–11 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:403 — src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:403-413 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:2827-2836 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10–11 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:414 — src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:414-424 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:2838-2847 — both copies are in the same file, so extract the 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.
X1 · Async correctness · Sync-over-async (deadlock risk) through `.Wait(…)` · ×9
  • Sync-over-async (deadlock risk) through `.Wait(…)` REDACTED:293 — `.Wait(…)` blocks this thread until the task completes or the bound expires — sync-over-async: it can deadlock under a synchronization context and it parks a thread while it waits. `await` the task (with `.WaitAsync(timeout, token)` where the bound matters).
  • Sync-over-async (deadlock risk) through `.Wait(…)` src/officecli/Core/Plugins/PluginProcess.cs:124 — `.Wait(…)` blocks this thread until the task completes or the bound expires — sync-over-async: it can deadlock under a synchronization context and it parks a thread while it waits. `await` the task (with `.WaitAsync(timeout, token)` where the bound matters).
  • Sync-over-async (deadlock risk) through `.Wait(…)` src/officecli/Core/Plugins/PluginProcess.cs:125 — `.Wait(…)` blocks this thread until the task completes or the bound expires — sync-over-async: it can deadlock under a synchronization context and it parks a thread while it waits. `await` the task (with `.WaitAsync(timeout, token)` where the bound matters).
  • Sync-over-async (deadlock risk) through `.Wait(…)` src/officecli/Core/Watch/WatchNotifier.cs:311 — `.Wait(…)` blocks this thread until the task completes or the bound expires — sync-over-async: it can deadlock under a synchronization context and it parks a thread while it waits. `await` the task (with `.WaitAsync(timeout, token)` where the bound matters).
  • Sync-over-async (deadlock risk) through `.Wait(…)` src/officecli/Core/Watch/WatchServer.cs:364 — `.Wait(…)` blocks this thread until the task completes or the bound expires — sync-over-async: it can deadlock under a synchronization context and it parks a thread while it waits. `await` the task (with `.WaitAsync(timeout, token)` where the bound matters).
  • Sync-over-async (deadlock risk) through `.Wait(…)` src/officecli/Core/Watch/WatchServer.cs:3049 — `.Wait(…)` blocks this thread until the task completes or the bound expires — sync-over-async: it can deadlock under a synchronization context and it parks a thread while it waits. `await` the task (with `.WaitAsync(timeout, token)` where the bound matters).
  • Sync-over-async (deadlock risk) through `.Wait(…)` src/officecli/ResidentServer.cs:292 — `.Wait(…)` blocks this thread until the task completes or the bound expires — sync-over-async: it can deadlock under a synchronization context and it parks a thread while it waits. `await` the task (with `.WaitAsync(timeout, token)` where the bound matters).
  • Sync-over-async (deadlock risk) through `.Wait(…)` src/officecli/ResidentServer.cs:316 — `.Wait(…)` blocks this thread until the task completes or the bound expires — sync-over-async: it can deadlock under a synchronization context and it parks a thread while it waits. `await` the task (with `.WaitAsync(timeout, token)` where the bound matters).
  • Sync-over-async (deadlock risk) through `.Wait(…)` src/officecli/ResidentServer.cs:2734 — `.Wait(…)` blocks this thread until the task completes or the bound expires — sync-over-async: it can deadlock under a synchronization context and it parks a thread while it waits. `await` the task (with `.WaitAsync(timeout, token)` where the bound matters).
D29 · Static Analysis (SAST) · REDACTED · ×8
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (9 lines × 3) · ×8
  • Duplicated block (9 lines × 3) src/officecli/Handlers/Word/WordHandler.View.cs:89 — src/officecli/Handlers/Word/WordHandler.View.cs:89-97 | src/officecli/Handlers/Word/WordHandler.View.cs:175-183 | src/officecli/Handlers/Word/WordHandler.View.cs:706-714 — 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 `src/officecli/Handlers/Word/WordHandler.View.cs:89` it does not close everything it opens, so those 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, `src/officecli/Handlers/Word/WordHandler.View.cs:717` calls `Add` and `src/officecli/Handlers/Word/WordHandler.View.cs:100` 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 × 3) src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:231 — src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:231-239 | src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:316-324 | src/officecli/Handlers/Excel/ExcelHandler.Slicer.cs:691-699 — 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 `src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:231` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:326` calls `GetIdOfPart` and `src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:241` 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 × 3) src/officecli/Core/Chart/ChartHelper.Builder.cs:2042 — src/officecli/Core/Chart/ChartHelper.Builder.cs:2042-2050 | src/officecli/Core/Chart/ChartHelper.Builder.cs:2056-2064 | src/officecli/Core/Chart/ChartHelper.Builder.cs:2070-2078 — 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 `src/officecli/Core/Chart/ChartHelper.Builder.cs:2042` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (9 lines × 3) REDACTED:3738 — REDACTED:3738-3747 | REDACTED:4041-4049 | REDACTED:4187-4195 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:3738` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1601 — src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1601-1609 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2373-2381 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2948-2956 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1601` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 3) REDACTED:656 — REDACTED:656-664 | REDACTED:676-684 | REDACTED:1091-1099 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:656` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 3) REDACTED:1093 — REDACTED:1093-1101 | REDACTED:1221-1229 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:830-838 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (9 lines × 3) examples/ppt/pictures/pictures-basic.py:142 — examples/ppt/pictures/pictures-basic.py:142-150 | examples/ppt/pictures/pictures-basic.py:182-190 | examples/ppt/pictures/pictures-basic.py:258-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 `examples/ppt/pictures/pictures-basic.py:142` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8 lines × 3) · ×8
  • Duplicated block (8 lines × 3) src/officecli/Core/FormulaRefShifter.cs:145 — src/officecli/Core/FormulaRefShifter.cs:145-152 | src/officecli/Core/FormulaRefShifter.cs:231-238 | src/officecli/Core/FormulaRefShifter.cs:316-323 — 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 `src/officecli/Core/FormulaRefShifter.cs:145` it does not close everything it opens, so those exact lines 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) src/officecli/Handlers/Pptx/PowerPointHandler.Effects.cs:654 — src/officecli/Handlers/Pptx/PowerPointHandler.Effects.cs:654-661 | src/officecli/Handlers/Pptx/PowerPointHandler.Effects.cs:686-693 | src/officecli/Handlers/Pptx/PowerPointHandler.Effects.cs:708-715 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Effects.cs:654` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (8 lines × 3) src/officecli/Core/Chart/ChartHelper.Setter.cs:3333 — src/officecli/Core/Chart/ChartHelper.Setter.cs:3333-3341 | src/officecli/Core/Chart/ChartHelper.Setter.cs:4650-4657 | src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:1197-1204 — 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 `src/officecli/Core/Chart/ChartHelper.Setter.cs:3333` it does not close everything it opens, so those exact lines 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) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Path.cs:59 — src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Path.cs:59-67 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:541-548 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:698-705 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1340 — src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1340-1347 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1399-1406 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1466-1473 — 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, `src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1339` calls `Remove` and `src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1397` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1652 — src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1652-1659 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2385-2392 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2960-2967 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1652` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1651` calls `IsPlainInnerShadow` and `src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2385` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 3) src/officecli/Handlers/Word/WordHandler.Add.Text.cs:389 — src/officecli/Handlers/Word/WordHandler.Add.Text.cs:389-396 | src/officecli/Handlers/Word/WordHandler.Add.Text.cs:941-948 | src/officecli/Handlers/Word/WordHandler.Add.Text.cs:2303-2310 — 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 (8 lines × 3) examples/ppt/pictures/pictures-basic.py:179 — examples/ppt/pictures/pictures-basic.py:179-186 | examples/ppt/pictures/pictures-basic.py:230-237 | examples/ppt/pictures/pictures-basic.py:295-306 — 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 `examples/ppt/pictures/pictures-basic.py:179` it begins part-way through the construct above it, so those 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 × 4) · ×8
  • Duplicated block (6 lines × 4) REDACTED:4376 — REDACTED:4376-4381 | REDACTED:4411-4416 | REDACTED:4457-4462 | REDACTED:4523-4528 — 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 (6 lines × 4) src/officecli/Core/Chart/ChartHelper.Setter.cs:721 — src/officecli/Core/Chart/ChartHelper.Setter.cs:721-728 | src/officecli/Core/Chart/ChartHelper.Setter.cs:3550-3555 | src/officecli/Core/Chart/ChartHelper.Setter.cs:4539-4544 | src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:1149-1154 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/officecli/Core/Chart/ChartHelper.Setter.cs:3556` calls `AppendChild` and `src/officecli/Core/Chart/ChartHelper.Setter.cs:4545` 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 × 4) src/officecli/Core/Chart/ChartHelper.Setter.cs:4133 — src/officecli/Core/Chart/ChartHelper.Setter.cs:4133-4138 | src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:672-677 | src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:1166-1171 | src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:1184-1190 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `prop` to `out string` in one and `string` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/officecli/Core/Chart/ChartHelper.Setter.cs:4131` calls `ToLowerInvariant` and `src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:1164` 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 × 4) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Shape.cs:520 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Shape.cs:520-525 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Shape.cs:530-535 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:1582-1587 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:1594-1599 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Add.Shape.cs:520` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 4) src/officecli/Handlers/Pptx/PowerPointHandler.Fill.cs:288 — src/officecli/Handlers/Pptx/PowerPointHandler.Fill.cs:288-294 | src/officecli/Handlers/Pptx/PowerPointHandler.Fill.cs:309-314 | src/officecli/Handlers/Pptx/PowerPointHandler.Fill.cs:353-358 | src/officecli/Handlers/Pptx/PowerPointHandler.Fill.cs:378-383 — 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 (6 lines × 4) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2771 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2771-2776 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2810-2815 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2829-2834 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2859-2864 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2771` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 4) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1029 — src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1029-1038 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Table.cs:19-24 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Table.cs:48-53 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Table.cs:155-160 — 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. 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 × 4) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1604 — src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1604-1609 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1634-1639 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2376-2381 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2951-2956 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1604` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
X1 · Async correctness · Sync-over-async (deadlock risk) through `.Result` · ×8
  • Sync-over-async (deadlock risk) through `.Result` src/officecli/BlankDocCreator.cs:75 — Reading `.Result` of a task that has not completed blocks this thread until it does — the same block as `.Wait()`: under a synchronization context (Blazor, a UI thread, classic ASP.NET) it deadlocks, and on the thread pool it parks a thread for as long as the work runs. `await` the task instead (make the caller `async`); where a synchronous entry point must stay, keep the block in ONE documented bridge with a timeout.
  • Sync-over-async (deadlock risk) through `.Result` src/officecli/CommandBuilder.Plugins.cs:172 — Reading `.Result` of a task that has not completed blocks this thread until it does — the same block as `.Wait()`: under a synchronization context (Blazor, a UI thread, classic ASP.NET) it deadlocks, and on the thread pool it parks a thread for as long as the work runs. `await` the task instead (make the caller `async`); where a synchronous entry point must stay, keep the block in ONE documented bridge with a timeout.
  • Sync-over-async (deadlock risk) through `.Result` src/officecli/CommandBuilder.Plugins.cs:173 — Reading `.Result` of a task that has not completed blocks this thread until it does — the same block as `.Wait()`: under a synchronization context (Blazor, a UI thread, classic ASP.NET) it deadlocks, and on the thread pool it parks a thread for as long as the work runs. `await` the task instead (make the caller `async`); where a synchronous entry point must stay, keep the block in ONE documented bridge with a timeout.
  • Sync-over-async (deadlock risk) through `.Result` src/officecli/Core/Diagram/MermaidImageRenderer.cs:332 — Reading `.Result` of a task that has not completed blocks this thread until it does — the same block as `.Wait()`: under a synchronization context (Blazor, a UI thread, classic ASP.NET) it deadlocks, and on the thread pool it parks a thread for as long as the work runs. `await` the task instead (make the caller `async`); where a synchronous entry point must stay, keep the block in ONE documented bridge with a timeout.
  • Sync-over-async (deadlock risk) through `.Result` src/officecli/Core/Plugins/PluginRegistry.cs:288 — Reading `.Result` of a task that has not completed blocks this thread until it does — the same block as `.Wait()`: under a synchronization context (Blazor, a UI thread, classic ASP.NET) it deadlocks, and on the thread pool it parks a thread for as long as the work runs. `await` the task instead (make the caller `async`); where a synchronous entry point must stay, keep the block in ONE documented bridge with a timeout.
  • Sync-over-async (deadlock risk) through `.Result` src/officecli/Core/Plugins/PluginRegistry.cs:289 — Reading `.Result` of a task that has not completed blocks this thread until it does — the same block as `.Wait()`: under a synchronization context (Blazor, a UI thread, classic ASP.NET) it deadlocks, and on the thread pool it parks a thread for as long as the work runs. `await` the task instead (make the caller `async`); where a synchronous entry point must stay, keep the block in ONE documented bridge with a timeout.
  • Sync-over-async (deadlock risk) through `.Result` src/officecli/McpInstaller.cs:255 — Reading `.Result` of a task that has not completed blocks this thread until it does — the same block as `.Wait()`: under a synchronization context (Blazor, a UI thread, classic ASP.NET) it deadlocks, and on the thread pool it parks a thread for as long as the work runs. `await` the task instead (make the caller `async`); where a synchronous entry point must stay, keep the block in ONE documented bridge with a timeout.
  • Sync-over-async (deadlock risk) through `.Result` src/officecli/McpInstaller.cs:256 — Reading `.Result` of a task that has not completed blocks this thread until it does — the same block as `.Wait()`: under a synchronization context (Blazor, a UI thread, classic ASP.NET) it deadlocks, and on the thread pool it parks a thread for as long as the work runs. `await` the task instead (make the caller `async`); where a synchronous entry point must stay, keep the block in ONE documented bridge with a timeout.
D4 · Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) · ×7
  • Members sharing a duplicated core (5 members, 50+ identical tokens) src/officecli/Core/Formula/FormulaEvaluator.Securities.cs:242 — src/officecli/Core/Formula/FormulaEvaluator.Securities.cs:242-249 | src/officecli/Core/Formula/FormulaEvaluator.Securities.cs:253-259 | src/officecli/Core/Formula/FormulaEvaluator.Securities.cs:263-272 | src/officecli/Core/Formula/FormulaEvaluator.Securities.cs:276-282 | src/officecli/Core/Formula/FormulaEvaluator.Securities.cs:286-292 — 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) src/officecli/Core/PivotTableHelper.Render.cs:107 — src/officecli/Core/PivotTableHelper.Render.cs:107-550 | src/officecli/Core/PivotTableHelper.Render.cs:584-878 | src/officecli/Core/PivotTableHelper.Render.cs:910-1262 | src/officecli/Core/PivotTableHelper.Render.cs:1300-1726 | src/officecli/Core/PivotTableHelper.Render.cs:1761-2465 — 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) src/officecli/Core/Watch/WatchNotifier.cs:65 — src/officecli/Core/Watch/WatchNotifier.cs:65-97 | src/officecli/Core/Watch/WatchNotifier.cs:107-134 | src/officecli/Core/Watch/WatchNotifier.cs:146-184 | src/officecli/Core/Watch/WatchNotifier.cs:191-219 | src/officecli/Core/Watch/WatchNotifier.cs:242-269 — 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) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:1057 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:1057-1176 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1185-1607 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1942-2199 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Table.cs:18-272 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Text.cs:19-121 — 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) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:894 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:894-924 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:1031-1097 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:1152-1198 | src/officecli/Handlers/Pptx/SlideComposition.cs:209-242 | src/officecli/Handlers/Pptx/SlideComposition.cs:270-294 — 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) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1291 — src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1291-1350 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1358-1409 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1420-1476 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1513-1578 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1584-1647 — 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) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:257 — src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:257-326 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:867-2249 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2252-2493 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2604-3061 | REDACTED:19-1505 — 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 (17 lines × 2) · ×7
  • Duplicated block (17 lines × 2) src/officecli/Core/FormulaRefShifter.cs:145 — src/officecli/Core/FormulaRefShifter.cs:145-161 | src/officecli/Core/FormulaRefShifter.cs:231-247 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/FormulaRefShifter.cs:145` it does not close everything it opens, so those exact lines 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) src/officecli/CommandBuilder.Mark.cs:136 — src/officecli/CommandBuilder.Mark.cs:136-152 | src/officecli/CommandBuilder.Set.cs:112-128 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/CommandBuilder.Mark.cs: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 (17 lines × 2) src/officecli/Handlers/Word/WordHandler.Navigation.cs:3554 — src/officecli/Handlers/Word/WordHandler.Navigation.cs:3554-3570 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:3644-3660 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Navigation.cs:3554` it does not close everything it opens, so those exact lines 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) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:43 — src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:43-59 | src/officecli/Handlers/Word/WordHandler.Mutations.cs:44-60 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:43` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) src/officecli/Handlers/Word/WordHandler.Add.Text.cs:1649 — src/officecli/Handlers/Word/WordHandler.Add.Text.cs:1649-1665 | src/officecli/Handlers/Word/WordHandler.Add.Text.cs:1701-1724 — both copies are in the same file, so extract the 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) src/officecli/Handlers/Word/WordHandler.Query.cs:2898 — src/officecli/Handlers/Word/WordHandler.Query.cs:2898-2914 | src/officecli/Handlers/Word/WordHandler.Query.cs:3072-3088 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Query.cs:2898` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) src/officecli/Handlers/WordHandler.cs:1499 — src/officecli/Handlers/WordHandler.cs:1499-1515 | src/officecli/Handlers/WordHandler.cs:1528-1544 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/WordHandler.cs:1499` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (9–10 lines × 2) · ×7
  • Duplicated block (9–10 lines × 2) src/officecli/Core/AttributeFilter.cs:647 — src/officecli/Core/AttributeFilter.cs:647-656 | src/officecli/Handlers/Pptx/PowerPointHandler.Selector.cs:397-405 — 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 (9–10 lines × 2) REDACTED:499 — REDACTED:499-507 | REDACTED:573-582 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:499` it does not close everything it opens, so those 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–10 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Chart.cs:664 — src/officecli/Handlers/Excel/ExcelHandler.Helpers.Chart.cs:664-673 | src/officecli/Handlers/Excel/ExcelHandler.Helpers.Chart.cs:785-793 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.Helpers.Chart.cs:664` it does not close everything it opens, so those 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–10 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Set.Cells.cs:673 — src/officecli/Handlers/Excel/ExcelHandler.Set.Cells.cs:673-681 | src/officecli/Handlers/Excel/ExcelHandler.Set.Cells.cs:688-697 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.Set.Cells.cs:673` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9–10 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.View.cs:280 — src/officecli/Handlers/Excel/ExcelHandler.View.cs:280-289 | src/officecli/Handlers/Excel/ExcelHandler.View.cs:337-345 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.View.cs:280` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9–10 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:1230 — src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:1230-1239 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:1264-1272 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:1230` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9–10 lines × 2) src/officecli/Handlers/Word/WordHandler.Query.cs:3014 — src/officecli/Handlers/Word/WordHandler.Query.cs:3014-3023 | src/officecli/Handlers/Word/WordHandler.Query.cs:3094-3102 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Query.cs:3014` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (19 lines × 2) · ×6
  • Duplicated block (19 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:243 — src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:243-261 | src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:330-348 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:243` it begins part-way through the construct above it, so those 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, `src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:326` calls `GetIdOfPart` and `src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:239` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (19 lines × 2) src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:1622 — src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:1622-1640 | src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:1672-1690 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:1622` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2769 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2769-2787 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2914-2932 — both copies are in the same file, so extract the 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) src/officecli/CommandBuilder.View.cs:519 — src/officecli/CommandBuilder.View.cs:519-538 | src/officecli/ResidentServer.cs:1806-1824 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/CommandBuilder.View.cs:519` it does not close everything it opens, so those exact lines 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) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:230 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:230-248 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:1368-1386 — both copies are in the same file, so extract the 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) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:26 — src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:26-47 | src/officecli/Handlers/Word/WordHandler.Set.cs:124-142 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:26` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, 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–20 lines × 2) · ×6
  • Duplicated block (18–20 lines × 2) src/officecli/Core/PivotTableHelper.Render.cs:789 — src/officecli/Core/PivotTableHelper.Render.cs:789-808 | src/officecli/Core/PivotTableHelper.Render.cs:1623-1640 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/PivotTableHelper.Render.cs:789` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (18–20 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Helpers.cs:126 — src/officecli/Handlers/Excel/ExcelHandler.Helpers.cs:126-145 | src/officecli/Handlers/Excel/ExcelHandler.Helpers.cs:166-183 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.Helpers.cs:126` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18–20 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:2207 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:2207-2226 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.cs:530-547 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:2207` it does not close everything it opens, so those 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, `src/officecli/Handlers/Pptx/PowerPointHandler.Set.cs:530` calls `ResolveLogicalPath` and `src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:2207` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (18–20 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1553 — src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1553-1572 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1615-1632 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1553` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18–20 lines × 2) src/officecli/Handlers/Word/WordHandler.Navigation.cs:393 — src/officecli/Handlers/Word/WordHandler.Navigation.cs:393-410 | src/officecli/Handlers/Word/WordHandler.Query.cs:1098-1117 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Navigation.cs:393` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18–20 lines × 2) src/officecli/Handlers/Word/WordHandler.Query.cs:3381 — src/officecli/Handlers/Word/WordHandler.Query.cs:3381-3398 | src/officecli/Handlers/Word/WordHandler.Query.cs:3463-3482 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Query.cs:3381` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (12–15 lines × 2) · ×6
  • Duplicated block (12–15 lines × 2) src/officecli/Core/ExcelStyleManager.cs:1282 — src/officecli/Core/ExcelStyleManager.cs:1282-1296 | src/officecli/Core/ExcelStyleManager.cs:1412-1423 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/ExcelStyleManager.cs:1282` it does not close everything it opens, so those exact lines 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–15 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.View.cs:291 — src/officecli/Handlers/Excel/ExcelHandler.View.cs:291-305 | src/officecli/Handlers/Excel/ExcelHandler.View.cs:346-357 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.View.cs:291` it begins part-way through the construct above it, so those exact lines 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–15 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:1681 — src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:1681-1692 | src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:1697-1711 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:1681` it does not close everything it opens, so those 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, `src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:1712` calls `Add` and `src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:1693` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12–15 lines × 2) src/officecli/Handlers/Pptx/PptxBatchEmitter.Media.cs:820 — src/officecli/Handlers/Pptx/PptxBatchEmitter.Media.cs:820-834 | src/officecli/Handlers/Pptx/PptxBatchEmitter.Media.cs:860-871 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PptxBatchEmitter.Media.cs:820` it does not close everything it opens, so those exact lines 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–15 lines × 2) src/officecli/Handlers/Word/WordHandler.Add.cs:104 — src/officecli/Handlers/Word/WordHandler.Add.cs:104-115 | src/officecli/Handlers/Word/WordHandler.Add.cs:116-130 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Add.cs:104` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12–15 lines × 2) REDACTED:3489 — REDACTED:3489-3503 | REDACTED:3508-3519 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:3489` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (5 lines × 4) · ×6
  • Duplicated block (5 lines × 4) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1914 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1914-1918 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1943-1947 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1972-1976 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2001-2005 — 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 (5 lines × 4) REDACTED:4590 — REDACTED:4590-4594 | REDACTED:4816-4820 | REDACTED:4875-4879 | REDACTED:4942-4946 — 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 (5 lines × 4) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Cell.cs:378 — src/officecli/Handlers/Excel/ExcelHandler.Helpers.Cell.cs:378-382 | src/officecli/Handlers/Excel/ExcelHandler.Helpers.Chart.cs:459-463 | src/officecli/Handlers/Excel/ExcelHandler.Helpers.Chart.cs:668-672 | src/officecli/Handlers/Excel/ExcelHandler.Helpers.Chart.cs:788-792 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.Helpers.Cell.cs:378` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 4) src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:458 — src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:458-463 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:2249-2255 | src/officecli/Handlers/Word/WordHandler.Mutations.cs:2027-2031 | src/officecli/Handlers/Word/WordHandler.Mutations.cs:2041-2046 — 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 `src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:458` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 4) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:2024 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:2024-2029 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:2124-2128 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Model3D.cs:98-103 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Model3D.cs:152-157 — 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) src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2492 — src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2492-2496 | src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2533-2537 | src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2584-2588 | src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2628-2636 — 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, `src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2489` calls `Match` and `src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2582` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (7–8 lines × 2) · ×6
  • Duplicated block (7–8 lines × 2) src/officecli/Core/Chart/ChartHelper.Reader.cs:2081 — src/officecli/Core/Chart/ChartHelper.Reader.cs:2081-2088 | src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.Charts.cs:329-335 — 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 `src/officecli/Core/Chart/ChartHelper.Reader.cs:2081` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7–8 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Text.cs:354 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Text.cs:354-361 | src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.FindReplace.cs:693-699 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Add.Text.cs:354` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (7–8 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2768 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2768-2775 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2857-2863 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2768` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7–8 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:1445 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:1445-1451 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2928-2935 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:1445` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (7–8 lines × 2) src/officecli/Handlers/Word/WordHandler.Add.Media.cs:480 — src/officecli/Handlers/Word/WordHandler.Add.Media.cs:480-487 | src/officecli/Handlers/Word/WordHandler.Helpers.Chart.cs:198-204 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Word/WordHandler.Add.Media.cs:480` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (7–8 lines × 2) src/officecli/Handlers/Word/WordHandler.Mutations.cs:2025 — src/officecli/Handlers/Word/WordHandler.Mutations.cs:2025-2031 | src/officecli/Handlers/Word/WordHandler.Mutations.cs:2039-2046 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Mutations.cs:2025` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
IC1 · Incompleteness & stubs · Both branches are identical · ×6
  • Both branches are identical — the condition decides nothing src/officecli/Core/Chart/ChartSvgRenderer.cs:2470 — Both arms of `minY >= 0 ? … : …` are `niceMaxY`, 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 src/officecli/Core/Formula/FormulaEvaluator.Regression.cs:162 — Both arms of `i < k ? … : …` are `Math.Exp(v)`, 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 src/officecli/Core/PivotTableHelper.cs:1797 — Both arms of `dataFieldCount > 1 ? … : …` are `2`, 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 src/officecli/Handlers/Excel/ExcelHandler.Set.Sheet.cs:838 — Both arms of `rows ? … : …` are `$"${parts[0]}:${parts[1]}"`, 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 src/officecli/Handlers/Pptx/PowerPointHandler.Fill.cs:241 — Both arms of `hex.StartsWith('#') ? … : …` are `$"{hex}{alphaByte:X2}"`, 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 src/officecli/Handlers/Word/WordHandler.HtmlPreview.Tables.cs:90 — Both arms of `xAlign == "left" ? … : …` are `"left"`, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition.
R4 · Test Coverage · No test reaches this file · ×6
  • No test reaches this file src/officecli/Resources/watch-overlay.js: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 src/officecli/Resources/watch-sse-core.js: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 src/officecli/Resources/preview.js: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 npm/officecli.js: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 sdk/node/demo.js: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 npm/install.js: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.
D4 · Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) · ×5
  • Members sharing a duplicated core (6 members, 50+ identical tokens) src/officecli/Core/Chart/ChartHelper.Setter.cs:220 — src/officecli/Core/Chart/ChartHelper.Setter.cs:220-3494 | src/officecli/Core/Chart/ChartHelper.Setter.cs:3541-3561 | src/officecli/Core/Chart/ChartHelper.Setter.cs:4521-4549 | src/officecli/Core/Chart/ChartHelper.Setter.cs:4632-4664 | src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:1146-1158 | src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:1194-1298 — 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) src/officecli/Handlers/Excel/ExcelHandler.Set.Drawings.cs:401 — src/officecli/Handlers/Excel/ExcelHandler.Set.Drawings.cs:401-655 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Shape.cs:17-976 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Text.cs:595-1106 | src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.FindReplace.cs:689-734 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:170-2605 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:2717-3908 — 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) REDACTED:2544 — REDACTED:2544-2560 | REDACTED:2688-2701 | REDACTED:2705-2721 | REDACTED:2949-2966 | REDACTED:2980-2994 | REDACTED:3147-3165 — 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) REDACTED:4583 — REDACTED:4583-4625 | REDACTED:4644-4713 | REDACTED:4776-4801 | REDACTED:4812-4860 | REDACTED:4871-4927 | REDACTED:4938-4994 — 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) src/officecli/Handlers/Pptx/PowerPointHandler.Chart.cs:136 — src/officecli/Handlers/Pptx/PowerPointHandler.Chart.cs:136-258 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:356-386 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:389-777 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:867-2249 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2604-3061 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:3193-3448 — 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 (20 lines × 2) · ×5
  • Duplicated block (20 lines × 2) REDACTED:4446 — REDACTED:4446-4465 | REDACTED:4512-4531 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (20 lines × 2) src/officecli/Handlers/Word/WordHandler.Navigation.cs:414 — src/officecli/Handlers/Word/WordHandler.Navigation.cs:414-433 | src/officecli/Handlers/Word/WordHandler.Query.cs:1121-1140 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Word/WordHandler.Navigation.cs:414` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (20 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:345 — src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:345-364 | src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:407-426 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (20 lines × 2) src/officecli/Handlers/Pptx/PptxBatchEmitter.Resources.cs:602 — src/officecli/Handlers/Pptx/PptxBatchEmitter.Resources.cs:602-621 | src/officecli/Handlers/Pptx/PptxBatchEmitter.Resources.cs:642-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 (20 lines × 2) examples/ppt/transitions/transitions-bands.py:55 — examples/ppt/transitions/transitions-bands.py:55-74 | examples/ppt/transitions/transitions-shapes.py:49-68 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (17–19 lines × 2) · ×5
  • Duplicated block (17–19 lines × 2) src/officecli/Core/Chart/ChartHelper.Reader.cs:2564 — src/officecli/Core/Chart/ChartHelper.Reader.cs:2564-2580 | src/officecli/Core/Chart/ChartHelper.Reader.cs:2601-2619 — both copies are in the same file, so extract the 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–19 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.DumpSupport.cs:213 — src/officecli/Handlers/Excel/ExcelHandler.DumpSupport.cs:213-229 | src/officecli/Handlers/Excel/ExcelHandler.Helpers.Node.cs:960-978 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Excel/ExcelHandler.DumpSupport.cs:213` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (17–19 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:2112 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:2112-2128 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Model3D.cs:139-157 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (17–19 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.cs:199 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.cs:199-217 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.cs:316-332 — both copies are in the same file, so extract the 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–19 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.View.cs:291 — src/officecli/Handlers/Pptx/PowerPointHandler.View.cs:291-309 | src/officecli/Handlers/Pptx/PowerPointHandler.View.cs:389-405 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.View.cs:291` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (14–15 lines × 2) · ×5
  • Duplicated block (14–15 lines × 2) src/officecli/CommandBuilder.View.cs:470 — src/officecli/CommandBuilder.View.cs:470-484 | src/officecli/ResidentServer.cs:1768-1781 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/CommandBuilder.View.cs:470` it does not close everything it opens, so those exact lines 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) src/officecli/Handlers/Excel/ExcelHandler.Add.cs:1098 — src/officecli/Handlers/Excel/ExcelHandler.Add.cs:1098-1112 | REDACTED:765-778 — 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 (14–15 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Node.cs:795 — src/officecli/Handlers/Excel/ExcelHandler.Helpers.Node.cs:795-809 | src/officecli/Handlers/Excel/ExcelHandler.Query.cs:972-985 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Excel/ExcelHandler.Helpers.Node.cs:795` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14–15 lines × 2) REDACTED:1801 — REDACTED:1801-1815 | REDACTED:1818-1831 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1801` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (14–15 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:893 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:893-907 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1109-1122 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:893` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11–13 lines × 2) · ×5
  • Duplicated block (11–13 lines × 2) src/officecli/Core/Chart/ChartHelper.Setter.cs:2477 — src/officecli/Core/Chart/ChartHelper.Setter.cs:2477-2489 | src/officecli/Core/Chart/ChartHelper.Setter.cs:2510-2520 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartHelper.Setter.cs:2477` it begins part-way through the construct above it, so those 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 (11–13 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:863 — src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:863-875 | src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:884-894 — both copies are in the same file, so extract the 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) src/officecli/Handlers/Excel/ExcelHandler.View.cs:51 — src/officecli/Handlers/Excel/ExcelHandler.View.cs:51-63 | src/officecli/Handlers/Excel/ExcelHandler.View.cs:459-469 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.View.cs:51` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (11–13 lines × 2) src/officecli/Handlers/Word/WordHandler.Mutations.cs:2301 — src/officecli/Handlers/Word/WordHandler.Mutations.cs:2301-2313 | src/officecli/Handlers/Word/WordHandler.Set.Revision.cs:1333-1343 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 (11–13 lines × 2) src/officecli/Handlers/Word/WordHandler.Navigation.cs:4911 — src/officecli/Handlers/Word/WordHandler.Navigation.cs:4911-4923 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:5184-5194 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Navigation.cs:4911` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12–13 lines × 2) · ×5
  • Duplicated block (12–13 lines × 2) src/officecli/Core/PivotTableHelper.cs:1756 — src/officecli/Core/PivotTableHelper.cs:1756-1768 | src/officecli/Core/PivotTableHelper.cs:1775-1786 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12–13 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Add.cs:448 — src/officecli/Handlers/Excel/ExcelHandler.Add.cs:448-460 | src/officecli/Handlers/Excel/ExcelHandler.Add.cs:946-957 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.Add.cs:448` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (12–13 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Table.cs:208 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Table.cs:208-220 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Table.cs:527-538 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/officecli/Handlers/Pptx/PowerPointHandler.Add.Table.cs:206` calls `TryGetValue`, `ValidateOrThrow` and `src/officecli/Handlers/Pptx/PowerPointHandler.Add.Table.cs:526` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12–13 lines × 2) src/officecli/Handlers/Word/WordHandler.Set.Element.cs:766 — src/officecli/Handlers/Word/WordHandler.Set.Element.cs:766-778 | src/officecli/Handlers/Word/WordHandler.Set.Element.cs:968-979 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12–13 lines × 2) src/officecli/Handlers/Word/WordHandler.StyleList.cs:1437 — src/officecli/Handlers/Word/WordHandler.StyleList.cs:1437-1448 | src/officecli/Handlers/Word/WordHandler.StyleList.cs:1478-1490 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.StyleList.cs:1437` it does not close everything it opens, so those 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 × 3) · ×5
  • Duplicated block (10 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2305 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2305-2314 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2511-2520 | src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:1000-1009 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2305` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2297` calls `IsNullOrEmpty` and `src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2505` 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 × 3) src/officecli/CommandBuilder.Import.cs:277 — src/officecli/CommandBuilder.Import.cs:277-286 | src/officecli/CommandBuilder.Import.cs:431-440 | src/officecli/CommandBuilder.Raw.cs:123-132 — 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 `src/officecli/CommandBuilder.Import.cs:277` it does not close everything it opens, so those 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, `src/officecli/CommandBuilder.Import.cs:276` calls `Add` and `src/officecli/CommandBuilder.Import.cs:430` 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 × 3) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:498 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:498-507 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:549-558 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:2642-2655 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:498` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (10 lines × 3) src/officecli/Handlers/Word/WordHandler.Navigation.cs:3564 — src/officecli/Handlers/Word/WordHandler.Navigation.cs:3564-3573 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:3608-3617 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:3654-3663 — 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 `src/officecli/Handlers/Word/WordHandler.Navigation.cs:3564` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 3) examples/ppt/charts/charts-combo.py:57 — examples/ppt/charts/charts-combo.py:57-71 | examples/ppt/charts/charts-doughnut.py:53-67 | examples/ppt/charts/charts-radar.py:54-63 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (10–12 lines × 2) · ×5
  • Duplicated block (10–12 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:3053 — src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:3053-3064 | src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:3094-3103 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:3053` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10–12 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:600 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:600-609 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2879-2890 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (10–12 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:135 — src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:135-146 | REDACTED:1218-1227 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:135` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10–12 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1170 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1170-1181 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:1322-1331 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1170` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (10–12 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:350 — src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:350-361 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:2787-2796 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:350` it does not close everything it opens, so those 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) · ×5
  • Duplicated block (7 lines × 4) src/officecli/Core/PivotTableHelper.Render.cs:263 — src/officecli/Core/PivotTableHelper.Render.cs:263-269 | src/officecli/Core/PivotTableHelper.Render.cs:614-620 | src/officecli/Core/PivotTableHelper.Render.cs:937-943 | src/officecli/Core/PivotTableHelper.Render.cs:1330-1336 — 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 `src/officecli/Core/PivotTableHelper.Render.cs:263` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 4) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:605 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:605-611 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:623-629 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:733-739 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:751-757 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:605` it does not close everything it opens, so those exact lines 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 × 4) src/officecli/Core/Chart/ChartHelper.Setter.cs:721 — src/officecli/Core/Chart/ChartHelper.Setter.cs:721-729 | src/officecli/Core/Chart/ChartHelper.Setter.cs:3550-3556 | src/officecli/Core/Chart/ChartHelper.Setter.cs:4652-4658 | src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:1149-1155 — 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 (7 lines × 4) src/officecli/Handlers/Excel/ExcelHandler.Query.cs:738 — src/officecli/Handlers/Excel/ExcelHandler.Query.cs:738-744 | src/officecli/Handlers/Excel/ExcelHandler.Query.cs:1415-1421 | src/officecli/Handlers/Word/WordHandler.Query.cs:577-583 | src/officecli/Handlers/Word/WordHandler.Query.cs:2292-2298 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.Query.cs:738` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (7 lines × 4) examples/ppt/pictures/pictures-basic.py:191 — examples/ppt/pictures/pictures-basic.py:191-197 | examples/ppt/pictures/pictures-basic.py:199-205 | examples/ppt/pictures/pictures-basic.py:207-214 | examples/ppt/pictures/pictures-basic.py:217-224 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `examples/ppt/pictures/pictures-basic.py:191` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (5 lines × 5) · ×5
  • Duplicated block (5 lines × 5) src/officecli/Core/PivotTableHelper.Definition.cs:783 — src/officecli/Core/PivotTableHelper.Definition.cs:783-787 | src/officecli/Core/PivotTableHelper.Definition.cs:789-793 | src/officecli/Core/PivotTableHelper.Definition.cs:919-923 | src/officecli/Core/PivotTableHelper.Definition.cs:925-929 | src/officecli/Core/PivotTableHelper.Definition.cs:1081-1085 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/PivotTableHelper.Definition.cs:783` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 5) src/officecli/Core/Formula/FormulaEvaluator.Securities.cs:242 — src/officecli/Core/Formula/FormulaEvaluator.Securities.cs:242-246 | src/officecli/Core/Formula/FormulaEvaluator.Securities.cs:253-257 | src/officecli/Core/Formula/FormulaEvaluator.Securities.cs:263-267 | src/officecli/Core/Formula/FormulaEvaluator.Securities.cs:276-280 | src/officecli/Core/Formula/FormulaEvaluator.Securities.cs:286-290 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Formula/FormulaEvaluator.Securities.cs:242` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 5) REDACTED:4655 — REDACTED:4655-4659 | REDACTED:4779-4783 | REDACTED:4817-4821 | REDACTED:4876-4880 | REDACTED:4943-4947 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. 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 × 5) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:777 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:777-782 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:824-829 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:496-501 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1223-1227 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1562-1567 — there are 5 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 5 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, `src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:786` calls `Count`, `Any`, `IsExtendedChartFrame` and `src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:503` 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 × 5) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:310 — src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:310-314 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1404-1408 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2362-2366 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2906-2910 | REDACTED:1480-1484 — there are 5 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 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:310` it begins part-way through the construct above it, so those 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) · ×5
  • Duplicated block (6 lines × 5) REDACTED:757 — REDACTED:757-764 | REDACTED:795-800 | REDACTED:990-995 | REDACTED:1138-1143 | REDACTED:1255-1260 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:757` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 5) REDACTED:4283 — REDACTED:4283-4288 | REDACTED:4367-4372 | REDACTED:4402-4407 | REDACTED:4448-4453 | REDACTED:4514-4519 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. Note first that the copies are not typed on the same thing: the declarations holding them bind `picturePath` to `string ContentType)? GetImageBinary(string` in one and `string? InheritSpPrXml) GetPicturePlaceholderRoundtripXml(string` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (6 lines × 5) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:777 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:777-785 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:824-831 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1223-1228 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1562-1569 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Table.cs:260-269 — 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. 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 × 5) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:134 — src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:134-139 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:217-222 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:285-290 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:362-367 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:375-380 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:134` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 5) REDACTED:440 — REDACTED:440-445 | REDACTED:454-459 | REDACTED:747-752 | REDACTED:1033-1038 | REDACTED:1217-1222 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:440` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
X3 · Exception handling · Swallowed exception (caught, then discarded) · ×5
  • Swallowed exception (caught, then discarded) src/officecli/CommandBuilder.Batch.cs:488 — `catch` does nothing with the exception it caught — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch. Log it through whatever this codebase already uses to report problems, or let it propagate; if one specific failure genuinely cannot matter, catch exactly that exception type and say why in a comment on the catch.
  • Swallowed exception (caught, then discarded) src/officecli/CommandBuilder.Import.cs:243 — `catch` does nothing with the exception it caught — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch. Log it through whatever this codebase already uses to report problems, or let it propagate; if one specific failure genuinely cannot matter, catch exactly that exception type and say why in a comment on the catch.
  • Swallowed exception (caught, then discarded) src/officecli/CommandBuilder.Plugins.cs:342 — `catch` does nothing with the exception it caught — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch. Log it through whatever this codebase already uses to report problems, or let it propagate; if one specific failure genuinely cannot matter, catch exactly that exception type and say why in a comment on the catch.
  • Swallowed exception (caught, then discarded) src/officecli/CommandBuilder.View.cs:625 — `catch` does nothing with the exception it caught — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch. Log it through whatever this codebase already uses to report problems, or let it propagate; if one specific failure genuinely cannot matter, catch exactly that exception type and say why in a comment on the catch.
  • Swallowed exception (caught, then discarded) src/officecli/Core/AttributeFilter.cs:1227 — `catch` does nothing with the exception it caught — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch. Log it through whatever this codebase already uses to report problems, or let it propagate; if one specific failure genuinely cannot matter, catch exactly that exception type and say why in a comment on the catch.
D29 · Static Analysis (SAST) · REDACTED · ×4
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D3 · God Classes · ClassTooLong · ×4
  • ClassTooLong: ChartExBuilder src/officecli/Core/Chart/ChartExBuilder.cs — ClassTooLong — 888 significant lines (blank, comment-only and punctuation-only lines excluded), 30 methods, declared across 2 files: Chart/ChartExBuilder.cs (23), Chart/ChartExBuilder.Setter.cs (7). The bar is 400 significant lines; this is 488 over it, 2.22× the bar. The type holds no instance state, so there is no shared data to group its members by. To reduce it, split it by area instead: give each cohesive family of members its own smaller type, so no one type has to be read whole to change one of them.
  • ClassTooLong: RawXmlHelper src/officecli/Core/RawXmlHelper.cs — ClassTooLong — 678 significant lines (blank, comment-only and punctuation-only lines excluded), 29 methods. The bar is 400 significant lines; this is 278 over it, 1.70× the bar. The type holds no instance state, so there is no shared data to group its members by. To reduce it, split it by area instead: give each cohesive family of members its own smaller type, so no one type has to be read whole to change one of them.
  • ClassTooLong: BlankDocCreator src/officecli/BlankDocCreator.cs — ClassTooLong — 440 significant lines (blank, comment-only and punctuation-only lines excluded), 7 methods. The bar is 400 significant lines; this is 40 over it, 1.10× the bar. The type holds no instance state, so there is no shared data to group its members by. To reduce it, split it by area instead: give each cohesive family of members its own smaller type, so no one type has to be read whole to change one of them.
  • ClassTooLong: FontMetricsReader src/officecli/Core/FontMetricsReader.cs — ClassTooLong — 418 significant lines (blank, comment-only and punctuation-only lines excluded), 25 methods. The bar is 400 significant lines; this is 18 over it, 1.05× the bar. The type holds no instance state, so there is no shared data to group its members by. To reduce it, split it by area instead: give each cohesive family of members its own smaller type, so no one type has to be read whole to change one of them.
D4 · Code Duplication · Duplicated block (24 lines × 2) · ×4
  • Duplicated block (24 lines × 2) src/officecli/Handlers/Word/WordBatchEmitter.Filters.cs:157 — src/officecli/Handlers/Word/WordBatchEmitter.Filters.cs:157-180 | src/officecli/Handlers/Word/WordBatchEmitter.Filters.cs:201-224 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordBatchEmitter.Filters.cs:157` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (24 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Diagram.cs:33 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Diagram.cs:33-56 | src/officecli/Handlers/Word/WordHandler.Add.Diagram.cs:35-58 — 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 (24 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1376 — src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1376-1399 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1443-1466 — both copies are in the same file, so extract the 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) src/officecli/Handlers/Word/WordHandler.View.cs:333 — src/officecli/Handlers/Word/WordHandler.View.cs:333-356 | src/officecli/Handlers/Word/WordHandler.View.cs:512-535 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.View.cs:333` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `null` to `string? range =` in one and `HashSet<string>? cols =` 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 (23–24 lines × 2) · ×4
  • Duplicated block (23–24 lines × 2) src/officecli/CommandBuilder.View.cs:781 — src/officecli/CommandBuilder.View.cs:781-804 | src/officecli/ResidentServer.cs:2891-2913 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `pageFilter` to `int? end) ParsePptHtmlPage( string?` in one and `int? end) ResolvePptHtmlPage( string?` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (23–24 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Query.cs:89 — src/officecli/Handlers/Excel/ExcelHandler.Query.cs:89-111 | src/officecli/Handlers/Excel/ExcelHandler.Query.cs:194-217 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/officecli/Handlers/Excel/ExcelHandler.Query.cs:112` calls `Add` and `src/officecli/Handlers/Excel/ExcelHandler.Query.cs:219` 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 (23–24 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:25 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:25-48 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:148-170 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:25` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (23–24 lines × 2) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:2880 — src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:2880-2903 | src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:3062-3084 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:2880` it does not close everything it opens, so those 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–19 lines × 2) · ×4
  • Duplicated block (13–19 lines × 2) src/officecli/CommandBuilder.Save.cs:28 — src/officecli/CommandBuilder.Save.cs:28-40 | src/officecli/CommandBuilder.cs:29-47 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/CommandBuilder.Save.cs:28` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (13–19 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.View.cs:28 — src/officecli/Handlers/Excel/ExcelHandler.View.cs:28-40 | src/officecli/Handlers/Excel/ExcelHandler.View.cs:131-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. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.View.cs:28` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, 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 `null` to `string? range =` in one and `HashSet<string>? cols =` 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, `src/officecli/Handlers/Excel/ExcelHandler.View.cs:28` calls `Equals` and `src/officecli/Handlers/Excel/ExcelHandler.View.cs:131` does not — after which the two agree again for 5 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–19 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:970 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:970-988 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:1137-1149 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:970` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (13–19 lines × 2) src/officecli/Handlers/Word/WordHandler.Navigation.cs:2013 — src/officecli/Handlers/Word/WordHandler.Navigation.cs:2013-2031 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:2107-2119 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Navigation.cs:2013` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (18–19 lines × 2) · ×4
  • Duplicated block (18–19 lines × 2) src/officecli/Core/PowerPointPngBackend.cs:63 — src/officecli/Core/PowerPointPngBackend.cs:63-80 | src/officecli/Core/PowerPointPngBackend.cs:119-137 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/PowerPointPngBackend.cs:63` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18–19 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Query.cs:477 — src/officecli/Handlers/Excel/ExcelHandler.Query.cs:477-494 | src/officecli/Handlers/Excel/ExcelHandler.Query.cs:498-516 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.Query.cs:477` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (18–19 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:2096 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:2096-2113 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:2174-2192 — both copies are in the same file, so extract the 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–19 lines × 2) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:1557 — src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:1557-1575 | src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:4082-4099 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:1557` it does not close everything it opens, so those 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–18 lines × 2) · ×4
  • Duplicated block (14–18 lines × 2) src/officecli/Core/Chart/ChartHelper.Axis.cs:403 — src/officecli/Core/Chart/ChartHelper.Axis.cs:403-416 | src/officecli/Core/Chart/ChartHelper.Setter.cs:1934-1951 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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–18 lines × 2) src/officecli/Core/Chart/ChartHelper.cs:583 — src/officecli/Core/Chart/ChartHelper.cs:583-600 | src/officecli/Core/Chart/ChartHelper.cs:627-640 — both copies are in the same file, so extract the 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–18 lines × 2) src/officecli/Core/Chart/ChartSvgRenderer.cs:695 — src/officecli/Core/Chart/ChartSvgRenderer.cs:695-712 | src/officecli/Core/Chart/ChartSvgRenderer.cs:989-1002 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartSvgRenderer.cs:695` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14–18 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2802 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2802-2819 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2825-2838 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (17–18 lines × 2) · ×4
  • Duplicated block (17–18 lines × 2) src/officecli/Core/Chart/ChartHelper.Setter.cs:3994 — src/officecli/Core/Chart/ChartHelper.Setter.cs:3994-4011 | src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:561-577 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (17–18 lines × 2) src/officecli/Core/Formula/FormulaParser.cs:1581 — src/officecli/Core/Formula/FormulaParser.cs:1581-1598 | src/officecli/Core/Formula/FormulaParser.cs:1623-1639 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Formula/FormulaParser.cs:1581` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (17–18 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:263 — src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:263-279 | src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:350-367 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:263` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (17–18 lines × 2) src/officecli/Handlers/Pptx/PptxBatchEmitter.Shape.cs:39 — src/officecli/Handlers/Pptx/PptxBatchEmitter.Shape.cs:39-55 | src/officecli/Handlers/Pptx/PptxBatchEmitter.Shape.cs:121-138 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PptxBatchEmitter.Shape.cs:39` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, 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 (16–18 lines × 2) · ×4
  • Duplicated block (16–18 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:400 — src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:400-415 | src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:706-723 — both copies are in the same file, so extract the 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–18 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:458 — src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:458-473 | src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:477-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. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:458` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (16–18 lines × 2) src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:401 — src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:401-416 | src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:460-477 — both copies are in the same file, so extract the 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–18 lines × 2) REDACTED:530 — REDACTED:530-547 | REDACTED:584-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.
D4 · Code Duplication · Duplicated block (14–16 lines × 2) · ×4
  • Duplicated block (14–16 lines × 2) src/officecli/Core/PivotTableHelper.Render.cs:2337 — src/officecli/Core/PivotTableHelper.Render.cs:2337-2352 | src/officecli/Core/PivotTableHelper.Render.cs:2415-2428 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/PivotTableHelper.Render.cs:2337` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (14–16 lines × 2) src/officecli/Core/SkillInstaller.cs:561 — src/officecli/Core/SkillInstaller.cs:561-576 | src/officecli/Core/SkillInstaller.cs:667-680 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/SkillInstaller.cs:561` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (14–16 lines × 2) REDACTED:1513 — REDACTED:1513-1528 | REDACTED:2223-2236 — both copies are in the same file, so extract the 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) src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs:893 — src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs:893-908 | src/officecli/Handlers/Word/WordHandler.Set.SectionLayout.cs:296-309 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/officecli/Handlers/Word/WordHandler.Set.SectionLayout.cs:295` calls `EnsureSectionProperties` and `src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs:892` 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–15 lines × 2) · ×4
  • Duplicated block (13–15 lines × 2) src/officecli/Core/Chart/ChartHelper.Setter.cs:3752 — src/officecli/Core/Chart/ChartHelper.Setter.cs:3752-3764 | src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:420-434 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartHelper.Setter.cs:3752` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13–15 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:1297 — src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:1297-1311 | src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:1463-1475 — both copies are in the same file, so extract the 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–15 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1332 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1332-1344 | src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:2004-2018 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13–15 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:956 — src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:956-970 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:3664-3676 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:956` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (12 lines × 3) · ×4
  • Duplicated block (12 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:388 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:388-399 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1009-1020 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:1288-1299 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (12 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:259 — src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:259-273 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:359-370 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:403-416 — 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 lines × 3) src/officecli/Handlers/Word/WordHandler.Add.Text.cs:1952 — src/officecli/Handlers/Word/WordHandler.Add.Text.cs:1952-1963 | src/officecli/Handlers/Word/WordHandler.Add.Text.cs:2106-2117 | src/officecli/Handlers/Word/WordHandler.Add.Text.cs:2150-2161 — 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 `src/officecli/Handlers/Word/WordHandler.Add.Text.cs:2106` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 3) src/officecli/Handlers/Word/WordHandler.Mutations.cs:2126 — src/officecli/Handlers/Word/WordHandler.Mutations.cs:2126-2137 | src/officecli/Handlers/Word/WordHandler.Mutations.cs:2254-2265 | src/officecli/Handlers/Word/WordHandler.Mutations.cs:2524-2535 — 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 (13–14 lines × 2) · ×4
  • Duplicated block (13–14 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:2017 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:2017-2029 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Model3D.cs:90-103 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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–14 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:303 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:303-316 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:324-336 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:303` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (13–14 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:719 — src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:719-732 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:3241-3253 — both copies are in the same file, so extract the 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 (13–14 lines × 2) src/officecli/Handlers/Word/WordHandler.Set.Element.cs:1047 — src/officecli/Handlers/Word/WordHandler.Set.Element.cs:1047-1059 | src/officecli/Handlers/Word/WordHandler.Set.Element.cs:1124-1137 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Set.Element.cs:1047` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9–11 lines × 2) · ×4
  • Duplicated block (9–11 lines × 2) src/officecli/Core/Chart/ChartHelper.Setter.cs:3862 — src/officecli/Core/Chart/ChartHelper.Setter.cs:3862-3870 | src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:1003-1013 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Core/Chart/ChartHelper.Setter.cs:3862` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (9–11 lines × 2) src/officecli/Core/PivotTableHelper.Render.cs:417 — src/officecli/Core/PivotTableHelper.Render.cs:417-427 | src/officecli/Core/PivotTableHelper.Render.cs:478-486 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/PivotTableHelper.Render.cs:417` it does not close everything it opens, so those 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 × 2) src/officecli/Handlers/Excel/ExcelHandler.Set.Workbook.cs:220 — src/officecli/Handlers/Excel/ExcelHandler.Set.Workbook.cs:220-228 | src/officecli/Handlers/Excel/ExcelHandler.Set.Workbook.cs:371-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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (9–11 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1398 — src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1398-1408 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2358-2366 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1398` it does not close everything it opens, so those 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–10 lines × 3) · ×4
  • Duplicated block (8–10 lines × 3) src/officecli/Handlers/Excel/ExcelHandler.Query.RowWhere.cs:91 — src/officecli/Handlers/Excel/ExcelHandler.Query.RowWhere.cs:91-100 | src/officecli/Handlers/Excel/ExcelHandler.Query.RowWhere.cs:394-402 | src/officecli/Handlers/Excel/ExcelHandler.Query.RowWhere.cs:481-488 — 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 `src/officecli/Handlers/Excel/ExcelHandler.Query.RowWhere.cs:91` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8–10 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:136 — src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:136-145 | REDACTED:1219-1226 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1544-1552 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs: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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (8–10 lines × 3) src/officecli/Handlers/Word/WordHandler.Query.cs:475 — src/officecli/Handlers/Word/WordHandler.Query.cs:475-484 | src/officecli/Handlers/Word/WordHandler.Query.cs:2025-2033 | src/officecli/Handlers/Word/WordHandler.Query.cs:2253-2260 — 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 (8–10 lines × 3) src/officecli/Handlers/Excel/ExcelHandler.Set.Sheet.cs:166 — src/officecli/Handlers/Excel/ExcelHandler.Set.Sheet.cs:166-175 | src/officecli/Handlers/Excel/ExcelHandler.Set.Sheet.cs:185-194 | src/officecli/Handlers/Excel/ExcelHandler.Set.Sheet.cs:211-218 — 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 `src/officecli/Handlers/Excel/ExcelHandler.Set.Sheet.cs:166` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8–10 lines × 2) · ×4
  • Duplicated block (8–10 lines × 2) src/officecli/CommandBuilder.View.cs:374 — src/officecli/CommandBuilder.View.cs:374-381 | src/officecli/ResidentServer.cs:1708-1717 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/CommandBuilder.View.cs:374` it does not close everything it opens, so those exact lines 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–10 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:105 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:105-114 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Model3D.cs:66-73 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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–10 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:3092 — src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:3092-3101 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:1031-1038 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:3092` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (8–10 lines × 2) REDACTED:153 — REDACTED:153-162 | REDACTED:169-176 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:153` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8 lines × 4) · ×4
  • Duplicated block (8 lines × 4) src/officecli/Core/Watch/WatchNotifier.cs:69 — src/officecli/Core/Watch/WatchNotifier.cs:69-76 | src/officecli/Core/Watch/WatchNotifier.cs:111-118 | src/officecli/Core/Watch/WatchNotifier.cs:195-202 | src/officecli/Core/Watch/WatchNotifier.cs:246-253 — 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 `src/officecli/Core/Watch/WatchNotifier.cs:69` it does not close everything it opens, so those 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, `src/officecli/Core/Watch/WatchNotifier.cs:203` calls `Serialize` and `src/officecli/Core/Watch/WatchNotifier.cs:77` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 4) src/officecli/Core/Chart/ChartSvgRenderer.cs:592 — src/officecli/Core/Chart/ChartSvgRenderer.cs:592-599 | src/officecli/Core/Chart/ChartSvgRenderer.cs:844-852 | src/officecli/Core/Chart/ChartSvgRenderer.cs:1471-1478 | src/officecli/Core/Chart/ChartSvgRenderer.cs:2163-2170 — 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 `src/officecli/Core/Chart/ChartSvgRenderer.cs:592` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (8 lines × 4) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1556 — src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1556-1564 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1617-1624 | src/officecli/Handlers/Word/WordHandler.Mutations.cs:2706-2713 | src/officecli/Handlers/Word/WordHandler.Mutations.cs:2761-2768 — 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (8 lines × 4) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:1606 — src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:1606-1613 | src/officecli/Handlers/Word/WordHandler.Add.Text.cs:371-378 | src/officecli/Handlers/Word/WordHandler.Add.Text.cs:915-922 | src/officecli/Handlers/Word/WordHandler.Add.Text.cs:2277-2284 — 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.
IC1 · Incompleteness & stubs · Guard cannot change the result · ×4
  • Guard cannot change the result — returns what the code already falls through to src/officecli/Core/TemplateMerger.cs:387 — 1 guard above `return value;` also returns `value`, so no input can make it matter. Implement the distinction that was intended, or delete the guard.
  • Guard cannot change the result — returns what the code already falls through to src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.Shapes.cs:129 — 1 guard above `return null;` also returns `null`, so no input can make it matter. Implement the distinction that was intended, or delete the guard.
  • Guard cannot change the result — returns what the code already falls through to src/officecli/Handlers/Word/WordHandler.Helpers.Style.cs:178 — 1 guard above `return 1;` also returns `1`, so no input can make it matter. Implement the distinction that was intended, or delete the guard.
  • Guard cannot change the result — returns what the code already falls through to src/officecli/ResidentServer.cs:981 — 1 guard above `return true;` also returns `true`, so no input can make it matter. Implement the distinction that was intended, or delete the guard.
X12 · Unreachable branch · Switch arm can never match its case-normalised subject · ×4
  • Switch arm can never match its case-normalised subject src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:436 — The switch subject is `key.ToLowerInvariant()`, so every value reaching these arms has already been lower-cased by `ToLower()/ToLowerInvariant()` (line 292). The label `"fontSize"` carries a letter of the opposite case, so it cannot equal that subject for ANY input — this arm is dead and whatever it was meant to handle silently falls through to the default. Match the normalised spelling (`"fontsize"`), or drop the normaliser and compare with `StringComparison.OrdinalIgnoreCase`.
  • Switch arm can never match its case-normalised subject src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:563 — The switch subject is `key.ToLowerInvariant()`, so every value reaching these arms has already been lower-cased by `ToLower()/ToLowerInvariant()` (line 292). The label `"underlineColor"` carries a letter of the opposite case, so it cannot equal that subject for ANY input — this arm is dead and whatever it was meant to handle silently falls through to the default. Match the normalised spelling (`"underlinecolor"`), or drop the normaliser and compare with `StringComparison.OrdinalIgnoreCase`.
  • Switch arm can never match its case-normalised subject src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:3220 — The switch subject is `key.ToLowerInvariant()`, so every value reaching these arms has already been lower-cased by `ToLower()/ToLowerInvariant()` (line 2721). The label `"underlineColor"` carries a letter of the opposite case, so it cannot equal that subject for ANY input — this arm is dead and whatever it was meant to handle silently falls through to the default. Match the normalised spelling (`"underlinecolor"`), or drop the normaliser and compare with `StringComparison.OrdinalIgnoreCase`.
  • Switch arm can never match its case-normalised subject src/officecli/Handlers/Word/WordHandler.Helpers.RunFormat.cs:886 — The switch subject is `key.ToLowerInvariant()`, so every value reaching these arms has already been lower-cased by `ToLower()/ToLowerInvariant()` (line 575). The label `"underlineColor"` carries a letter of the opposite case, so it cannot equal that subject for ANY input — this arm is dead and whatever it was meant to handle silently falls through to the default. Match the normalised spelling (`"underlinecolor"`), or drop the normaliser and compare with `StringComparison.OrdinalIgnoreCase`.
D17 · Explicit Debt · BarePragmaDisable · ×3
  • BarePragmaDisable src/officecli/Core/RawXmlHelper.cs:1265 — #pragma warning disable OOXML0001 — the disable is closed again below, so its scope is not the problem; what it records is no reason: there is nothing on the directive line, and no ordinary comment attached to it either side. A suppression is a decision somebody made, and without the reason the next reader cannot tell a considered exception from an unexamined one, so it is never revisited and it outlives the code it was written for. Put the reason on the directive line — what makes this site legitimately different — or fix what the rule is pointing at and delete the pair. A rationale in the member's documentation comment does not clear this row and is not meant to: it explains the member to its callers, and the next person to touch the suppression is not reading it for that.
  • BarePragmaDisable src/officecli/Handlers/Pptx/PowerPointHandler.View.cs:9 — #pragma warning disable OOXML0001 — the disable is closed again below, so its scope is not the problem; what it records is no reason: there is nothing on the directive line, and no ordinary comment attached to it either side. A suppression is a decision somebody made, and without the reason the next reader cannot tell a considered exception from an unexamined one, so it is never revisited and it outlives the code it was written for. Put the reason on the directive line — what makes this site legitimately different — or fix what the rule is pointing at and delete the pair. A rationale in the member's documentation comment does not clear this row and is not meant to: it explains the member to its callers, and the next person to touch the suppression is not reading it for that.
  • BarePragmaDisable src/officecli/Handlers/Pptx/PowerPointHandler.View.cs:584 — #pragma warning disable OOXML0001 — the disable is closed again below, so its scope is not the problem; what it records is no reason: there is nothing on the directive line, and no ordinary comment attached to it either side. A suppression is a decision somebody made, and without the reason the next reader cannot tell a considered exception from an unexamined one, so it is never revisited and it outlives the code it was written for. Put the reason on the directive line — what makes this site legitimately different — or fix what the rule is pointing at and delete the pair. A rationale in the member's documentation comment does not clear this row and is not meant to: it explains the member to its callers, and the next person to touch the suppression is not reading it for that.
D4 · Code Duplication · Duplicated block (23 lines × 2) · ×3
  • Duplicated block (23 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Zoom3D.cs:144 — src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Zoom3D.cs:144-166 | src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Zoom3D.cs:231-253 — both copies are in the same file, so extract the 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 (23 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Add.cs:603 — src/officecli/Handlers/Excel/ExcelHandler.Add.cs:603-625 | src/officecli/Handlers/Excel/ExcelHandler.Add.cs:639-661 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (23 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:491 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:491-513 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:542-564 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:491` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (18–22 lines × 2) · ×3
  • Duplicated block (18–22 lines × 2) REDACTED:4033 — REDACTED:4033-4054 | REDACTED:4183-4200 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (18–22 lines × 2) src/officecli/Handlers/Word/WordHandler.Add.cs:956 — src/officecli/Handlers/Word/WordHandler.Add.cs:956-977 | src/officecli/Handlers/Word/WordHandler.Add.cs:987-1004 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Add.cs:956` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (18–22 lines × 2) src/officecli/Handlers/Word/WordHandler.StyleList.cs:75 — src/officecli/Handlers/Word/WordHandler.StyleList.cs:75-96 | src/officecli/Handlers/Word/WordHandler.StyleList.cs:124-141 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.StyleList.cs:75` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (18 lines × 2) · ×3
  • Duplicated block (18 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.FindReplace.cs:473 — src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.FindReplace.cs:473-490 | src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.FindReplace.cs:535-552 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.FindReplace.cs:473` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs:1013 — src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs:1013-1030 | src/officecli/Handlers/Word/WordHandler.Set.SectionLayout.cs:268-285 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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, `src/officecli/Handlers/Word/WordHandler.Set.SectionLayout.cs:267` calls `EnsureSectionProperties` and `src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs:1012` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (18 lines × 2) src/officecli/Handlers/Word/WordHandler.Set.Element.cs:1096 — src/officecli/Handlers/Word/WordHandler.Set.Element.cs:1096-1113 | src/officecli/Handlers/Word/WordHandler.Set.Element.cs:1168-1185 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Set.Element.cs:1096` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (20–21 lines × 2) · ×3
  • Duplicated block (20–21 lines × 2) src/officecli/CommandBuilder.View.cs:178 — src/officecli/CommandBuilder.View.cs:178-198 | src/officecli/ResidentServer.cs:1570-1589 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/CommandBuilder.View.cs:178` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (20–21 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Chart.cs:427 — src/officecli/Handlers/Excel/ExcelHandler.Helpers.Chart.cs:427-447 | src/officecli/Handlers/Excel/ExcelHandler.Helpers.Chart.cs:644-663 — both copies are in the same file, so extract the 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 (20–21 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:2032 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:2032-2051 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Model3D.cs:106-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.
D4 · Code Duplication · Duplicated block (15–20 lines × 2) · ×3
  • Duplicated block (15–20 lines × 2) src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:1334 — src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:1334-1353 | src/officecli/Core/Formula/FormulaEvaluator.Helpers.cs:643-657 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:1334` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (15–20 lines × 2) src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:298 — src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:298-312 | src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:338-357 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:298` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (15–20 lines × 2) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:735 — src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:735-754 | src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:867-881 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (19–20 lines × 2) · ×3
  • Duplicated block (19–20 lines × 2) src/officecli/Core/PivotTableHelper.Set.cs:18 — src/officecli/Core/PivotTableHelper.Set.cs:18-36 | src/officecli/Core/PivotTableHelper.cs:933-952 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 (19–20 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Query.cs:726 — src/officecli/Handlers/Excel/ExcelHandler.Query.cs:726-744 | src/officecli/Handlers/Word/WordHandler.Query.cs:564-583 — 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 `src/officecli/Handlers/Excel/ExcelHandler.Query.cs:726` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19–20 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1515 — src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1515-1533 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1586-1605 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (15–18 lines × 2) · ×3
  • Duplicated block (15–18 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:900 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:900-914 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:970-987 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:900` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (15–18 lines × 2) src/officecli/Handlers/Pptx/PptxBatchEmitter.AuxParts.cs:106 — src/officecli/Handlers/Pptx/PptxBatchEmitter.AuxParts.cs:106-123 | src/officecli/Handlers/Word/WordBatchEmitter.AuxParts.cs:108-122 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PptxBatchEmitter.AuxParts.cs:106` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/officecli/Handlers/Pptx/PptxBatchEmitter.AuxParts.cs:123` calls `EndsWith` and `src/officecli/Handlers/Word/WordBatchEmitter.AuxParts.cs:122` 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 (15–18 lines × 2) src/officecli/Handlers/Word/WordHandler.Set.Revision.cs:482 — src/officecli/Handlers/Word/WordHandler.Set.Revision.cs:482-499 | src/officecli/Handlers/Word/WordHandler.Set.Revision.cs:652-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.
D4 · Code Duplication · Duplicated block (16–17 lines × 2) · ×3
  • Duplicated block (16–17 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:618 — src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:618-633 | REDACTED:835-851 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:618` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (16–17 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:744 — src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:744-760 | REDACTED:868-883 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:744` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (16–17 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2614 — src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2614-2630 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:3195-3210 — both copies are in the same file, so extract the 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 `null` to `string? parentPathPrefix =` in one and `OpenXmlPart? part =` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (13–16 lines × 2) · ×3
  • Duplicated block (13–16 lines × 2) src/officecli/CommandBuilder.Add.cs:51 — src/officecli/CommandBuilder.Add.cs:51-63 | src/officecli/CommandBuilder.Set.cs:26-41 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/CommandBuilder.Add.cs:51` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13–16 lines × 2) src/officecli/Core/Chart/ChartHelper.Axis.cs:378 — src/officecli/Core/Chart/ChartHelper.Axis.cs:378-390 | src/officecli/Core/Chart/ChartHelper.Setter.cs:1909-1924 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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) src/officecli/Handlers/Excel/ExcelHandler.View.cs:195 — src/officecli/Handlers/Excel/ExcelHandler.View.cs:195-210 | src/officecli/Handlers/Excel/ExcelHandler.View.cs:389-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. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.View.cs:195` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (12–16 lines × 2) · ×3
  • Duplicated block (12–16 lines × 2) src/officecli/CommandBuilder.Check.cs:41 — src/officecli/CommandBuilder.Check.cs:41-56 | src/officecli/ResidentServer.cs:2588-2599 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/CommandBuilder.Check.cs: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.
  • Duplicated block (12–16 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Text.cs:645 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Text.cs:645-660 | src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:1356-1367 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Text.cs:645` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (12–16 lines × 2) src/officecli/Handlers/Word/WordHandler.Query.cs:2573 — src/officecli/Handlers/Word/WordHandler.Query.cs:2573-2584 | src/officecli/Handlers/Word/WordHandler.Query.cs:2620-2635 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Query.cs:2573` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (15–16 lines × 2) · ×3
  • Duplicated block (15–16 lines × 2) src/officecli/Core/TemplateMerger.cs:336 — src/officecli/Core/TemplateMerger.cs:336-351 | src/officecli/Core/TemplateMerger.cs:405-419 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/TemplateMerger.cs:336` it does not close everything it opens, so those 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–16 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:1248 — src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:1248-1263 | src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:1396-1410 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:1248` it does not close everything it opens, so those 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, `src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:1396` calls `ColumnNameToIndex` and `src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:1248` 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 (15–16 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:548 — src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:548-562 | REDACTED:784-799 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:548` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (11–14 lines × 2) · ×3
  • Duplicated block (11–14 lines × 2) src/officecli/CommandBuilder.cs:1498 — src/officecli/CommandBuilder.cs:1498-1511 | src/officecli/CommandBuilder.cs:1555-1565 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/CommandBuilder.cs:1498` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11–14 lines × 2) src/officecli/Core/Chart/ChartHelper.Reader.cs:2003 — src/officecli/Core/Chart/ChartHelper.Reader.cs:2003-2016 | src/officecli/Core/Chart/ChartHelper.Reader.cs:2188-2198 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartHelper.Reader.cs:2003` it begins part-way through the construct above it, so those 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 (11–14 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1837 — src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1837-1847 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:3349-3362 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1837` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8–13 lines × 2) · ×3
  • Duplicated block (8–13 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Add.cs:510 — src/officecli/Handlers/Excel/ExcelHandler.Add.cs:510-522 | src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:1418-1425 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Excel/ExcelHandler.Add.cs:510` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (8–13 lines × 2) src/officecli/Handlers/Word/WordHandler.Add.Media.cs:537 — src/officecli/Handlers/Word/WordHandler.Add.Media.cs:537-549 | src/officecli/Handlers/Word/WordHandler.Helpers.Chart.cs:265-272 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Word/WordHandler.Add.Media.cs:537` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (8–13 lines × 2) REDACTED:338 — REDACTED:338-350 | REDACTED:870-877 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:338` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (11–12 lines × 3) · ×3
  • Duplicated block (11–12 lines × 3) src/officecli/Core/Chart/ChartHelper.Reader.cs:2570 — src/officecli/Core/Chart/ChartHelper.Reader.cs:2570-2580 | src/officecli/Core/Chart/ChartHelper.Reader.cs:2608-2619 | src/officecli/Core/Chart/ChartHelper.Setter.cs:3440-3450 — 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 `src/officecli/Core/Chart/ChartHelper.Reader.cs:2570` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (11–12 lines × 3) src/officecli/Handlers/Excel/ExcelHandler.Query.cs:96 — src/officecli/Handlers/Excel/ExcelHandler.Query.cs:96-106 | src/officecli/Handlers/Excel/ExcelHandler.Query.cs:201-212 | src/officecli/Handlers/Excel/ExcelHandler.Query.cs:1967-1978 — 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 `src/officecli/Handlers/Excel/ExcelHandler.Query.cs:96` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11–12 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Path.cs:71 — src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Path.cs:71-82 | src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Path.cs:179-189 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:492-502 — 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–11 lines × 2) · ×3
  • Duplicated block (7–11 lines × 2) src/officecli/Core/Chart/ChartHelper.Setter.cs:1824 — src/officecli/Core/Chart/ChartHelper.Setter.cs:1824-1834 | src/officecli/Core/Chart/ChartHelper.Setter.cs:1840-1846 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartHelper.Setter.cs:1824` it begins part-way through the construct above it, so those exact lines 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–11 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:151 — src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:151-157 | src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:1564-1574 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:151` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7–11 lines × 2) src/officecli/Handlers/Word/WordHandler.Query.cs:653 — src/officecli/Handlers/Word/WordHandler.Query.cs:653-663 | src/officecli/Handlers/Word/WordHandler.Query.cs:1880-1886 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Query.cs:653` it does not close everything it opens, so those 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–11 lines × 2) · ×3
  • Duplicated block (8–11 lines × 2) src/officecli/Core/Formula/FormulaParser.cs:604 — src/officecli/Core/Formula/FormulaParser.cs:604-614 | src/officecli/Core/Formula/FormulaParser.cs:618-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 `src/officecli/Core/Formula/FormulaParser.cs:604` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8–11 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.cs:116 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.cs:116-126 | REDACTED:275-282 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.cs:116` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (8–11 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:1057 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:1057-1067 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:1071-1078 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:1057` it begins part-way through the construct above it, so those 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–9 lines × 2) · ×3
  • Duplicated block (7–9 lines × 2) src/officecli/Core/PivotTableHelper.Readback.cs:68 — src/officecli/Core/PivotTableHelper.Readback.cs:68-76 | src/officecli/Core/PivotTableHelper.Readback.cs:80-86 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/PivotTableHelper.Readback.cs:68` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7–9 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.ChartCache.cs:108 — src/officecli/Handlers/Excel/ExcelHandler.ChartCache.cs:108-114 | src/officecli/Handlers/Excel/ExcelHandler.View.cs:1057-1065 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 (7–9 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:2506 — src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:2506-2512 | src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:2527-2535 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (8 lines × 6) · ×3
  • Duplicated block (8 lines × 6) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:138 — src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:138-147 | REDACTED:658-665 | REDACTED:678-685 | REDACTED:1093-1100 | REDACTED:1221-1228 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:830-837 — there are 6 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart. 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, `src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:137` calls `Parse` and `REDACTED:657` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 6) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:406 — src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:406-413 | REDACTED:555-562 | REDACTED:572-579 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:960-969 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:102-110 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1801-1808 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:406` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (8 lines × 6) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:900 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:900-910 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:943-953 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:970-980 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1056-1063 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1082-1089 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1115-1125 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (7 lines × 7) · ×3
  • Duplicated block (7 lines × 7) REDACTED:324 — REDACTED:324-346 | REDACTED:1406-1423 | REDACTED:1572-1578 | REDACTED:1645-1651 | REDACTED:1821-1827 | REDACTED:2090-2096 | REDACTED:2145-2151 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:324` it begins part-way through the construct above it, so those 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, `REDACTED:1569` calls `Match` and `REDACTED:1643` 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 × 7) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:407 — src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:407-413 | REDACTED:556-562 | REDACTED:573-579 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:961-969 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:103-110 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1665-1672 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1802-1808 — there are 7 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 7 sites; resolving a subset leaves the remainder to drift apart. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (7 lines × 7) examples/excel/charts/charts-advanced.py:42 — examples/excel/charts/charts-advanced.py:42-48 | examples/excel/charts/charts-bar.py:49-55 | examples/excel/charts/charts-basic.py:37-43 | examples/excel/charts/charts-line.py:50-56 | examples/excel/charts/charts-stock.py:40-46 | examples/excel/charts/charts-waterfall.py:42-48 | examples/excel/pivot-tables.py:35-41 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 7 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 7 times.
IC1 · Incompleteness & stubs · Condition was already decided · ×3
  • Condition was already decided — an earlier guard makes this test constant src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:2347 — Control only reaches here when `run.Type != "field"` is false, because the guard on line 2185 exits otherwise. This test is therefore always false and everything it guards is unreachable. Implement the distinction that was intended, or delete the test.
  • Condition was already decided — an earlier guard makes this test constant src/officecli/Handlers/Word/WordHandler.Query.cs:2826 — Control only reaches here when `isOleSelector` is false, because the guard on line 2319 exits otherwise. This test is therefore always false and everything it guards is unreachable. Implement the distinction that was intended, or delete the test.
  • Condition was already decided — an earlier guard makes this test constant src/officecli/Handlers/Word/WordHandler.Query.cs:3118 — Control only reaches here when `isOleSelector` is false, because the guard on line 2319 exits otherwise. This test is therefore always false and everything it guards is unreachable. Implement the distinction that was intended, or delete the test.
X2 · Cancellation propagation · Async method without CancellationToken · ×3
  • Async method without CancellationToken: StopAsync src/officecli/Core/Watch/WatchServer.cs:455 — No CancellationToken parameter — this work can't be stopped early once started.
  • Async method without CancellationToken: ShutdownAsync src/officecli/ResidentServer.cs:2777 — No CancellationToken parameter — this work can't be stopped early once started.
  • Async method without CancellationToken: DoShutdownAsync src/officecli/ResidentServer.cs:2785 — No CancellationToken parameter — this work can't be stopped early once started.
X24 · Document value interpolated into markup unescaped · `vlabel` is escaped into this markup elsewhere in the type and raw here · ×3
  • `vlabel` is escaped into this markup elsewhere in the type and raw here src/officecli/Core/Chart/ChartSvgRenderer.cs:642 — This type writes `vlabel` into generated markup in two ways. At src/officecli/Core/Chart/ChartSvgRenderer.cs:2267 it passes the value through `HtmlEncode` first; here it interpolates the same expression into the text of an element with nothing escaping it. Both sites are holes the surrounding literal itself delimits, so a value carrying `<` or `"` closes the markup at this site and does not at the other. Nothing about where the value came from is needed to call that a defect: the type has already stated, in its own code, that this expression needs escaping in this markup. Either escape `vlabel` here too, or remove the encoder call at the other site if the value was never able to carry markup.
  • `vlabel` is escaped into this markup elsewhere in the type and raw here src/officecli/Core/Chart/ChartSvgRenderer.cs:691 — This type writes `vlabel` into generated markup in two ways. At src/officecli/Core/Chart/ChartSvgRenderer.cs:2267 it passes the value through `HtmlEncode` first; here it interpolates the same expression into the text of an element with nothing escaping it. Both sites are holes the surrounding literal itself delimits, so a value carrying `<` or `"` closes the markup at this site and does not at the other. Nothing about where the value came from is needed to call that a defect: the type has already stated, in its own code, that this expression needs escaping in this markup. Either escape `vlabel` here too, or remove the encoder call at the other site if the value was never able to carry markup.
  • `vlabel` is escaped into this markup elsewhere in the type and raw here src/officecli/Core/Chart/ChartSvgRenderer.cs:892 — This type writes `vlabel` into generated markup in two ways. At src/officecli/Core/Chart/ChartSvgRenderer.cs:2267 it passes the value through `HtmlEncode` first; here it interpolates the same expression into the text of an element with nothing escaping it. Both sites are holes the surrounding literal itself delimits, so a value carrying `<` or `"` closes the markup at this site and does not at the other. Nothing about where the value came from is needed to call that a defect: the type has already stated, in its own code, that this expression needs escaping in this markup. Either escape `vlabel` here too, or remove the encoder call at the other site if the value was never able to carry markup.
D1 · Cyclomatic Complexity · (anonymous) (cyclomatic 23) · ×2
  • (anonymous) (cyclomatic 23) src/officecli/Resources/watch-overlay.js:547 — (anonymous) 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.
  • (anonymous) (cyclomatic 23) src/officecli/Resources/watch-overlay.js:912 — (anonymous) has cyclomatic complexity 23 (threshold 15). Of this number, 14 points are the body's own statements and 9 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.
D17 · Explicit Debt · TodoComment · ×2
  • TodoComment src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Text.cs:989 — // TODO CONSISTENCY(underline-variants): CSS has no dot-dash — 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 src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:137 — // TODO: Chart — 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.
D35 · Change Coupling · Change coupling · ×2
  • Change coupling: WatchServer.cs ↔ watch-sse-core.js src/officecli/Core/Watch/WatchServer.cs:1 — `src/officecli/Core/Watch/WatchServer.cs` and `src/officecli/Resources/watch-sse-core.js` 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 — 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 `446a5ec4` feat(watch): switch documents in place via POST /api/switch; fix --po…; `1c25118a` feat(watch): add goto command for runtime navigation; `267254e9` refactor(watch): detect excel chrome change server-side — run `git show` on any of them.
  • Change coupling: ExcelHandler.cs ↔ WordHandler.cs src/officecli/Handlers/ExcelHandler.cs:1 — `src/officecli/Handlers/ExcelHandler.cs` and `src/officecli/Handlers/WordHandler.cs` change together 50% of the time (18 of the 36 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 18 shared commits counted here, the most recent 3 are `dced039d` fix: a save that fails is reported instead of silently dropping the e…; `274f7e3e` fix(handlers): crash-atomic saves for xlsx/docx/pptx; `537112e8` docs: use neutral terms for third-party products in code comments — run `git show` on any of them.
D4 · Code Duplication · Near-duplicate member pair (63 shared lines) · ×2
  • Near-duplicate member pair (63 shared lines) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:705 — src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:705-839 | src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:842-942 — These two members are variants of one another: 63 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
  • Near-duplicate member pair (63 shared lines) src/officecli/Handlers/Word/WordHandler.Navigation.DocSettings.cs:16 — src/officecli/Handlers/Word/WordHandler.Navigation.DocSettings.cs:16-225 | src/officecli/Handlers/Word/WordHandler.Query.cs:981-1275 — These two members are variants of one another: 63 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 · Duplicated block (32–34 lines × 2) · ×2
  • Duplicated block (32–34 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:462 — src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:462-495 | src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:577-608 — both copies are in the same file, so extract the 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 (32–34 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1293 — src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1293-1326 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1360-1391 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1293` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (28–30 lines × 2) · ×2
  • Duplicated block (28–30 lines × 2) src/officecli/Core/Chart/ChartSvgRenderer.cs:534 — src/officecli/Core/Chart/ChartSvgRenderer.cs:534-563 | src/officecli/Core/Chart/ChartSvgRenderer.cs:786-813 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (28–30 lines × 2) src/officecli/Handlers/Pptx/PptxBatchEmitter.Shape.cs:343 — src/officecli/Handlers/Pptx/PptxBatchEmitter.Shape.cs:343-372 | src/officecli/Handlers/Pptx/PptxBatchEmitter.Shape.cs:464-491 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PptxBatchEmitter.Shape.cs:343` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (27–29 lines × 2) · ×2
  • Duplicated block (27–29 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Text.cs:363 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Text.cs:363-391 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Text.cs:915-941 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Add.Text.cs:915` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (27–29 lines × 2) src/officecli/Handlers/Word/WordHandler.Add.Media.cs:941 — src/officecli/Handlers/Word/WordHandler.Add.Media.cs:941-967 | src/officecli/Handlers/Word/WordHandler.Add.Media.cs:1536-1564 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Add.Media.cs:941` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (24–27 lines × 2) · ×2
  • Duplicated block (24–27 lines × 2) src/officecli/Core/PivotTableHelper.Definition.cs:767 — src/officecli/Core/PivotTableHelper.Definition.cs:767-793 | src/officecli/Core/PivotTableHelper.Definition.cs:906-929 — both copies are in the same file, so extract the 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–27 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.Charts.cs:175 — src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.Charts.cs:175-201 | src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.Charts.cs:502-525 — both copies are in the same file, so extract the 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–26 lines × 2) · ×2
  • Duplicated block (24–26 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.Pictures.cs:32 — src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.Pictures.cs:32-55 | src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.Shapes.cs:34-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. The matched lines also transfer control out of the body holding them, 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 (24–26 lines × 2) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Text.cs:327 — src/officecli/Handlers/Word/WordHandler.HtmlPreview.Text.cs:327-350 | REDACTED:3271-3296 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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, `src/officecli/Handlers/Word/WordHandler.HtmlPreview.Text.cs:318` calls `Add`, `IsOMathParaWrapperParagraph` and `REDACTED:3270` 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 (23–25 lines × 2) · ×2
  • Duplicated block (23–25 lines × 2) src/officecli/Core/Chart/ChartHelper.Builder.cs:1825 — src/officecli/Core/Chart/ChartHelper.Builder.cs:1825-1849 | src/officecli/Core/Chart/ChartHelper.Setter.cs:3703-3725 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Core/Chart/ChartHelper.Builder.cs:1825` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (23–25 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Set.Workbook.cs:157 — src/officecli/Handlers/Excel/ExcelHandler.Set.Workbook.cs:157-181 | src/officecli/Handlers/Excel/ExcelHandler.Set.Workbook.cs:185-207 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.Set.Workbook.cs:157` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (21 lines × 2) · ×2
  • Duplicated block (21 lines × 2) src/officecli/Core/Formula/FormulaParser.cs:1655 — src/officecli/Core/Formula/FormulaParser.cs:1655-1675 | src/officecli/Core/Formula/FormulaParser.cs:2427-2447 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Formula/FormulaParser.cs:1655` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (21 lines × 2) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:2630 — src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:2630-2650 | src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:2825-2846 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:2630` it does not close everything it opens, so those 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, `src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:2847` calls `IsMatch` and `src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:2651` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (20–25 lines × 2) · ×2
  • Duplicated block (20–25 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:50 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:50-74 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:1318-1337 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:50` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `null` to `int? slideNumber =` in one and `string? dataPath =` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:75` calls `Contains` and `src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:1338` 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 (20–25 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:1040 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:1040-1064 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:1163-1182 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:1040` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (24–25 lines × 2) · ×2
  • Duplicated block (24–25 lines × 2) src/officecli/Handlers/Word/WordHandler.Add.Media.cs:696 — src/officecli/Handlers/Word/WordHandler.Add.Media.cs:696-720 | src/officecli/Handlers/Word/WordHandler.Add.Media.cs:1506-1529 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Add.Media.cs:696` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (24–25 lines × 2) src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs:1089 — src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs:1089-1113 | src/officecli/Handlers/Word/WordHandler.Set.SectionLayout.cs:347-370 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (21–24 lines × 2) · ×2
  • Duplicated block (21–24 lines × 2) src/officecli/Core/Chart/ChartHelper.Reader.cs:966 — src/officecli/Core/Chart/ChartHelper.Reader.cs:966-989 | src/officecli/Core/Chart/ChartHelper.Reader.cs:1516-1536 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (21–24 lines × 2) src/officecli/Handlers/Word/WordHandler.Navigation.DocSettings.cs:24 — src/officecli/Handlers/Word/WordHandler.Navigation.DocSettings.cs:24-47 | src/officecli/Handlers/Word/WordHandler.Query.cs:1252-1272 — before extracting anything, compare `src/officecli/Handlers/Word/WordHandler.Navigation.DocSettings.cs` and `src/officecli/Handlers/Word/WordHandler.Query.cs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 90 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–24 lines × 2) · ×2
  • Duplicated block (19–24 lines × 2) src/officecli/Core/HtmlScreenshot.cs:418 — src/officecli/Core/HtmlScreenshot.cs:418-441 | src/officecli/Core/HtmlScreenshot.cs:473-491 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/HtmlScreenshot.cs:418` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (19–24 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Query.cs:745 — src/officecli/Handlers/Excel/ExcelHandler.Query.cs:745-763 | src/officecli/Handlers/Word/WordHandler.Query.cs:584-607 — 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 `src/officecli/Handlers/Excel/ExcelHandler.Query.cs:745` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (17–22 lines × 2) · ×2
  • Duplicated block (17–22 lines × 2) src/officecli/Core/OutputFormatter.cs:201 — src/officecli/Core/OutputFormatter.cs:201-222 | src/officecli/Core/OutputFormatter.cs:225-241 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, 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–22 lines × 2) src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:3029 — src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:3029-3050 | src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:3204-3220 — both copies are in the same file, so extract the 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–22 lines × 2) · ×2
  • Duplicated block (20–22 lines × 2) src/officecli/Core/PivotTableHelper.Definition.cs:1354 — src/officecli/Core/PivotTableHelper.Definition.cs:1354-1373 | src/officecli/Core/PivotTableHelper.Definition.cs:1433-1454 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/PivotTableHelper.Definition.cs:1354` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (20–22 lines × 2) src/officecli/Handlers/Word/WordHandler.Add.Table.cs:527 — src/officecli/Handlers/Word/WordHandler.Add.Table.cs:527-548 | src/officecli/Handlers/Word/WordHandler.Set.Element.cs:3120-3139 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Word/WordHandler.Add.Table.cs:527` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (22 lines × 2) · ×2
  • Duplicated block (22 lines × 2) src/officecli/Core/Watch/WatchServer.cs:2446 — src/officecli/Core/Watch/WatchServer.cs:2446-2467 | src/officecli/Core/Watch/WatchServer.cs:2502-2523 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Watch/WatchServer.cs:2446` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (22 lines × 2) examples/ppt/ole/ole-embed.py:123 — examples/ppt/ole/ole-embed.py:123-144 | examples/ppt/ole/ole-embed.py:155-176 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `examples/ppt/ole/ole-embed.py:123` it does not close everything it opens, so those 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–22 lines × 2) · ×2
  • Duplicated block (21–22 lines × 2) REDACTED:133 — REDACTED:133-154 | src/officecli/Handlers/WordHandler.cs:360-380 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:133` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (21–22 lines × 2) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Charts.cs:41 — src/officecli/Handlers/Word/WordHandler.HtmlPreview.Charts.cs:41-62 | src/officecli/Handlers/Word/WordHandler.HtmlPreview.Charts.cs:130-150 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, 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–21 lines × 2) · ×2
  • Duplicated block (18–21 lines × 2) src/officecli/Core/Formula/ModernFunctionQualifier.cs:309 — src/officecli/Core/Formula/ModernFunctionQualifier.cs:309-329 | src/officecli/Core/Formula/ModernFunctionQualifier.cs:408-425 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Formula/ModernFunctionQualifier.cs:309` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18–21 lines × 2) src/officecli/Handlers/Word/WordHandler.Navigation.cs:3685 — src/officecli/Handlers/Word/WordHandler.Navigation.cs:3685-3705 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:3745-3762 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Navigation.cs:3685` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (17–21 lines × 2) · ×2
  • Duplicated block (17–21 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Add.cs:1076 — src/officecli/Handlers/Excel/ExcelHandler.Add.cs:1076-1096 | src/officecli/Handlers/Excel/ExcelHandler.Add.cs:1217-1233 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.Add.cs:1076` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (17–21 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Shape.cs:305 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Shape.cs:305-325 | src/officecli/Handlers/Pptx/PowerPointHandler.Notes.cs:150-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. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Notes.cs:150` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (18–19 lines × 3) · ×2
  • Duplicated block (18–19 lines × 3) REDACTED:1057 — REDACTED:1057-1075 | REDACTED:1170-1188 | REDACTED:1319-1336 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1057` it begins part-way through the construct above it, so those 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–19 lines × 3) src/officecli/Handlers/Word/WordHandler.Helpers.cs:329 — src/officecli/Handlers/Word/WordHandler.Helpers.cs:329-346 | src/officecli/Handlers/Word/WordHandler.Query.cs:3366-3384 | src/officecli/Handlers/Word/WordHandler.Query.cs:3449-3466 — 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 `src/officecli/Handlers/Word/WordHandler.Helpers.cs:329` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (16–19 lines × 2) · ×2
  • Duplicated block (16–19 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:81 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:81-96 | src/officecli/Handlers/Word/WordHandler.Add.Media.cs:405-423 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:81` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16–19 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:136 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:136-154 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1401-1416 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 (18 lines × 3) · ×2
  • Duplicated block (18 lines × 3) REDACTED:1546 — REDACTED:1546-1569 | REDACTED:1620-1644 | REDACTED:2072-2089 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1546` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:1571` calls `Match` and `REDACTED:1645` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (18 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:420 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:420-437 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1035-1052 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:1211-1228 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:420` it does not close everything it opens, so those 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–17 lines × 2) · ×2
  • Duplicated block (15–17 lines × 2) src/officecli/Core/FileSource.cs:96 — src/officecli/Core/FileSource.cs:96-112 | src/officecli/Core/ImageSource.cs:151-165 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. 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 `url` to `string) ResolveUrl(string` in one and `PartTypeInfo) ResolveUrl(string` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (15–17 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:923 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:923-937 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:1135-1151 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:923` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (14–17 lines × 2) · ×2
  • Duplicated block (14–17 lines × 2) REDACTED:4277 — REDACTED:4277-4293 | REDACTED:4364-4377 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:4277` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (14–17 lines × 2) src/officecli/Handlers/Word/WordHandler.Add.Text.cs:2895 — src/officecli/Handlers/Word/WordHandler.Add.Text.cs:2895-2911 | src/officecli/Handlers/Word/WordHandler.Add.Text.cs:2917-2930 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Add.Text.cs:2895` it does not close everything it opens, so those 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, `src/officecli/Handlers/Word/WordHandler.Add.Text.cs:2931` calls `FromArrayIndex`, `GetAllRuns`, `IndexOf` and `src/officecli/Handlers/Word/WordHandler.Add.Text.cs:2912` 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–16 lines × 3) · ×2
  • Duplicated block (15–16 lines × 3) src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:100 — src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:100-115 | src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:318-332 | src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:645-659 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (15–16 lines × 3) src/officecli/Handlers/Word/WordHandler.Add.Media.cs:701 — src/officecli/Handlers/Word/WordHandler.Add.Media.cs:701-715 | src/officecli/Handlers/Word/WordHandler.Add.Media.cs:1510-1524 | src/officecli/Handlers/Word/WordHandler.Add.Text.cs:2877-2892 — 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 `src/officecli/Handlers/Word/WordHandler.Add.Media.cs:701` it does not close everything it opens, so those 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 × 3) · ×2
  • Duplicated block (13 lines × 3) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:1316 — src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:1316-1328 | src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:1403-1415 | src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:1510-1522 — 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 (13 lines × 3) src/officecli/Handlers/Word/WordHandler.Navigation.cs:3885 — src/officecli/Handlers/Word/WordHandler.Navigation.cs:3885-3897 | src/officecli/Handlers/Word/WordHandler.Query.cs:1569-1581 | src/officecli/Handlers/Word/WordHandler.Query.cs:1646-1658 — 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 `src/officecli/Handlers/Word/WordHandler.Navigation.cs:3885` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (15 lines × 3) · ×2
  • Duplicated block (15 lines × 3) REDACTED:3755 — REDACTED:3755-3769 | REDACTED:4057-4071 | REDACTED:4243-4257 — 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 (15 lines × 3) examples/ppt/charts/charts-3d.py:58 — examples/ppt/charts/charts-3d.py:58-72 | examples/ppt/charts/charts-bubble.py:52-66 | examples/ppt/charts/charts-column.py:62-81 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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.
D4 · Code Duplication · Duplicated block (11–16 lines × 2) · ×2
  • Duplicated block (11–16 lines × 2) src/officecli/Core/Markdown/MarkdownParser.cs:473 — src/officecli/Core/Markdown/MarkdownParser.cs:473-488 | src/officecli/Core/Markdown/MarkdownParser.cs:490-500 — both copies are in the same file, so extract the 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–16 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:188 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:188-203 | src/officecli/Handlers/Word/WordHandler.ImageHelpers.cs:632-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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (12–14 lines × 3) · ×2
  • Duplicated block (12–14 lines × 3) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Chart.cs:311 — src/officecli/Handlers/Excel/ExcelHandler.Helpers.Chart.cs:311-322 | src/officecli/Handlers/Pptx/PowerPointHandler.Chart.cs:115-128 | src/officecli/Handlers/Word/WordHandler.Helpers.Chart.cs:316-327 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. Note first that the copies are not typed on the same thing: the declarations holding them bind `gf` to `XDR.GraphicFrame` in one and `GraphicFrame` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (12–14 lines × 3) src/officecli/Handlers/Pptx/PptxBatchEmitter.cs:455 — src/officecli/Handlers/Pptx/PptxBatchEmitter.cs:455-468 | src/officecli/Handlers/Pptx/PptxBatchEmitter.cs:469-482 | src/officecli/Handlers/Pptx/PptxBatchEmitter.cs:483-494 — 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 `src/officecli/Handlers/Pptx/PptxBatchEmitter.cs:455` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (9–14 lines × 2) · ×2
  • Duplicated block (9–14 lines × 2) src/officecli/CommandBuilder.GetQuery.cs:207 — src/officecli/CommandBuilder.GetQuery.cs:207-220 | src/officecli/CommandBuilder.cs:1048-1056 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (9–14 lines × 2) src/officecli/Core/Chart/ChartSvgRenderer.cs:756 — src/officecli/Core/Chart/ChartSvgRenderer.cs:756-764 | src/officecli/Core/Chart/ChartSvgRenderer.cs:1055-1068 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartSvgRenderer.cs:756` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (12–14 lines × 2) · ×2
  • Duplicated block (12–14 lines × 2) src/officecli/Core/Chart/ChartHelper.Builder.cs:211 — src/officecli/Core/Chart/ChartHelper.Builder.cs:211-222 | src/officecli/Core/Chart/ChartHelper.Builder.cs:1102-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 (12–14 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs:1365 — src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs:1365-1378 | src/officecli/Handlers/Excel/ExcelHandler.Set.Tables.cs:704-715 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (8–14 lines × 2) · ×2
  • Duplicated block (8–14 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1701 — src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1701-1708 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2396-2409 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2396` it does not close everything it opens, so those 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, `src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1709` calls `IsPlainReflectionPreset` and `src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2410` 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–14 lines × 2) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:1471 — src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:1471-1484 | src/officecli/Handlers/Word/WordHandler.Add.Text.cs:452-459 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:1471` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (10–13 lines × 2) · ×2
  • Duplicated block (10–13 lines × 2) src/officecli/Core/Formula/FormulaParser.cs:501 — src/officecli/Core/Formula/FormulaParser.cs:501-513 | src/officecli/Core/Formula/FormulaParser.cs:880-889 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Formula/FormulaParser.cs:501` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (10–13 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Tables.cs:53 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Tables.cs:53-65 | src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:1134-1143 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 (12 lines × 5) · ×2
  • Duplicated block (12 lines × 5) src/officecli/Core/PivotTableHelper.Render.cs:341 — src/officecli/Core/PivotTableHelper.Render.cs:341-352 | src/officecli/Core/PivotTableHelper.Render.cs:685-696 | src/officecli/Core/PivotTableHelper.Render.cs:1006-1017 | src/officecli/Core/PivotTableHelper.Render.cs:1440-1451 | src/officecli/Core/PivotTableHelper.Render.cs:1954-1965 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/officecli/Core/PivotTableHelper.Render.cs:699` calls `LeafColIdx`, `GrandTotalColIdx` and `src/officecli/Core/PivotTableHelper.Render.cs:1022` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 5) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:1062 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:1062-1073 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1186-1197 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1943-1962 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Table.cs:19-30 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Text.cs:23-34 — 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 after the matched lines, `src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1206` calls `TryGetValue`, `IsTruthy` and `src/officecli/Handlers/Pptx/PowerPointHandler.Add.Text.cs:36` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (11 lines × 4) · ×2
  • Duplicated block (11 lines × 4) src/officecli/CommandBuilder.Add.cs:47 — src/officecli/CommandBuilder.Add.cs:47-57 | src/officecli/CommandBuilder.Add.cs:430-440 | src/officecli/CommandBuilder.Import.cs:30-40 | src/officecli/CommandBuilder.View.cs:47-57 — 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 `src/officecli/CommandBuilder.Add.cs:47` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/officecli/CommandBuilder.Add.cs:61` calls `Begin` and `src/officecli/CommandBuilder.Add.cs:442` 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 × 4) REDACTED:2550 — REDACTED:2550-2560 | REDACTED:2691-2701 | REDACTED:2711-2721 | REDACTED:2956-2966 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:2550` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (7 lines × 6) · ×2
  • Duplicated block (7 lines × 6) src/officecli/Handlers/Excel/ExcelHandler.Set.Drawings.cs:528 — src/officecli/Handlers/Excel/ExcelHandler.Set.Drawings.cs:528-534 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Shape.cs:415-421 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Text.cs:760-766 | src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.FindReplace.cs:702-708 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:539-545 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:3209-3215 — there are 6 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 6 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (7 lines × 6) REDACTED:349 — REDACTED:349-369 | REDACTED:1425-1437 | REDACTED:1580-1586 | REDACTED:1653-1659 | REDACTED:1829-1835 | REDACTED:2098-2104 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:349` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (8–10 lines × 5) · ×2
  • Duplicated block (8–10 lines × 5) src/officecli/BlankDocCreator.cs:573 — src/officecli/BlankDocCreator.cs:573-582 | src/officecli/BlankDocCreator.cs:592-599 | src/officecli/BlankDocCreator.cs:611-618 | src/officecli/BlankDocCreator.cs:630-637 | src/officecli/BlankDocCreator.cs:650-657 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/BlankDocCreator.cs:573` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8–10 lines × 5) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:2051 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:2051-2060 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:2090-2097 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:2168-2175 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Model3D.cs:126-135 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Model3D.cs:192-199 — there are 5 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 5 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (10 lines × 5) · ×2
  • Duplicated block (10 lines × 5) src/officecli/CommandBuilder.Add.cs:45 — src/officecli/CommandBuilder.Add.cs:45-54 | src/officecli/CommandBuilder.Add.cs:430-440 | src/officecli/CommandBuilder.Import.cs:27-36 | src/officecli/CommandBuilder.View.cs:37-46 | src/officecli/CommandBuilder.View.cs:47-57 — there are 5 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/CommandBuilder.Add.cs:430` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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, `src/officecli/CommandBuilder.Add.cs:54` calls `Add` and `src/officecli/CommandBuilder.Add.cs:440` 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 × 5) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:588 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:588-599 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1549-1558 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1580-1589 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1669-1678 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1829-1838 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1665` calls `Parse` and `src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:585` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (7 lines × 8) · ×2
  • Duplicated block (7 lines × 8) src/officecli/Handlers/Word/WordHandler.Navigation.cs:2328 — src/officecli/Handlers/Word/WordHandler.Navigation.cs:2328-2334 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:2356-2362 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:2367-2373 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:2381-2387 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:2398-2404 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:4032-4038 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:6404-6410 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:6414-6420 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/officecli/Handlers/Word/WordHandler.Navigation.cs:2346` calls `CaptureNestedDeletion` and `src/officecli/Handlers/Word/WordHandler.Navigation.cs:6411` 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 × 8) examples/excel/charts/charts-area.py:47 — examples/excel/charts/charts-area.py:47-53 | examples/excel/charts/charts-boxwhisker.py:36-42 | examples/excel/charts/charts-column.py:49-60 | examples/excel/charts/charts-combo.py:43-49 | examples/excel/charts/charts-extended.py:39-45 | examples/excel/charts/charts-pie.py:36-42 | examples/excel/charts/charts-radar.py:34-40 | examples/excel/charts/charts-scatter.py:49-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 all 8 call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (5–6 lines × 2) · ×2
  • Duplicated block (5–6 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:180 — src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:180-185 | src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:3460-3464 — 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.
  • Duplicated block (5–6 lines × 2) src/officecli/Handlers/WordHandler.cs:714 — src/officecli/Handlers/WordHandler.cs:714-718 | src/officecli/Handlers/WordHandler.cs:946-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. The matched lines also transfer control out of the body holding them, 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.
IC1 · Incompleteness & stubs · Both branches open with the same statements · ×2
  • Both branches open with the same statements — the condition does not decide them src/officecli/Core/Formula/FormulaEvaluator.Helpers.cs:774 — The first 1 statement of the `if` and of the `else` are identical, so it runs on both paths regardless of the condition. Lift it above the `if` — leaving it duplicated inside makes the branches read as though they handled this differently.
  • Both branches open with the same statements — the condition does not decide them src/officecli/Core/PivotTableHelper.Set.cs:231 — The first 2 statements of the `if` and of the `else` are identical, so they run on both paths regardless of the condition. Lift them above the `if` — leaving them duplicated inside makes the branches read as though they handled this differently.
R10 · Code Duplication · Duplicated block (5 lines × 2 locations) · ×2
  • Duplicated block (5 lines × 2 locations) src/officecli/Resources/watch-overlay.js:669 — src/officecli/Resources/watch-overlay.js:669 · src/officecli/Resources/watch-overlay.js:674 — both copies are in the same file, so extract the 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 locations) src/officecli/Resources/watch-sse-core.js:61 — src/officecli/Resources/watch-sse-core.js:61 · src/officecli/Resources/watch-sse-core.js:66 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
X18 · Disposal-pattern correctness · Owned disposable field is never released · ×2
  • Owned disposable field is never released src/officecli/Core/Watch/WatchServer.cs:31 — `WatchServer` implements `IDisposable` — so it has told every caller it holds something worth releasing — and it constructs `_tcpListener` itself (line 31), which makes that instance its own. But `_tcpListener` is named in none of the methods the disposal search covered: `Dispose` (line 3040), `StopAsync` (line 455) — that is `Dispose` plus every method `Dispose` calls BY NAME, so a release reached through an interface, a delegate or a base class is not followed and is worth checking before acting. On what was read, the type's disposal releases everything except the one thing it owns. A disposable the owner never disposes is held until finalization if its type has a finalizer, and forever if it does not — which for a synchronisation primitive, a timer, a stream or a handle means the resource accumulates once per instance for the life of the process. Release it in `Dispose` (`_tcpListener?.Dispose();`), or, if it truly does not need releasing, drop `IDisposable` from the type so the claim and the behaviour agree.
  • Owned disposable field is never released src/officecli/Core/Watch/WatchServer.cs:55 — `WatchServer` implements `IDisposable` — so it has told every caller it holds something worth releasing — and it constructs `_switchLock` itself (line 55), which makes that instance its own. But `_switchLock` is named in none of the methods the disposal search covered: `Dispose` (line 3040), `StopAsync` (line 455) — that is `Dispose` plus every method `Dispose` calls BY NAME, so a release reached through an interface, a delegate or a base class is not followed and is worth checking before acting. On what was read, the type's disposal releases everything except the one thing it owns. A disposable the owner never disposes is held until finalization if its type has a finalizer, and forever if it does not — which for a synchronisation primitive, a timer, a stream or a handle means the resource accumulates once per instance for the life of the process. Release it in `Dispose` (`_switchLock?.Dispose();`), or, if it truly does not need releasing, drop `IDisposable` from the type so the claim and the behaviour agree.
AX5 · Architecture & structure · Appears unstructured (no recognised architecture) · ×1
  • Appears unstructured (no recognised architecture) — ~264.1k production LoC (529 types) across 1 project(s) / 30 namespace(s) with no recognised architectural style or layering — at this size, deliberate module boundaries would help. No DDD/clean/vertical-slice/CQRS/transaction-script organisation was detected — code is likely organised ad hoc, which makes change and onboarding harder as it grows.
D1 · Cyclomatic Complexity · ChartHelper.SetChartProperties (cyclomatic 809) · ×1
  • ChartHelper.SetChartProperties (cyclomatic 809) src/officecli/Core/Chart/ChartHelper.Setter.cs:219 — ChartHelper.SetChartProperties has cyclomatic complexity 809 (threshold 15). Of this number, 788 points are the body's own statements and 21 belong to 12 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 · PowerPointHandler.SetRunOrShapeProperties (cyclomatic 565) · ×1
  • PowerPointHandler.SetRunOrShapeProperties (cyclomatic 565) src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:165 — PowerPointHandler.SetRunOrShapeProperties has cyclomatic complexity 565 (threshold 15). Of this number, 560 points are the body's own statements and 5 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 · FormulaEvaluator.EvalFunction (cyclomatic 554) · ×1
  • FormulaEvaluator.EvalFunction (cyclomatic 554) src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:13 — FormulaEvaluator.EvalFunction has cyclomatic complexity 554 (threshold 15). Of this number, 538 points are the body's own statements and 16 belong to 8 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 · WordHandler.AddParagraph (cyclomatic 541) · ×1
  • WordHandler.AddParagraph (cyclomatic 541) src/officecli/Handlers/Word/WordHandler.Add.Text.cs:13 — WordHandler.AddParagraph has cyclomatic complexity 541 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.ParagraphToNode (cyclomatic 468) · ×1
  • WordHandler.ParagraphToNode (cyclomatic 468) src/officecli/Handlers/Word/WordHandler.Navigation.cs:4006 — WordHandler.ParagraphToNode has cyclomatic complexity 468 (threshold 15). Of this number, 442 points are the body's own statements and 26 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 · PowerPointHandler.AddPartCore (cyclomatic 461) · ×1
  • PowerPointHandler.AddPartCore (cyclomatic 461) REDACTED:744 — PowerPointHandler.AddPartCore has cyclomatic complexity 461 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.QueryDispatch (cyclomatic 401) · ×1
  • WordHandler.QueryDispatch (cyclomatic 401) src/officecli/Handlers/Word/WordHandler.Query.cs:1742 — WordHandler.QueryDispatch has cyclomatic complexity 401 (threshold 15). Of this number, 393 points are the body's own statements and 8 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 · ChartHelper.ReadChartProperties (cyclomatic 399) · ×1
  • ChartHelper.ReadChartProperties (cyclomatic 399) src/officecli/Core/Chart/ChartHelper.Reader.cs:31 — ChartHelper.ReadChartProperties has cyclomatic complexity 399 (threshold 15). Of this number, 375 points are the body's own statements and 24 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 · PowerPointHandler.Get (cyclomatic 399) · ×1
  • PowerPointHandler.Get (cyclomatic 399) REDACTED:18 — PowerPointHandler.Get has cyclomatic complexity 399 (threshold 15). Of this number, 396 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 · PowerPointHandler.ShapeToNode (cyclomatic 350) · ×1
  • PowerPointHandler.ShapeToNode (cyclomatic 350) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:866 — PowerPointHandler.ShapeToNode has cyclomatic complexity 350 (threshold 15). Of this number, 344 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 · WordHandler.AddRun (cyclomatic 308) · ×1
  • WordHandler.AddRun (cyclomatic 308) src/officecli/Handlers/Word/WordHandler.Add.Text.cs:2193 — WordHandler.AddRun has cyclomatic complexity 308 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FormulaParser.ParseCommand (cyclomatic 304) · ×1
  • FormulaParser.ParseCommand (cyclomatic 304) src/officecli/Core/Formula/FormulaParser.cs:1284 — FormulaParser.ParseCommand has cyclomatic complexity 304 (threshold 15). Of this number, 300 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PowerPointHandler.SetTableCellProperties (cyclomatic 282) · ×1
  • PowerPointHandler.SetTableCellProperties (cyclomatic 282) src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:2716 — PowerPointHandler.SetTableCellProperties has cyclomatic complexity 282 (threshold 15). Of this number, 280 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 · ExcelHandler.SetSheetLevel (cyclomatic 252) · ×1
  • ExcelHandler.SetSheetLevel (cyclomatic 252) src/officecli/Handlers/Excel/ExcelHandler.Set.Sheet.cs:31 — ExcelHandler.SetSheetLevel has cyclomatic complexity 252 (threshold 15). Of this number, 242 points are the body's own statements and 10 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 · PowerPointHandler.AddShape (cyclomatic 247) · ×1
  • PowerPointHandler.AddShape (cyclomatic 247) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Shape.cs:15 — PowerPointHandler.AddShape has cyclomatic complexity 247 (threshold 15). Of this number, 236 points are the body's own statements and 11 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 · ChartSvgRenderer.RenderBarChartSvg (cyclomatic 241) · ×1
  • ChartSvgRenderer.RenderBarChartSvg (cyclomatic 241) src/officecli/Core/Chart/ChartSvgRenderer.cs:310 — ChartSvgRenderer.RenderBarChartSvg has cyclomatic complexity 241 (threshold 15). Of this number, 239 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 · ExcelHandler.Get (cyclomatic 228) · ×1
  • ExcelHandler.Get (cyclomatic 228) src/officecli/Handlers/Excel/ExcelHandler.Query.cs:16 — ExcelHandler.Get has cyclomatic complexity 228 (threshold 15). Of this number, 221 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 · WordHandler.Get (cyclomatic 225) · ×1
  • WordHandler.Get (cyclomatic 225) src/officecli/Handlers/Word/WordHandler.Query.cs:95 — WordHandler.Get has cyclomatic complexity 225 (threshold 15). Of this number, 224 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 · ChartSvgRenderer.ExtractChartInfo (cyclomatic 210) · ×1
  • ChartSvgRenderer.ExtractChartInfo (cyclomatic 210) src/officecli/Core/Chart/ChartSvgRenderer.cs:3388 — ChartSvgRenderer.ExtractChartInfo has cyclomatic complexity 210 (threshold 15). Of this number, 205 points are the body's own statements and 5 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 · ExcelHandler.QueryDispatch (cyclomatic 205) · ×1
  • ExcelHandler.QueryDispatch (cyclomatic 205) src/officecli/Handlers/Excel/ExcelHandler.Query.cs:1192 — ExcelHandler.QueryDispatch has cyclomatic complexity 205 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.ApplyRunFormatting (cyclomatic 205) · ×1
  • WordHandler.ApplyRunFormatting (cyclomatic 205) src/officecli/Handlers/Word/WordHandler.Helpers.RunFormat.cs:572 — WordHandler.ApplyRunFormatting has cyclomatic complexity 205 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PowerPointHandler.PresetGeometryToCss (cyclomatic 201) · ×1
  • PowerPointHandler.PresetGeometryToCss (cyclomatic 201) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2384 — PowerPointHandler.PresetGeometryToCss has cyclomatic complexity 201 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · PowerPointHandler.QueryDispatch (cyclomatic 198) · ×1
  • PowerPointHandler.QueryDispatch (cyclomatic 198) REDACTED:1545 — PowerPointHandler.QueryDispatch has cyclomatic complexity 198 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.RemoveCore (cyclomatic 193) · ×1
  • WordHandler.RemoveCore (cyclomatic 193) src/officecli/Handlers/Word/WordHandler.Mutations.cs:21 — WordHandler.RemoveCore has cyclomatic complexity 193 (threshold 15). Of this number, 182 points are the body's own statements and 11 belong to 11 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 · ExcelHandler.RemoveCore (cyclomatic 190) · ×1
  • ExcelHandler.RemoveCore (cyclomatic 190) src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:20 — ExcelHandler.RemoveCore has cyclomatic complexity 190 (threshold 15). Of this number, 188 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 · WordHandler.RunToNode (cyclomatic 188) · ×1
  • WordHandler.RunToNode (cyclomatic 188) src/officecli/Handlers/Word/WordHandler.Navigation.cs:2243 — WordHandler.RunToNode has cyclomatic complexity 188 (threshold 15). Of this number, 184 points are the body's own statements and 4 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 · PowerPointHandler.RenderShape (cyclomatic 181) · ×1
  • PowerPointHandler.RenderShape (cyclomatic 181) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:21 — PowerPointHandler.RenderShape has cyclomatic complexity 181 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.NavigateToElement (cyclomatic 180) · ×1
  • WordHandler.NavigateToElement (cyclomatic 180) src/officecli/Handlers/Word/WordHandler.Navigation.cs:1184 — WordHandler.NavigateToElement has cyclomatic complexity 180 (threshold 15). Of this number, 162 points are the body's own statements and 18 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 · PowerPointHandler.AddConnector (cyclomatic 171) · ×1
  • PowerPointHandler.AddConnector (cyclomatic 171) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:17 — PowerPointHandler.AddConnector has cyclomatic complexity 171 (threshold 15). Of this number, 167 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · WordHandler.AddStyle (cyclomatic 168) · ×1
  • WordHandler.AddStyle (cyclomatic 168) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:1143 — WordHandler.AddStyle has cyclomatic complexity 168 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.AddTable (cyclomatic 168) · ×1
  • WordHandler.AddTable (cyclomatic 168) src/officecli/Handlers/Word/WordHandler.Add.Table.cs:45 — WordHandler.AddTable has cyclomatic complexity 168 (threshold 15). Of this number, 166 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 · WordBatchEmitter.EmitTable (cyclomatic 167) · ×1
  • WordBatchEmitter.EmitTable (cyclomatic 167) src/officecli/Handlers/Word/WordBatchEmitter.Table.cs:102 — WordBatchEmitter.EmitTable has cyclomatic complexity 167 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChartHelper.SetAxisProperties (cyclomatic 164) · ×1
  • ChartHelper.SetAxisProperties (cyclomatic 164) src/officecli/Core/Chart/ChartHelper.Axis.cs:248 — ChartHelper.SetAxisProperties has cyclomatic complexity 164 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.RenderBodyHtml (cyclomatic 164) · ×1
  • WordHandler.RenderBodyHtml (cyclomatic 164) REDACTED:2465 — WordHandler.RenderBodyHtml has cyclomatic complexity 164 (threshold 15). Of this number, 163 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 · CommandBuilder.BuildViewCommand (cyclomatic 163) · ×1
  • CommandBuilder.BuildViewCommand (cyclomatic 163) src/officecli/CommandBuilder.View.cs:12 — CommandBuilder.BuildViewCommand has cyclomatic complexity 163 (threshold 15). Most of this is not in the body itself: 1 of the 163 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 57, 116). 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 · WordHandler.RenderTableHtml (cyclomatic 163) · ×1
  • WordHandler.RenderTableHtml (cyclomatic 163) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Tables.cs:26 — WordHandler.RenderTableHtml has cyclomatic complexity 163 (threshold 15). Of this number, 150 points are the body's own statements and 13 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 · PivotTableHelper.RenderGeneralPivot (cyclomatic 162) · ×1
  • PivotTableHelper.RenderGeneralPivot (cyclomatic 162) src/officecli/Core/PivotTableHelper.Render.cs:1754 — PivotTableHelper.RenderGeneralPivot has cyclomatic complexity 162 (threshold 15). Of this number, 159 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 · PowerPointHandler.AddPicture (cyclomatic 160) · ×1
  • PowerPointHandler.AddPicture (cyclomatic 160) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:16 — PowerPointHandler.AddPicture has cyclomatic complexity 160 (threshold 15). Of this number, 158 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 · ExcelHandler.ApplySheetRangeMutations (cyclomatic 158) · ×1
  • ExcelHandler.ApplySheetRangeMutations (cyclomatic 158) src/officecli/Handlers/Excel/ExcelHandler.SheetShift.cs:67 — ExcelHandler.ApplySheetRangeMutations has cyclomatic complexity 158 (threshold 15). Of this number, 156 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 · WordHandler.AddSection (cyclomatic 158) · ×1
  • WordHandler.AddSection (cyclomatic 158) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:79 — WordHandler.AddSection has cyclomatic complexity 158 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExcelHandler.CellToNode (cyclomatic 155) · ×1
  • ExcelHandler.CellToNode (cyclomatic 155) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Node.cs:295 — ExcelHandler.CellToNode 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 · ExcelHandler.ApplyCellProperties (cyclomatic 151) · ×1
  • ExcelHandler.ApplyCellProperties (cyclomatic 151) src/officecli/Handlers/Excel/ExcelHandler.Set.Cells.cs:90 — ExcelHandler.ApplyCellProperties has cyclomatic complexity 151 (threshold 15). Of this number, 147 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 · WordHandler.GetParagraphInlineCss (cyclomatic 147) · ×1
  • WordHandler.GetParagraphInlineCss (cyclomatic 147) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:336 — WordHandler.GetParagraphInlineCss has cyclomatic complexity 147 (threshold 15). Of this number, 142 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 · WordHandler.SetElementTableCell (cyclomatic 147) · ×1
  • WordHandler.SetElementTableCell (cyclomatic 147) src/officecli/Handlers/Word/WordHandler.Set.Element.cs:1897 — WordHandler.SetElementTableCell has cyclomatic complexity 147 (threshold 15). Of this number, 144 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 · PowerPointHandler.AddRun (cyclomatic 146) · ×1
  • PowerPointHandler.AddRun (cyclomatic 146) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Text.cs:594 — PowerPointHandler.AddRun has cyclomatic complexity 146 (threshold 15). Of this number, 143 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 · PowerPointHandler.RemoveCore (cyclomatic 140) · ×1
  • PowerPointHandler.RemoveCore (cyclomatic 140) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:19 — PowerPointHandler.RemoveCore has cyclomatic complexity 140 (threshold 15). Of this number, 139 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 · PowerPointHandler.ViewAsIssues (cyclomatic 138) · ×1
  • PowerPointHandler.ViewAsIssues (cyclomatic 138) src/officecli/Handlers/Pptx/PowerPointHandler.View.cs:523 — PowerPointHandler.ViewAsIssues has cyclomatic complexity 138 (threshold 15). Of this number, 135 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 · WordHandler.SetElementTable (cyclomatic 136) · ×1
  • WordHandler.SetElementTable (cyclomatic 136) src/officecli/Handlers/Word/WordHandler.Set.Element.cs:2785 — WordHandler.SetElementTable has cyclomatic complexity 136 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.RenderRunHtml (cyclomatic 135) · ×1
  • WordHandler.RenderRunHtml (cyclomatic 135) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Text.cs:769 — WordHandler.RenderRunHtml has cyclomatic complexity 135 (threshold 15). Of this number, 124 points are the body's own statements and 11 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 · WordHandler.AddField (cyclomatic 134) · ×1
  • WordHandler.AddField (cyclomatic 134) src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:1334 — WordHandler.AddField has cyclomatic complexity 134 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · ChartExBuilder.HandleSetKey (cyclomatic 131) · ×1
  • ChartExBuilder.HandleSetKey (cyclomatic 131) src/officecli/Core/Chart/ChartExBuilder.Setter.cs:72 — ChartExBuilder.HandleSetKey has cyclomatic complexity 131 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChartSvgRenderer.RenderLineChartSvg (cyclomatic 129) · ×1
  • ChartSvgRenderer.RenderLineChartSvg (cyclomatic 129) src/officecli/Core/Chart/ChartSvgRenderer.cs:1325 — ChartSvgRenderer.RenderLineChartSvg has cyclomatic complexity 129 (threshold 15). Of this number, 128 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 · PowerPointHandler.RenderTextBody (cyclomatic 129) · ×1
  • PowerPointHandler.RenderTextBody (cyclomatic 129) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Text.cs:17 — PowerPointHandler.RenderTextBody has cyclomatic complexity 129 (threshold 15). Of this number, 125 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 · WordHandler.TrySetSectionLayout (cyclomatic 129) · ×1
  • WordHandler.TrySetSectionLayout (cyclomatic 129) src/officecli/Handlers/Word/WordHandler.Set.SectionLayout.cs:17 — WordHandler.TrySetSectionLayout has cyclomatic complexity 129 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CommandBuilder.ExecuteBatchItem (cyclomatic 126) · ×1
  • CommandBuilder.ExecuteBatchItem (cyclomatic 126) src/officecli/CommandBuilder.cs:945 — CommandBuilder.ExecuteBatchItem has cyclomatic complexity 126 (threshold 15). Of this number, 125 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 · WordHandler.SetElementRun (cyclomatic 124) · ×1
  • WordHandler.SetElementRun (cyclomatic 124) src/officecli/Handlers/Word/WordHandler.Set.Element.cs:311 — WordHandler.SetElementRun has cyclomatic complexity 124 (threshold 15). Of this number, 122 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 · WordHandler.AddPicture (cyclomatic 122) · ×1
  • WordHandler.AddPicture (cyclomatic 122) src/officecli/Handlers/Word/WordHandler.Add.Media.cs:302 — WordHandler.AddPicture has cyclomatic complexity 122 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExcelHandler.AddTable (cyclomatic 121) · ×1
  • ExcelHandler.AddTable (cyclomatic 121) src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs:1058 — ExcelHandler.AddTable has cyclomatic complexity 121 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.GetRunInlineCss (cyclomatic 120) · ×1
  • WordHandler.GetRunInlineCss (cyclomatic 120) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:1578 — WordHandler.GetRunInlineCss has cyclomatic complexity 120 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ResidentServer.ExecuteView (cyclomatic 119) · ×1
  • ResidentServer.ExecuteView (cyclomatic 119) src/officecli/ResidentServer.cs:1521 — ResidentServer.ExecuteView has cyclomatic complexity 119 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.ApplyParagraphLevelProperty (cyclomatic 117) · ×1
  • WordHandler.ApplyParagraphLevelProperty (cyclomatic 117) src/officecli/Handlers/Word/WordHandler.Set.cs:1156 — WordHandler.ApplyParagraphLevelProperty has cyclomatic complexity 117 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PowerPointHandler.ApplyPicturePropertiesCore (cyclomatic 116) · ×1
  • PowerPointHandler.ApplyPicturePropertiesCore (cyclomatic 116) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:45 — PowerPointHandler.ApplyPicturePropertiesCore has cyclomatic complexity 116 (threshold 15). Of this number, 115 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 · PowerPointHandler.ApplyConnectorProps (cyclomatic 115) · ×1
  • PowerPointHandler.ApplyConnectorProps (cyclomatic 115) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:840 — PowerPointHandler.ApplyConnectorProps has cyclomatic complexity 115 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.SetElementParagraph (cyclomatic 115) · ×1
  • WordHandler.SetElementParagraph (cyclomatic 115) src/officecli/Handlers/Word/WordHandler.Set.Element.cs:1281 — WordHandler.SetElementParagraph has cyclomatic complexity 115 (threshold 15). Of this number, 114 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 · FormulaParser.ToLatexByName (cyclomatic 114) · ×1
  • FormulaParser.ToLatexByName (cyclomatic 114) src/officecli/Core/Formula/FormulaParser.cs:318 — FormulaParser.ToLatexByName has cyclomatic complexity 114 (threshold 15). Of this number, 112 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. This is NOT this file's highest cyclomatic complexity: FormulaParser.CommandToSymbol (cyclomatic 213) 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 · PivotTableHelper.SetPivotTableProperties (cyclomatic 114) · ×1
  • PivotTableHelper.SetPivotTableProperties (cyclomatic 114) src/officecli/Core/PivotTableHelper.Set.cs:13 — PivotTableHelper.SetPivotTableProperties has cyclomatic complexity 114 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PowerPointHandler.PictureToNode (cyclomatic 114) · ×1
  • PowerPointHandler.PictureToNode (cyclomatic 114) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2603 — PowerPointHandler.PictureToNode has cyclomatic complexity 114 (threshold 15). Of this number, 113 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 · WordBatchEmitter.FilterEmittableProps (cyclomatic 114) · ×1
  • WordBatchEmitter.FilterEmittableProps (cyclomatic 114) src/officecli/Handlers/Word/WordBatchEmitter.Filters.cs:138 — WordBatchEmitter.FilterEmittableProps has cyclomatic complexity 114 (threshold 15). Of this number, 111 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 · WordBatchEmitter.TryEmitFieldRun (cyclomatic 114) · ×1
  • WordBatchEmitter.TryEmitFieldRun (cyclomatic 114) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:2183 — WordBatchEmitter.TryEmitFieldRun has cyclomatic complexity 114 (threshold 15). Of this number, 113 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 · PowerPointHandler.RenderPicture (cyclomatic 112) · ×1
  • PowerPointHandler.RenderPicture (cyclomatic 112) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:1278 — PowerPointHandler.RenderPicture has cyclomatic complexity 112 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.BeginTrackChangeIfRequested (cyclomatic 112) · ×1
  • WordHandler.BeginTrackChangeIfRequested (cyclomatic 112) src/officecli/Handlers/Word/WordHandler.Set.Revision.cs:106 — WordHandler.BeginTrackChangeIfRequested has cyclomatic complexity 112 (threshold 15). Of this number, 87 points are the body's own statements and 25 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 · PowerPointHandler.RenderRun (cyclomatic 109) · ×1
  • PowerPointHandler.RenderRun (cyclomatic 109) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Text.cs:804 — PowerPointHandler.RenderRun has cyclomatic complexity 109 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExcelHandler.RenderSheetTable (cyclomatic 106) · ×1
  • ExcelHandler.RenderSheetTable (cyclomatic 106) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:318 — ExcelHandler.RenderSheetTable has cyclomatic complexity 106 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PowerPointHandler.TableToNode (cyclomatic 105) · ×1
  • PowerPointHandler.TableToNode (cyclomatic 105) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:388 — PowerPointHandler.TableToNode has cyclomatic complexity 105 (threshold 15). Of this number, 104 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 · WordBatchEmitter.CollapseFieldChains (cyclomatic 105) · ×1
  • WordBatchEmitter.CollapseFieldChains (cyclomatic 105) src/officecli/Handlers/Word/WordBatchEmitter.Fields.cs:199 — WordBatchEmitter.CollapseFieldChains has cyclomatic complexity 105 (threshold 15). Of this number, 103 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 · ExcelHandler.ViewAsIssues (cyclomatic 102) · ×1
  • ExcelHandler.ViewAsIssues (cyclomatic 102) src/officecli/Handlers/Excel/ExcelHandler.View.cs:531 — ExcelHandler.ViewAsIssues has cyclomatic complexity 102 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.SetSectionPath (cyclomatic 102) · ×1
  • WordHandler.SetSectionPath (cyclomatic 102) src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs:808 — WordHandler.SetSectionPath has cyclomatic complexity 102 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CommandBuilder.BuildSetCommand (cyclomatic 101) · ×1
  • CommandBuilder.BuildSetCommand (cyclomatic 101) src/officecli/CommandBuilder.Set.cs:12 — CommandBuilder.BuildSetCommand has cyclomatic complexity 101 (threshold 15). Most of this is not in the body itself: 1 of the 101 points is its own statement and the rest belongs to one function literal inside it that branches (line 32). 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 · WordHandler.TableToNode (cyclomatic 101) · ×1
  • WordHandler.TableToNode (cyclomatic 101) src/officecli/Handlers/Word/WordHandler.Navigation.cs:3175 — WordHandler.TableToNode has cyclomatic complexity 101 (threshold 15). Of this number, 98 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 · WordBatchEmitter.EmitParagraph (cyclomatic 100) · ×1
  • WordBatchEmitter.EmitParagraph (cyclomatic 100) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:50 — WordBatchEmitter.EmitParagraph has cyclomatic complexity 100 (threshold 15). Of this number, 65 points are the body's own statements and 35 belong to 9 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 · PowerPointHandler.SetCore (cyclomatic 97) · ×1
  • PowerPointHandler.SetCore (cyclomatic 97) src/officecli/Handlers/Pptx/PowerPointHandler.Set.cs:18 — PowerPointHandler.SetCore has cyclomatic complexity 97 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PivotTableHelper.RenderMatrixPivot (cyclomatic 94) · ×1
  • PivotTableHelper.RenderMatrixPivot (cyclomatic 94) src/officecli/Core/PivotTableHelper.Render.cs:1293 — PivotTableHelper.RenderMatrixPivot has cyclomatic complexity 94 (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 · PowerPointHandler.AddParagraph (cyclomatic 94) · ×1
  • PowerPointHandler.AddParagraph (cyclomatic 94) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Text.cs:168 — PowerPointHandler.AddParagraph has cyclomatic complexity 94 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChartSvgRenderer.RenderAreaChartSvg (cyclomatic 93) · ×1
  • ChartSvgRenderer.RenderAreaChartSvg (cyclomatic 93) src/officecli/Core/Chart/ChartSvgRenderer.cs:2053 — ChartSvgRenderer.RenderAreaChartSvg has cyclomatic complexity 93 (threshold 15). Of this number, 92 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 · FormulaEvaluator.Tokenize (cyclomatic 93) · ×1
  • FormulaEvaluator.Tokenize (cyclomatic 93) src/officecli/Core/Formula/FormulaEvaluator.cs:400 — FormulaEvaluator.Tokenize has cyclomatic complexity 93 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.ReadCellProps (cyclomatic 93) · ×1
  • WordHandler.ReadCellProps (cyclomatic 93) src/officecli/Handlers/Word/WordHandler.Navigation.cs:6555 — WordHandler.ReadCellProps has cyclomatic complexity 93 (threshold 15). Of this number, 92 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 · WordHandler.GetRootNode (cyclomatic 91) · ×1
  • WordHandler.GetRootNode (cyclomatic 91) src/officecli/Handlers/Word/WordHandler.Navigation.cs:118 — WordHandler.GetRootNode has cyclomatic complexity 91 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChartSvgRenderer.RenderChartSvgContent (cyclomatic 90) · ×1
  • ChartSvgRenderer.RenderChartSvgContent (cyclomatic 90) src/officecli/Core/Chart/ChartSvgRenderer.cs:4584 — ChartSvgRenderer.RenderChartSvgContent has cyclomatic complexity 90 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PivotTableHelper.RenderPivotIntoSheetCore (cyclomatic 90) · ×1
  • PivotTableHelper.RenderPivotIntoSheetCore (cyclomatic 90) src/officecli/Core/PivotTableHelper.Render.cs:100 — PivotTableHelper.RenderPivotIntoSheetCore has cyclomatic complexity 90 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.AddCell (cyclomatic 90) · ×1
  • WordHandler.AddCell (cyclomatic 90) src/officecli/Handlers/Word/WordHandler.Add.Table.cs:1196 — WordHandler.AddCell 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 · WordHandler.SetCore (cyclomatic 90) · ×1
  • WordHandler.SetCore (cyclomatic 90) src/officecli/Handlers/Word/WordHandler.Set.cs:73 — WordHandler.SetCore has cyclomatic complexity 90 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.AddFormField (cyclomatic 88) · ×1
  • WordHandler.AddFormField (cyclomatic 88) src/officecli/Handlers/Word/WordHandler.FormFields.cs:293 — WordHandler.AddFormField has cyclomatic complexity 88 (threshold 15). Of this number, 85 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 · ExcelHandler.AddShape (cyclomatic 87) · ×1
  • ExcelHandler.AddShape (cyclomatic 87) src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:570 — ExcelHandler.AddShape has cyclomatic complexity 87 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PowerPointHandler.ApplyTransition (cyclomatic 87) · ×1
  • PowerPointHandler.ApplyTransition (cyclomatic 87) src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:323 — PowerPointHandler.ApplyTransition has cyclomatic complexity 87 (threshold 15). 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, 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 · WordHandler.SetStylePath (cyclomatic 87) · ×1
  • WordHandler.SetStylePath (cyclomatic 87) src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs:1647 — WordHandler.SetStylePath has cyclomatic complexity 87 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChartHelper.HandleSeriesDottedProperty (cyclomatic 86) · ×1
  • ChartHelper.HandleSeriesDottedProperty (cyclomatic 86) src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:686 — ChartHelper.HandleSeriesDottedProperty has cyclomatic complexity 86 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PowerPointHandler.RenderConnector (cyclomatic 85) · ×1
  • PowerPointHandler.RenderConnector (cyclomatic 85) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:1783 — PowerPointHandler.RenderConnector has cyclomatic complexity 85 (threshold 15). Of this number, 81 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SchemaHelpRenderer.RenderHuman (cyclomatic 83) · ×1
  • SchemaHelpRenderer.RenderHuman (cyclomatic 83) src/officecli/Help/SchemaHelpRenderer.cs:33 — SchemaHelpRenderer.RenderHuman has cyclomatic complexity 83 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChartHelper.BuildChartSpace (cyclomatic 82) · ×1
  • ChartHelper.BuildChartSpace (cyclomatic 82) src/officecli/Core/Chart/ChartHelper.Builder.cs:14 — ChartHelper.BuildChartSpace has cyclomatic complexity 82 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExcelHandler.GetShapeNode (cyclomatic 82) · ×1
  • ExcelHandler.GetShapeNode (cyclomatic 82) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:618 — ExcelHandler.GetShapeNode has cyclomatic complexity 82 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PowerPointHandler.RenderTable (cyclomatic 82) · ×1
  • PowerPointHandler.RenderTable (cyclomatic 82) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Tables.cs:18 — PowerPointHandler.RenderTable has cyclomatic complexity 82 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.AddComment (cyclomatic 82) · ×1
  • WordHandler.AddComment (cyclomatic 82) src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:13 — WordHandler.AddComment has cyclomatic complexity 82 (threshold 15). Of this number, 75 points are the body's own statements and 7 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.ResolveParagraphStyleCss (cyclomatic 82) · ×1
  • WordHandler.ResolveParagraphStyleCss (cyclomatic 82) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:1286 — WordHandler.ResolveParagraphStyleCss has cyclomatic complexity 82 (threshold 15). Of this number, 81 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 · ExcelStyleManager.ApplyStyle (cyclomatic 81) · ×1
  • ExcelStyleManager.ApplyStyle (cyclomatic 81) src/officecli/Core/ExcelStyleManager.cs:74 — ExcelStyleManager.ApplyStyle has cyclomatic complexity 81 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.AddEquation (cyclomatic 81) · ×1
  • WordHandler.AddEquation (cyclomatic 81) src/officecli/Handlers/Word/WordHandler.Add.Text.cs:1816 — WordHandler.AddEquation has cyclomatic complexity 81 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.ProcessFindInParagraph (cyclomatic 80) · ×1
  • WordHandler.ProcessFindInParagraph (cyclomatic 80) src/officecli/Handlers/Word/WordHandler.Helpers.FindReplace.cs:434 — WordHandler.ProcessFindInParagraph has cyclomatic complexity 80 (threshold 15). Of this number, 78 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 · WordHandler.SetFieldPath (cyclomatic 80) · ×1
  • WordHandler.SetFieldPath (cyclomatic 80) src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs:178 — WordHandler.SetFieldPath has cyclomatic complexity 80 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExcelHandler.EvaluateCfRule (cyclomatic 79) · ×1
  • ExcelHandler.EvaluateCfRule (cyclomatic 79) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:1715 — ExcelHandler.EvaluateCfRule has cyclomatic complexity 79 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.ValidateParentChild (cyclomatic 79) · ×1
  • WordHandler.ValidateParentChild (cyclomatic 79) src/officecli/Handlers/Word/WordHandler.Add.cs:353 — WordHandler.ValidateParentChild has cyclomatic complexity 79 (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 · WordHandler.BuildSectionNode (cyclomatic 79) · ×1
  • WordHandler.BuildSectionNode (cyclomatic 79) src/officecli/Handlers/Word/WordHandler.Query.cs:980 — WordHandler.BuildSectionNode has cyclomatic complexity 79 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.ViewAsIssues (cyclomatic 78) · ×1
  • WordHandler.ViewAsIssues (cyclomatic 78) src/officecli/Handlers/Word/WordHandler.View.cs:1174 — WordHandler.ViewAsIssues has cyclomatic complexity 78 (threshold 15). Of this number, 77 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 · PivotTableHelper.RebuildFieldAreas (cyclomatic 77) · ×1
  • PivotTableHelper.RebuildFieldAreas (cyclomatic 77) src/officecli/Core/PivotTableHelper.Set.cs:405 — PivotTableHelper.RebuildFieldAreas has cyclomatic complexity 77 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExcelHandler.ApplyNumberFormatCore (cyclomatic 76) · ×1
  • ExcelHandler.ApplyNumberFormatCore (cyclomatic 76) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:3486 — ExcelHandler.ApplyNumberFormatCore has cyclomatic complexity 76 (threshold 15). Of this number, 72 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 · WordHandler.RenderParagraphContentHtml (cyclomatic 76) · ×1
  • WordHandler.RenderParagraphContentHtml (cyclomatic 76) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Text.cs:412 — WordHandler.RenderParagraphContentHtml has cyclomatic complexity 76 (threshold 15). Of this number, 75 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 · PivotTableHelper.ReadPivotTableProperties (cyclomatic 74) · ×1
  • PivotTableHelper.ReadPivotTableProperties (cyclomatic 74) src/officecli/Core/PivotTableHelper.Readback.cs:15 — PivotTableHelper.ReadPivotTableProperties has cyclomatic complexity 74 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordBatchEmitter.TryEmitPictureRun (cyclomatic 74) · ×1
  • WordBatchEmitter.TryEmitPictureRun (cyclomatic 74) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:2665 — WordBatchEmitter.TryEmitPictureRun has cyclomatic complexity 74 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.ViewAsHtmlCore (cyclomatic 74) · ×1
  • WordHandler.ViewAsHtmlCore (cyclomatic 74) REDACTED:143 — WordHandler.ViewAsHtmlCore has cyclomatic complexity 74 (threshold 15). Of this number, 69 points are the body's own statements and 5 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 · CommandBuilder.BuildBatchCommand (cyclomatic 73) · ×1
  • CommandBuilder.BuildBatchCommand (cyclomatic 73) src/officecli/CommandBuilder.Batch.cs:175 — CommandBuilder.BuildBatchCommand has cyclomatic complexity 73 (threshold 15). Most of this is not in the body itself: 1 of the 73 points is its own statement and the rest belongs to one function literal inside it that branches (line 206). 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 · PivotTableHelper.CreatePivotTable (cyclomatic 73) · ×1
  • PivotTableHelper.CreatePivotTable (cyclomatic 73) src/officecli/Core/PivotTableHelper.cs:903 — PivotTableHelper.CreatePivotTable has cyclomatic complexity 73 (threshold 15). Of this number, 72 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 · ExcelHandler.Move (cyclomatic 73) · ×1
  • ExcelHandler.Move (cyclomatic 73) src/officecli/Handlers/Excel/ExcelHandler.Add.cs:170 — ExcelHandler.Move has cyclomatic complexity 73 (threshold 15). Of this number, 71 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 · PowerPointHandler.AddGroup (cyclomatic 73) · ×1
  • PowerPointHandler.AddGroup (cyclomatic 73) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:798 — PowerPointHandler.AddGroup has cyclomatic complexity 73 (threshold 15). Of this number, 52 points are the body's own statements and 21 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 · WordHandler.AddSdt (cyclomatic 73) · ×1
  • WordHandler.AddSdt (cyclomatic 73) src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:2190 — WordHandler.AddSdt has cyclomatic complexity 73 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MarkdownParser.ParseInlines (cyclomatic 72) · ×1
  • MarkdownParser.ParseInlines (cyclomatic 72) src/officecli/Core/Markdown/MarkdownParser.cs:630 — MarkdownParser.ParseInlines has cyclomatic complexity 72 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PptxBatchEmitter.EmitChart (cyclomatic 72) · ×1
  • PptxBatchEmitter.EmitChart (cyclomatic 72) src/officecli/Handlers/Pptx/PptxBatchEmitter.Charts.cs:17 — PptxBatchEmitter.EmitChart has cyclomatic complexity 72 (threshold 15). Of this number, 70 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 · WordHandler.GetTableCellInlineCss (cyclomatic 72) · ×1
  • WordHandler.GetTableCellInlineCss (cyclomatic 72) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:2248 — WordHandler.GetTableCellInlineCss has cyclomatic complexity 72 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExcelHandler.PopulateCfNodeFromRule (cyclomatic 71) · ×1
  • ExcelHandler.PopulateCfNodeFromRule (cyclomatic 71) src/officecli/Handlers/Excel/ExcelHandler.Query.Cf.cs:22 — ExcelHandler.PopulateCfNodeFromRule has cyclomatic complexity 71 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PowerPointHandler.AddPlaceholder (cyclomatic 71) · ×1
  • PowerPointHandler.AddPlaceholder (cyclomatic 71) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1184 — PowerPointHandler.AddPlaceholder has cyclomatic complexity 71 (threshold 15). Of this number, 68 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 · WordBatchEmitter.TryEmitTextbox (cyclomatic 71) · ×1
  • WordBatchEmitter.TryEmitTextbox (cyclomatic 71) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:3530 — WordBatchEmitter.TryEmitTextbox has cyclomatic complexity 71 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExcelHandler.SetTableByPath (cyclomatic 70) · ×1
  • ExcelHandler.SetTableByPath (cyclomatic 70) src/officecli/Handlers/Excel/ExcelHandler.Set.Tables.cs:371 — ExcelHandler.SetTableByPath has cyclomatic complexity 70 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PowerPointHandler.SetTablePropsCore (cyclomatic 69) · ×1
  • PowerPointHandler.SetTablePropsCore (cyclomatic 69) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Table.cs:228 — PowerPointHandler.SetTablePropsCore has cyclomatic complexity 69 (threshold 15). Of this number, 68 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 · WordHandler.AddCore (cyclomatic 69) · ×1
  • WordHandler.AddCore (cyclomatic 69) src/officecli/Handlers/Word/WordHandler.Add.cs:21 — WordHandler.AddCore has cyclomatic complexity 69 (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 · OutputFormatter.EnrichFromMessage (cyclomatic 68) · ×1
  • OutputFormatter.EnrichFromMessage (cyclomatic 68) src/officecli/Core/OutputFormatter.cs:317 — OutputFormatter.EnrichFromMessage has cyclomatic complexity 68 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PivotTableHelper.RenderMultiColPivot (cyclomatic 68) · ×1
  • PivotTableHelper.RenderMultiColPivot (cyclomatic 68) src/officecli/Core/PivotTableHelper.Render.cs:903 — PivotTableHelper.RenderMultiColPivot has cyclomatic complexity 68 (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 · ExcelHandler.SetCore (cyclomatic 68) · ×1
  • ExcelHandler.SetCore (cyclomatic 68) src/officecli/Handlers/Excel/ExcelHandler.Set.cs:39 — ExcelHandler.SetCore has cyclomatic complexity 68 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordBatchEmitter.BuildChartProps (cyclomatic 68) · ×1
  • WordBatchEmitter.BuildChartProps (cyclomatic 68) src/officecli/Handlers/Word/WordBatchEmitter.Charts.cs:9 — WordBatchEmitter.BuildChartProps has cyclomatic complexity 68 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.AddLvl (cyclomatic 68) · ×1
  • WordHandler.AddLvl (cyclomatic 68) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:2459 — WordHandler.AddLvl has cyclomatic complexity 68 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CommandBuilder.BuildAddCommand (cyclomatic 67) · ×1
  • CommandBuilder.BuildAddCommand (cyclomatic 67) src/officecli/CommandBuilder.Add.cs:13 — CommandBuilder.BuildAddCommand has cyclomatic complexity 67 (threshold 15). Most of this is not in the body itself: 1 of the 67 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 57, 28, 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 · ExcelHandler.SetShapeByPath (cyclomatic 66) · ×1
  • ExcelHandler.SetShapeByPath (cyclomatic 66) src/officecli/Handlers/Excel/ExcelHandler.Set.Drawings.cs:400 — ExcelHandler.SetShapeByPath 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 · ExcelHandler.RewriteSidecarRefsAfterSort (cyclomatic 65) · ×1
  • ExcelHandler.RewriteSidecarRefsAfterSort (cyclomatic 65) src/officecli/Handlers/Excel/ExcelHandler.Set.Ranges.cs:578 — ExcelHandler.RewriteSidecarRefsAfterSort 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 · ExcelHandler.SetCfByPath (cyclomatic 65) · ×1
  • ExcelHandler.SetCfByPath (cyclomatic 65) src/officecli/Handlers/Excel/ExcelHandler.Set.Tables.cs:826 — ExcelHandler.SetCfByPath 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 · ExcelHandler.TrySetWorkbookSetting (cyclomatic 65) · ×1
  • ExcelHandler.TrySetWorkbookSetting (cyclomatic 65) src/officecli/Handlers/Excel/ExcelHandler.Set.Workbook.cs:23 — ExcelHandler.TrySetWorkbookSetting 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 · PowerPointHandler.AddTable (cyclomatic 65) · ×1
  • PowerPointHandler.AddTable (cyclomatic 65) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Table.cs:17 — PowerPointHandler.AddTable has cyclomatic complexity 65 (threshold 15). Of this number, 63 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 · WordHandler.AddHyperlink (cyclomatic 65) · ×1
  • WordHandler.AddHyperlink (cyclomatic 65) src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:1002 — WordHandler.AddHyperlink has cyclomatic complexity 65 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · WordHandler.ResolveEffectiveParagraphStyleProperties (cyclomatic 65) · ×1
  • WordHandler.ResolveEffectiveParagraphStyleProperties (cyclomatic 65) src/officecli/Handlers/Word/WordHandler.StyleList.cs:527 — WordHandler.ResolveEffectiveParagraphStyleProperties 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 · ExcelHandler.SortRangeRows (cyclomatic 64) · ×1
  • ExcelHandler.SortRangeRows (cyclomatic 64) src/officecli/Handlers/Excel/ExcelHandler.Set.Ranges.cs:241 — ExcelHandler.SortRangeRows has cyclomatic complexity 64 (threshold 15). Of this number, 62 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 · PowerPointHandler.RenderShapeSvg (cyclomatic 64) · ×1
  • PowerPointHandler.RenderShapeSvg (cyclomatic 64) src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:256 — PowerPointHandler.RenderShapeSvg 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 · WordHandler.SetAbstractNumPath (cyclomatic 64) · ×1
  • WordHandler.SetAbstractNumPath (cyclomatic 64) src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs:1261 — WordHandler.SetAbstractNumPath 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 · PivotTableHelper.RenderMultiRowPivot (cyclomatic 63) · ×1
  • PivotTableHelper.RenderMultiRowPivot (cyclomatic 63) src/officecli/Core/PivotTableHelper.Render.cs:577 — PivotTableHelper.RenderMultiRowPivot has cyclomatic complexity 63 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExcelBatchEmitter.EmitSheet (cyclomatic 63) · ×1
  • ExcelBatchEmitter.EmitSheet (cyclomatic 63) src/officecli/Handlers/Excel/ExcelBatchEmitter.cs:325 — ExcelBatchEmitter.EmitSheet has cyclomatic complexity 63 (threshold 15). Of this number, 59 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 · PowerPointHandler.MoveCore (cyclomatic 63) · ×1
  • PowerPointHandler.MoveCore (cyclomatic 63) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:719 — PowerPointHandler.MoveCore has cyclomatic complexity 63 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PowerPointHandler.RunToNode (cyclomatic 63) · ×1
  • PowerPointHandler.RunToNode (cyclomatic 63) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2251 — PowerPointHandler.RunToNode has cyclomatic complexity 63 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PowerPointHandler.PopulateAnimationNode (cyclomatic 63) · ×1
  • PowerPointHandler.PopulateAnimationNode (cyclomatic 63) REDACTED:2468 — PowerPointHandler.PopulateAnimationNode has cyclomatic complexity 63 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordBatchEmitter.TryEmitInlineSectionBreak (cyclomatic 63) · ×1
  • WordBatchEmitter.TryEmitInlineSectionBreak (cyclomatic 63) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:691 — WordBatchEmitter.TryEmitInlineSectionBreak has cyclomatic complexity 63 (threshold 15). Of this number, 46 points are the body's own statements and 17 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 · ChartSvgRenderer.RenderBar3DSvg (cyclomatic 61) · ×1
  • ChartSvgRenderer.RenderBar3DSvg (cyclomatic 61) src/officecli/Core/Chart/ChartSvgRenderer.cs:5076 — ChartSvgRenderer.RenderBar3DSvg has cyclomatic complexity 61 (threshold 15). Of this number, 58 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 · ExcelHandler.AddCfExtended (cyclomatic 61) · ×1
  • ExcelHandler.AddCfExtended (cyclomatic 61) src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:631 — ExcelHandler.AddCfExtended has cyclomatic complexity 61 (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 · PowerPointHandler.ConnectorToNode (cyclomatic 61) · ×1
  • PowerPointHandler.ConnectorToNode (cyclomatic 61) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:3192 — PowerPointHandler.ConnectorToNode has cyclomatic complexity 61 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.AddBookmark (cyclomatic 61) · ×1
  • WordHandler.AddBookmark (cyclomatic 61) src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:450 — WordHandler.AddBookmark has cyclomatic complexity 61 (threshold 15). Of this number, 57 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 · WordHandler.BuildAbstractNumElement (cyclomatic 60) · ×1
  • WordHandler.BuildAbstractNumElement (cyclomatic 60) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:2272 — WordHandler.BuildAbstractNumElement has cyclomatic complexity 60 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.CopyFromCore (cyclomatic 60) · ×1
  • WordHandler.CopyFromCore (cyclomatic 60) src/officecli/Handlers/Word/WordHandler.Mutations.cs:1715 — WordHandler.CopyFromCore has cyclomatic complexity 60 (threshold 15). Of this number, 54 points are the body's own statements and 6 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 · WordHandler.PopulateDocSettings (cyclomatic 60) · ×1
  • WordHandler.PopulateDocSettings (cyclomatic 60) src/officecli/Handlers/Word/WordHandler.Navigation.DocSettings.cs:15 — WordHandler.PopulateDocSettings has cyclomatic complexity 60 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExcelHandler.CopyFrom (cyclomatic 59) · ×1
  • ExcelHandler.CopyFrom (cyclomatic 59) src/officecli/Handlers/Excel/ExcelHandler.Add.cs:744 — ExcelHandler.CopyFrom 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 · PowerPointHandler.RenderTextBodyFO (cyclomatic 59) · ×1
  • PowerPointHandler.RenderTextBodyFO (cyclomatic 59) src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:1253 — PowerPointHandler.RenderTextBodyFO has cyclomatic complexity 59 (threshold 15). Of this number, 58 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: PowerPointHandler.GetPresetPolygonPoints (cyclomatic 60) 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 · WordHandler.MatchesRunSelector (cyclomatic 59) · ×1
  • WordHandler.MatchesRunSelector (cyclomatic 59) src/officecli/Handlers/Word/WordHandler.Selector.cs:287 — WordHandler.MatchesRunSelector has cyclomatic complexity 59 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChartSvgRenderer.RenderScatterChartSvg (cyclomatic 58) · ×1
  • ChartSvgRenderer.RenderScatterChartSvg (cyclomatic 58) src/officecli/Core/Chart/ChartSvgRenderer.cs:2537 — ChartSvgRenderer.RenderScatterChartSvg has cyclomatic complexity 58 (threshold 15). Of this number, 57 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 · CompoundFile.ReadStream (cyclomatic 58) · ×1
  • CompoundFile.ReadStream (cyclomatic 58) src/officecli/Core/CompoundFile.cs:214 — CompoundFile.ReadStream has cyclomatic complexity 58 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExcelHandler.AddValidation (cyclomatic 58) · ×1
  • ExcelHandler.AddValidation (cyclomatic 58) src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs:501 — ExcelHandler.AddValidation has cyclomatic complexity 58 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordBatchEmitter.EmitNoteReference (cyclomatic 58) · ×1
  • WordBatchEmitter.EmitNoteReference (cyclomatic 58) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:2085 — WordBatchEmitter.EmitNoteReference has cyclomatic complexity 58 (threshold 15). Of this number, 53 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 · PowerPointHandler.ApplyShapeAnimation (cyclomatic 57) · ×1
  • PowerPointHandler.ApplyShapeAnimation (cyclomatic 57) src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:787 — PowerPointHandler.ApplyShapeAnimation has cyclomatic complexity 57 (threshold 15). 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, separate the cases: extract each independent 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: PowerPointHandler.ResolveAnimEffectName (cyclomatic 62) 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 · PptxBatchEmitter.EmitSlide (cyclomatic 57) · ×1
  • PptxBatchEmitter.EmitSlide (cyclomatic 57) src/officecli/Handlers/Pptx/PptxBatchEmitter.cs:501 — PptxBatchEmitter.EmitSlide has cyclomatic complexity 57 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · WordHandler.AddRow (cyclomatic 57) · ×1
  • WordHandler.AddRow (cyclomatic 57) src/officecli/Handlers/Word/WordHandler.Add.Table.cs:845 — WordHandler.AddRow has cyclomatic complexity 57 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FormulaParser.ParseMatrix (cyclomatic 56) · ×1
  • FormulaParser.ParseMatrix (cyclomatic 56) src/officecli/Core/Formula/FormulaParser.cs:2378 — FormulaParser.ParseMatrix 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. This is NOT this file's highest cyclomatic complexity: FormulaParser.CommandToSymbol (cyclomatic 213) 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 · PowerPointHandler.GetSmartArtsOnSlide (cyclomatic 56) · ×1
  • PowerPointHandler.GetSmartArtsOnSlide (cyclomatic 56) REDACTED:3425 — PowerPointHandler.GetSmartArtsOnSlide has cyclomatic complexity 56 (threshold 15). Of this number, 53 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 · ChartSvgRenderer.RenderPieChartSvg (cyclomatic 55) · ×1
  • ChartSvgRenderer.RenderPieChartSvg (cyclomatic 55) src/officecli/Core/Chart/ChartSvgRenderer.cs:1705 — ChartSvgRenderer.RenderPieChartSvg 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 · ChartSvgRenderer.RenderComboChartSvg (cyclomatic 55) · ×1
  • ChartSvgRenderer.RenderComboChartSvg (cyclomatic 55) src/officecli/Core/Chart/ChartSvgRenderer.cs:2711 — ChartSvgRenderer.RenderComboChartSvg has cyclomatic complexity 55 (threshold 15). Of this number, 54 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 · ExcelHandler.RenderExcelChart (cyclomatic 55) · ×1
  • ExcelHandler.RenderExcelChart (cyclomatic 55) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.Charts.cs:97 — ExcelHandler.RenderExcelChart has cyclomatic complexity 55 (threshold 15). Of this number, 52 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 · WordBatchEmitter.EmitBody (cyclomatic 55) · ×1
  • WordBatchEmitter.EmitBody (cyclomatic 55) src/officecli/Handlers/Word/WordBatchEmitter.cs:627 — WordBatchEmitter.EmitBody 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 · WordHandler.SetDocumentProperties (cyclomatic 55) · ×1
  • WordHandler.SetDocumentProperties (cyclomatic 55) src/officecli/Handlers/Word/WordHandler.Add.cs:651 — WordHandler.SetDocumentProperties 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 · WordHandler.AddFooter (cyclomatic 55) · ×1
  • WordHandler.AddFooter (cyclomatic 55) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:2898 — WordHandler.AddFooter has cyclomatic complexity 55 (threshold 15). Of this number, 54 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 · WordHandler.RenderShapeHtml (cyclomatic 55) · ×1
  • WordHandler.RenderShapeHtml (cyclomatic 55) REDACTED:1037 — WordHandler.RenderShapeHtml has cyclomatic complexity 55 (threshold 15). Of this number, 52 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 · WordHandler.AddHeader (cyclomatic 54) · ×1
  • WordHandler.AddHeader (cyclomatic 54) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:2698 — WordHandler.AddHeader has cyclomatic complexity 54 (threshold 15). Of this number, 53 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 · WordHandler.CreateImageNode (cyclomatic 54) · ×1
  • WordHandler.CreateImageNode (cyclomatic 54) src/officecli/Handlers/Word/WordHandler.ImageHelpers.cs:374 — WordHandler.CreateImageNode has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.MoveCore (cyclomatic 54) · ×1
  • WordHandler.MoveCore (cyclomatic 54) src/officecli/Handlers/Word/WordHandler.Mutations.cs:1227 — WordHandler.MoveCore has cyclomatic complexity 54 (threshold 15). Of this number, 46 points are the body's own statements and 8 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 · FlowchartLayout.Layout (cyclomatic 53) · ×1
  • FlowchartLayout.Layout (cyclomatic 53) src/officecli/Core/Diagram/FlowchartLayout.cs:47 — FlowchartLayout.Layout has cyclomatic complexity 53 (threshold 15). Of this number, 51 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 · FlowchartLayout.BkPosition (cyclomatic 53) · ×1
  • FlowchartLayout.BkPosition (cyclomatic 53) src/officecli/Core/Diagram/FlowchartLayout.cs:424 — FlowchartLayout.BkPosition has cyclomatic complexity 53 (threshold 15). Of this number, 51 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 · WordHandler.AddOle (cyclomatic 53) · ×1
  • WordHandler.AddOle (cyclomatic 53) src/officecli/Handlers/Word/WordHandler.Add.Media.cs:1235 — WordHandler.AddOle has cyclomatic complexity 53 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.RenderImageHtml (cyclomatic 53) · ×1
  • WordHandler.RenderImageHtml (cyclomatic 53) REDACTED:229 — WordHandler.RenderImageHtml has cyclomatic complexity 53 (threshold 15). Of this number, 50 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 · WordHandler.RejectAllChanges (cyclomatic 52) · ×1
  • WordHandler.RejectAllChanges (cyclomatic 52) src/officecli/Handlers/Word/WordHandler.Mutations.cs:2282 — WordHandler.RejectAllChanges has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.MatchesParagraphAttrs (cyclomatic 52) · ×1
  • WordHandler.MatchesParagraphAttrs (cyclomatic 52) src/officecli/Handlers/Word/WordHandler.Selector.cs:169 — WordHandler.MatchesParagraphAttrs has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.SetShapeProps (cyclomatic 52) · ×1
  • WordHandler.SetShapeProps (cyclomatic 52) src/officecli/Handlers/Word/WordHandler.Set.Element.cs:3349 — WordHandler.SetShapeProps has cyclomatic complexity 52 (threshold 15). Of this number, 47 points are the body's own statements and 5 belong to 5 function literals inside it that branch. To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · CommandBuilder.RunHelp (cyclomatic 51) · ×1
  • CommandBuilder.RunHelp (cyclomatic 51) src/officecli/CommandBuilder.Help.cs:201 — CommandBuilder.RunHelp has cyclomatic complexity 51 (threshold 15). Of this number, 47 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 · ChartHelper.ApplySeriesReferences (cyclomatic 51) · ×1
  • ChartHelper.ApplySeriesReferences (cyclomatic 51) src/officecli/Core/Chart/ChartHelper.Builder.cs:516 — ChartHelper.ApplySeriesReferences has cyclomatic complexity 51 (threshold 15). Of this number, 48 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 · PivotTableHelper.BuildPivotTableDefinition (cyclomatic 51) · ×1
  • PivotTableHelper.BuildPivotTableDefinition (cyclomatic 51) src/officecli/Core/PivotTableHelper.Definition.cs:130 — PivotTableHelper.BuildPivotTableDefinition has cyclomatic complexity 51 (threshold 15). Of this number, 50 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 · PowerPointHandler.AddChart (cyclomatic 51) · ×1
  • PowerPointHandler.AddChart (cyclomatic 51) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:644 — PowerPointHandler.AddChart has cyclomatic complexity 51 (threshold 15). Of this number, 48 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 · ExcelStyleManager.GetOrCreateNumFmt (cyclomatic 50) · ×1
  • ExcelStyleManager.GetOrCreateNumFmt (cyclomatic 50) src/officecli/Core/ExcelStyleManager.cs:662 — ExcelStyleManager.GetOrCreateNumFmt 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 · PptxBatchEmitter.ScanSlideExoticContent (cyclomatic 50) · ×1
  • PptxBatchEmitter.ScanSlideExoticContent (cyclomatic 50) src/officecli/Handlers/Pptx/PptxBatchEmitter.cs:1104 — PptxBatchEmitter.ScanSlideExoticContent 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 · WordHandler.ElementToNode (cyclomatic 49) · ×1
  • WordHandler.ElementToNode (cyclomatic 49) src/officecli/Handlers/Word/WordHandler.Navigation.cs:6196 — WordHandler.ElementToNode 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 · ExcelHandler.AddAutoFilter (cyclomatic 48) · ×1
  • ExcelHandler.AddAutoFilter (cyclomatic 48) src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs:715 — ExcelHandler.AddAutoFilter has cyclomatic complexity 48 (threshold 15). Of this number, 47 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 · ExcelHandler.ApplyNumberFormat (cyclomatic 48) · ×1
  • ExcelHandler.ApplyNumberFormat (cyclomatic 48) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:3279 — ExcelHandler.ApplyNumberFormat has cyclomatic complexity 48 (threshold 15). Of this number, 46 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 · PowerPointHandler.ReadShapeAnimation (cyclomatic 48) · ×1
  • PowerPointHandler.ReadShapeAnimation (cyclomatic 48) src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2229 — PowerPointHandler.ReadShapeAnimation 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. This is NOT this file's highest cyclomatic complexity: PowerPointHandler.ResolveAnimEffectName (cyclomatic 62) 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 · WordBatchEmitter.EmitComments (cyclomatic 48) · ×1
  • WordBatchEmitter.EmitComments (cyclomatic 48) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:1604 — WordBatchEmitter.EmitComments 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 · WordHandler.SetElementTableRow (cyclomatic 48) · ×1
  • WordHandler.SetElementTableRow (cyclomatic 48) src/officecli/Handlers/Word/WordHandler.Set.Element.cs:2586 — WordHandler.SetElementTableRow 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 · ExcelHandler.AddSparkline (cyclomatic 47) · ×1
  • ExcelHandler.AddSparkline (cyclomatic 47) src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:957 — ExcelHandler.AddSparkline 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 · ExcelHandler.SetValidationByPath (cyclomatic 47) · ×1
  • ExcelHandler.SetValidationByPath (cyclomatic 47) src/officecli/Handlers/Excel/ExcelHandler.Set.Tables.cs:171 — ExcelHandler.SetValidationByPath has cyclomatic complexity 47 (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 · WordBatchEmitter.ShouldCollapseSingleRun (cyclomatic 47) · ×1
  • WordBatchEmitter.ShouldCollapseSingleRun (cyclomatic 47) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:1224 — WordBatchEmitter.ShouldCollapseSingleRun has cyclomatic complexity 47 (threshold 15). 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · WordHandler.RawSetCore (cyclomatic 47) · ×1
  • WordHandler.RawSetCore (cyclomatic 47) src/officecli/Handlers/WordHandler.cs:1592 — WordHandler.RawSetCore has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExcelHandler.AddDataBar (cyclomatic 46) · ×1
  • ExcelHandler.AddDataBar (cyclomatic 46) src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:84 — ExcelHandler.AddDataBar 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 · PowerPointHandler.ParseGlbBoundingBox (cyclomatic 46) · ×1
  • PowerPointHandler.ParseGlbBoundingBox (cyclomatic 46) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Model3D.cs:458 — PowerPointHandler.ParseGlbBoundingBox 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 · PowerPointHandler.RenderTextBodySvg (cyclomatic 46) · ×1
  • PowerPointHandler.RenderTextBodySvg (cyclomatic 46) src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:615 — PowerPointHandler.RenderTextBodySvg 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. This is NOT this file's highest cyclomatic complexity: PowerPointHandler.GetPresetPolygonPoints (cyclomatic 60) 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 · FlowchartLayout.Route (cyclomatic 45) · ×1
  • FlowchartLayout.Route (cyclomatic 45) src/officecli/Core/Diagram/FlowchartLayout.cs:255 — FlowchartLayout.Route has cyclomatic complexity 45 (threshold 15). Of this number, 40 points are the body's own statements and 5 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 · PivotTableHelper.ParseValueFields (cyclomatic 45) · ×1
  • PivotTableHelper.ParseValueFields (cyclomatic 45) src/officecli/Core/PivotTableHelper.Parse.cs:122 — PivotTableHelper.ParseValueFields 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 · ExcelHandler.GetIconHtml (cyclomatic 45) · ×1
  • ExcelHandler.GetIconHtml (cyclomatic 45) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:1657 — ExcelHandler.GetIconHtml has cyclomatic complexity 45 (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 · PowerPointHandler.AddMedia (cyclomatic 45) · ×1
  • PowerPointHandler.AddMedia (cyclomatic 45) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:837 — PowerPointHandler.AddMedia has cyclomatic complexity 45 (threshold 15). Of this number, 44 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 · ExcelHandler.AddNamedRange (cyclomatic 44) · ×1
  • ExcelHandler.AddNamedRange (cyclomatic 44) src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs:20 — ExcelHandler.AddNamedRange has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PowerPointHandler.ReadTransitionDirection (cyclomatic 44) · ×1
  • PowerPointHandler.ReadTransitionDirection (cyclomatic 44) src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2742 — PowerPointHandler.ReadTransitionDirection has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: PowerPointHandler.ResolveAnimEffectName (cyclomatic 62) 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 · WordHandler.AppendW14CssEffects (cyclomatic 44) · ×1
  • WordHandler.AppendW14CssEffects (cyclomatic 44) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:1988 — WordHandler.AppendW14CssEffects has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChartExBuilder.BuildExtendedChartSpace (cyclomatic 43) · ×1
  • ChartExBuilder.BuildExtendedChartSpace (cyclomatic 43) src/officecli/Core/Chart/ChartExBuilder.cs:42 — ChartExBuilder.BuildExtendedChartSpace 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 · PowerPointHandler.ResolvePptParagraphsForFindInternal (cyclomatic 43) · ×1
  • PowerPointHandler.ResolvePptParagraphsForFindInternal (cyclomatic 43) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.FindReplace.cs:431 — PowerPointHandler.ResolvePptParagraphsForFindInternal 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 · WordHandler.ReadW14TextEffects (cyclomatic 43) · ×1
  • WordHandler.ReadW14TextEffects (cyclomatic 43) src/officecli/Handlers/Word/WordHandler.Helpers.TextEffect.cs:270 — WordHandler.ReadW14TextEffects 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 · watch-sse-core.es.addEventListener("update") (cyclomatic 43) · ×1
  • watch-sse-core.es.addEventListener("update") (cyclomatic 43) src/officecli/Resources/watch-sse-core.js:318 — watch-sse-core.es.addEventListener("update") has cyclomatic complexity 43 (threshold 15). Of this number, 28 points are the body's own statements and 15 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · (anonymous) (cyclomatic 43) · ×1
  • (anonymous) (cyclomatic 43) src/officecli/Resources/watch-sse-core.js:318 — (anonymous) has cyclomatic complexity 43 (threshold 15). Of this number, 28 points are the body's own statements and 15 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 · TableStyleResolver.MergeRegions (cyclomatic 42) · ×1
  • TableStyleResolver.MergeRegions (cyclomatic 42) src/officecli/Core/TableStyles/TableStyleResolver.cs:70 — TableStyleResolver.MergeRegions has cyclomatic complexity 42 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExcelHandler.ApplyChartPositionSet (cyclomatic 42) · ×1
  • ExcelHandler.ApplyChartPositionSet (cyclomatic 42) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Chart.cs:138 — ExcelHandler.ApplyChartPositionSet has cyclomatic complexity 42 (threshold 15). Of this number, 37 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExcelHandler.GetCellStyleCss (cyclomatic 42) · ×1
  • ExcelHandler.GetCellStyleCss (cyclomatic 42) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:2209 — ExcelHandler.GetCellStyleCss 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 · ExcelHandler.SetOleByPath (cyclomatic 42) · ×1
  • ExcelHandler.SetOleByPath (cyclomatic 42) src/officecli/Handlers/Excel/ExcelHandler.Set.Drawings.cs:128 — ExcelHandler.SetOleByPath 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 · WordHandler.BuildChartFrame (cyclomatic 42) · ×1
  • WordHandler.BuildChartFrame (cyclomatic 42) src/officecli/Handlers/Word/WordHandler.Helpers.Chart.cs:194 — WordHandler.BuildChartFrame has cyclomatic complexity 42 (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 · ChartHelper.BuildAxisNode (cyclomatic 41) · ×1
  • ChartHelper.BuildAxisNode (cyclomatic 41) src/officecli/Core/Chart/ChartHelper.Axis.cs:84 — ChartHelper.BuildAxisNode 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 · ChartSvgRenderer.ExtractCxChartInfo (cyclomatic 41) · ×1
  • ChartSvgRenderer.ExtractCxChartInfo (cyclomatic 41) src/officecli/Core/Chart/ChartSvgRenderer.CxExtract.cs:36 — ChartSvgRenderer.ExtractCxChartInfo has cyclomatic complexity 41 (threshold 15). Of this number, 40 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 · PivotTableHelper.BuildTreeAxisItems (cyclomatic 41) · ×1
  • PivotTableHelper.BuildTreeAxisItems (cyclomatic 41) src/officecli/Core/PivotTableHelper.Definition.cs:1063 — PivotTableHelper.BuildTreeAxisItems 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 · ExcelHandler.CheckAllNumericOverflow (cyclomatic 41) · ×1
  • ExcelHandler.CheckAllNumericOverflow (cyclomatic 41) src/officecli/Handlers/Excel/ExcelHandler.CheckNumericOverflow.cs:33 — ExcelHandler.CheckAllNumericOverflow has cyclomatic complexity 41 (threshold 15). Of this number, 38 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 · PowerPointHandler.CustomGeometryToClipPath (cyclomatic 41) · ×1
  • PowerPointHandler.CustomGeometryToClipPath (cyclomatic 41) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:217 — PowerPointHandler.CustomGeometryToClipPath has cyclomatic complexity 41 (threshold 15). Of this number, 37 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PowerPointHandler.SetMediaByPath (cyclomatic 41) · ×1
  • PowerPointHandler.SetMediaByPath (cyclomatic 41) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:959 — PowerPointHandler.SetMediaByPath has cyclomatic complexity 41 (threshold 15). Of this number, 40 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 · PowerPointHandler.SetShapeAnimationByPath (cyclomatic 41) · ×1
  • PowerPointHandler.SetShapeAnimationByPath (cyclomatic 41) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1964 — PowerPointHandler.SetShapeAnimationByPath 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 · PptxBatchEmitter.EmitShape (cyclomatic 41) · ×1
  • PptxBatchEmitter.EmitShape (cyclomatic 41) src/officecli/Handlers/Pptx/PptxBatchEmitter.Shape.cs:186 — PptxBatchEmitter.EmitShape 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 · WordHandler.ReadRowProps (cyclomatic 41) · ×1
  • WordHandler.ReadRowProps (cyclomatic 41) src/officecli/Handlers/Word/WordHandler.Navigation.cs:6364 — WordHandler.ReadRowProps 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 · WordHandler.MergeRunProperties (cyclomatic 41) · ×1
  • WordHandler.MergeRunProperties (cyclomatic 41) src/officecli/Handlers/Word/WordHandler.StyleList.cs:175 — WordHandler.MergeRunProperties has cyclomatic complexity 41 (threshold 15). Of this number, 40 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 · FormulaEvaluator.EvalLinest (cyclomatic 40) · ×1
  • FormulaEvaluator.EvalLinest (cyclomatic 40) src/officecli/Core/Formula/FormulaEvaluator.Regression.cs:140 — FormulaEvaluator.EvalLinest has cyclomatic complexity 40 (threshold 15). Of this number, 39 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 · ExcelHandler.ParseSrcRect (cyclomatic 40) · ×1
  • ExcelHandler.ParseSrcRect (cyclomatic 40) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:92 — ExcelHandler.ParseSrcRect 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 · PowerPointHandler.ParseTransitionFromXml (cyclomatic 40) · ×1
  • PowerPointHandler.ParseTransitionFromXml (cyclomatic 40) src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2450 — PowerPointHandler.ParseTransitionFromXml has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: PowerPointHandler.ResolveAnimEffectName (cyclomatic 62) 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 · PowerPointHandler.ReadSlideTransition (cyclomatic 40) · ×1
  • PowerPointHandler.ReadSlideTransition (cyclomatic 40) src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2639 — PowerPointHandler.ReadSlideTransition has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: PowerPointHandler.ResolveAnimEffectName (cyclomatic 62) 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 · WordBatchEmitter.BuildFieldAddProps (cyclomatic 40) · ×1
  • WordBatchEmitter.BuildFieldAddProps (cyclomatic 40) src/officecli/Handlers/Word/WordBatchEmitter.Fields.cs:786 — WordBatchEmitter.BuildFieldAddProps 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 · WordHandler.ResolveAnchorPosition (cyclomatic 40) · ×1
  • WordHandler.ResolveAnchorPosition (cyclomatic 40) src/officecli/Handlers/Word/WordHandler.Navigation.cs:486 — WordHandler.ResolveAnchorPosition 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 · ChartSvgRenderer.RenderArea3DSvg (cyclomatic 39) · ×1
  • ChartSvgRenderer.RenderArea3DSvg (cyclomatic 39) src/officecli/Core/Chart/ChartSvgRenderer.cs:5440 — ChartSvgRenderer.RenderArea3DSvg has cyclomatic complexity 39 (threshold 15). Of this number, 38 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 · ExcelHandler.BuildRowInnerHtml (cyclomatic 39) · ×1
  • ExcelHandler.BuildRowInnerHtml (cyclomatic 39) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:829 — ExcelHandler.BuildRowInnerHtml 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 · ExcelHandler.QueryRowsByColumnPredicate (cyclomatic 39) · ×1
  • ExcelHandler.QueryRowsByColumnPredicate (cyclomatic 39) src/officecli/Handlers/Excel/ExcelHandler.Query.RowWhere.cs:60 — ExcelHandler.QueryRowsByColumnPredicate has cyclomatic complexity 39 (threshold 15). Of this number, 38 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 · ExcelHandler.SetSparklineByPath (cyclomatic 39) · ×1
  • ExcelHandler.SetSparklineByPath (cyclomatic 39) src/officecli/Handlers/Excel/ExcelHandler.Set.Drawings.cs:20 — ExcelHandler.SetSparklineByPath 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 · PowerPointHandler.CheckTextOverflow (cyclomatic 39) · ×1
  • PowerPointHandler.CheckTextOverflow (cyclomatic 39) src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:3957 — PowerPointHandler.CheckTextOverflow 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 · PptxBatchEmitter.EmitParagraph (cyclomatic 39) · ×1
  • PptxBatchEmitter.EmitParagraph (cyclomatic 39) src/officecli/Handlers/Pptx/PptxBatchEmitter.Shape.cs:921 — PptxBatchEmitter.EmitParagraph has cyclomatic complexity 39 (threshold 15). Of this number, 34 points are the body's own statements and 5 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 · SchemaHelpLoader.ValidateProperties (cyclomatic 39) · ×1
  • SchemaHelpLoader.ValidateProperties (cyclomatic 39) src/officecli/Help/SchemaHelpLoader.cs:546 — SchemaHelpLoader.ValidateProperties 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 · ExcelStyleManager.GetOrCreateFont (cyclomatic 38) · ×1
  • ExcelStyleManager.GetOrCreateFont (cyclomatic 38) src/officecli/Core/ExcelStyleManager.cs:927 — ExcelStyleManager.GetOrCreateFont 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 · FormulaEvaluator.EvalXlookup (cyclomatic 38) · ×1
  • FormulaEvaluator.EvalXlookup (cyclomatic 38) src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:1314 — FormulaEvaluator.EvalXlookup 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 · ExcelBatchEmitter.ClassifyCell (cyclomatic 38) · ×1
  • ExcelBatchEmitter.ClassifyCell (cyclomatic 38) src/officecli/Handlers/Excel/ExcelBatchEmitter.cs:717 — ExcelBatchEmitter.ClassifyCell 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 · ExcelHandler.FindAndReplace (cyclomatic 38) · ×1
  • ExcelHandler.FindAndReplace (cyclomatic 38) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Sheet.cs:444 — ExcelHandler.FindAndReplace 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 · PowerPointHandler.ProcessFindInPptParagraph (cyclomatic 38) · ×1
  • PowerPointHandler.ProcessFindInPptParagraph (cyclomatic 38) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.FindReplace.cs:107 — PowerPointHandler.ProcessFindInPptParagraph 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 · PowerPointHandler.SwapCore (cyclomatic 38) · ×1
  • PowerPointHandler.SwapCore (cyclomatic 38) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:987 — PowerPointHandler.SwapCore 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 · PowerPointHandler.SetParagraphOnShapeCore (cyclomatic 38) · ×1
  • PowerPointHandler.SetParagraphOnShapeCore (cyclomatic 38) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:203 — PowerPointHandler.SetParagraphOnShapeCore has cyclomatic complexity 38 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PowerPointHandler.SetGroupByPath (cyclomatic 38) · ×1
  • PowerPointHandler.SetGroupByPath (cyclomatic 38) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:583 — PowerPointHandler.SetGroupByPath has cyclomatic complexity 38 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PowerPointHandler.SetSlideByPath (cyclomatic 38) · ×1
  • PowerPointHandler.SetSlideByPath (cyclomatic 38) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Slide.cs:303 — PowerPointHandler.SetSlideByPath 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 · WordHandler.RenderChartHtml (cyclomatic 38) · ×1
  • WordHandler.RenderChartHtml (cyclomatic 38) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Charts.cs:17 — WordHandler.RenderChartHtml 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 · WordHandler.BuildSectionHfBundles (cyclomatic 38) · ×1
  • WordHandler.BuildSectionHfBundles (cyclomatic 38) REDACTED:3384 — WordHandler.BuildSectionHfBundles 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 · WordHandler.SetHeaderFooter (cyclomatic 38) · ×1
  • WordHandler.SetHeaderFooter (cyclomatic 38) src/officecli/Handlers/Word/WordHandler.Set.cs:651 — WordHandler.SetHeaderFooter has cyclomatic complexity 38 (threshold 15). Of this number, 36 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. This is NOT this file's highest cyclomatic complexity: WordHandler.ParseNumberFormat (cyclomatic 65) 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 · WordHandler.ViewAsTextJson (cyclomatic 38) · ×1
  • WordHandler.ViewAsTextJson (cyclomatic 38) src/officecli/Handlers/Word/WordHandler.View.cs:1035 — WordHandler.ViewAsTextJson has cyclomatic complexity 38 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AttributeFilter.MatchOne (cyclomatic 37) · ×1
  • AttributeFilter.MatchOne (cyclomatic 37) src/officecli/Core/AttributeFilter.cs:510 — AttributeFilter.MatchOne has cyclomatic complexity 37 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · ChartSvgRenderer.RenderBubbleChartSvg (cyclomatic 37) · ×1
  • ChartSvgRenderer.RenderBubbleChartSvg (cyclomatic 37) src/officecli/Core/Chart/ChartSvgRenderer.cs:2394 — ChartSvgRenderer.RenderBubbleChartSvg 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 · ExcelHandler.AddPart (cyclomatic 37) · ×1
  • ExcelHandler.AddPart (cyclomatic 37) src/officecli/Handlers/Excel/ExcelHandler.Add.cs:1064 — ExcelHandler.AddPart 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. This is NOT this file's highest cyclomatic complexity: ExcelHandler.AddCore (cyclomatic 50) 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 · ExcelHandler.Import (cyclomatic 37) · ×1
  • ExcelHandler.Import (cyclomatic 37) src/officecli/Handlers/Excel/ExcelHandler.Import.cs:25 — ExcelHandler.Import 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 · PowerPointHandler.ReadBackground (cyclomatic 37) · ×1
  • PowerPointHandler.ReadBackground (cyclomatic 37) src/officecli/Handlers/Pptx/PowerPointHandler.Background.cs:560 — PowerPointHandler.ReadBackground has cyclomatic complexity 37 (threshold 15). Of this number, 34 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 · PowerPointHandler.RenderChart (cyclomatic 37) · ×1
  • PowerPointHandler.RenderChart (cyclomatic 37) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Charts.cs:20 — PowerPointHandler.RenderChart has cyclomatic complexity 37 (threshold 15). Of this number, 35 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 · WordHandler.RenderOlePreviewHtml (cyclomatic 37) · ×1
  • WordHandler.RenderOlePreviewHtml (cyclomatic 37) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Text.cs:1372 — WordHandler.RenderOlePreviewHtml 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 · WordHandler.ViewAsAnnotated (cyclomatic 37) · ×1
  • WordHandler.ViewAsAnnotated (cyclomatic 37) src/officecli/Handlers/Word/WordHandler.View.cs:510 — WordHandler.ViewAsAnnotated 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 · SchemaHelpRenderer.RenderUsageBlock (cyclomatic 37) · ×1
  • SchemaHelpRenderer.RenderUsageBlock (cyclomatic 37) src/officecli/Help/SchemaHelpRenderer.cs:233 — SchemaHelpRenderer.RenderUsageBlock 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 · ResidentServer.ExecuteSet (cyclomatic 37) · ×1
  • ResidentServer.ExecuteSet (cyclomatic 37) src/officecli/ResidentServer.cs:2159 — ResidentServer.ExecuteSet 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 · ExcelHandler.AddChart (cyclomatic 36) · ×1
  • ExcelHandler.AddChart (cyclomatic 36) src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:21 — ExcelHandler.AddChart 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 · PowerPointHandler.ResolveIdPath (cyclomatic 36) · ×1
  • PowerPointHandler.ResolveIdPath (cyclomatic 36) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Path.cs:226 — PowerPointHandler.ResolveIdPath 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 · PowerPointHandler.ConvertOmmlNode (cyclomatic 36) · ×1
  • PowerPointHandler.ConvertOmmlNode (cyclomatic 36) src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:2036 — PowerPointHandler.ConvertOmmlNode has cyclomatic complexity 36 (threshold 15). Of this number, 34 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. This is NOT this file's highest cyclomatic complexity: PowerPointHandler.GetPresetPolygonPoints (cyclomatic 60) 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 · WordHandler.ReadDocDefaults (cyclomatic 36) · ×1
  • WordHandler.ReadDocDefaults (cyclomatic 36) REDACTED:1612 — WordHandler.ReadDocDefaults 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · WordHandler.SetGroupProps (cyclomatic 36) · ×1
  • WordHandler.SetGroupProps (cyclomatic 36) src/officecli/Handlers/Word/WordHandler.Set.Element.cs:3496 — WordHandler.SetGroupProps has cyclomatic complexity 36 (threshold 15). Of this number, 31 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 · ResidentServer.ProcessRequest (cyclomatic 36) · ×1
  • ResidentServer.ProcessRequest (cyclomatic 36) src/officecli/ResidentServer.cs:778 — ResidentServer.ProcessRequest 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 · CommandBuilder.BuildMarkCommand (cyclomatic 35) · ×1
  • CommandBuilder.BuildMarkCommand (cyclomatic 35) src/officecli/CommandBuilder.Mark.cs:21 — CommandBuilder.BuildMarkCommand 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 one function literal inside it that branches (line 38). 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 · ChartHelper.DetectChartType (cyclomatic 35) · ×1
  • ChartHelper.DetectChartType (cyclomatic 35) src/officecli/Core/Chart/ChartHelper.Reader.cs:1740 — ChartHelper.DetectChartType 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 · PivotTableHelper.RefreshPivotCacheFromSource (cyclomatic 35) · ×1
  • PivotTableHelper.RefreshPivotCacheFromSource (cyclomatic 35) src/officecli/Core/PivotTableHelper.Readback.cs:368 — PivotTableHelper.RefreshPivotCacheFromSource 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 · ExcelHandler.GetPictureNode (cyclomatic 35) · ×1
  • ExcelHandler.GetPictureNode (cyclomatic 35) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:341 — ExcelHandler.GetPictureNode 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 · PowerPointHandler.ApplyTableBorderFanOut (cyclomatic 35) · ×1
  • PowerPointHandler.ApplyTableBorderFanOut (cyclomatic 35) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Table.cs:289 — PowerPointHandler.ApplyTableBorderFanOut has cyclomatic complexity 35 (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 · PptxBatchEmitter.FilterEmittableProps (cyclomatic 35) · ×1
  • PptxBatchEmitter.FilterEmittableProps (cyclomatic 35) src/officecli/Handlers/Pptx/PptxBatchEmitter.Filters.cs:114 — PptxBatchEmitter.FilterEmittableProps 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 · WordHandler.SetElementSdt (cyclomatic 35) · ×1
  • WordHandler.SetElementSdt (cyclomatic 35) src/officecli/Handlers/Word/WordHandler.Set.Element.cs:121 — WordHandler.SetElementSdt 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 · WordHandler.ViewAsText (cyclomatic 35) · ×1
  • WordHandler.ViewAsText (cyclomatic 35) src/officecli/Handlers/Word/WordHandler.View.cs:330 — WordHandler.ViewAsText has cyclomatic complexity 35 (threshold 15). Of this number, 34 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 · WordHandler.CollectFormFieldEntries (cyclomatic 35) · ×1
  • WordHandler.CollectFormFieldEntries (cyclomatic 35) src/officecli/Handlers/Word/WordHandler.View.cs:1601 — WordHandler.CollectFormFieldEntries 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 · ChartSvgRenderer.AppendTrendline (cyclomatic 34) · ×1
  • ChartSvgRenderer.AppendTrendline (cyclomatic 34) src/officecli/Core/Chart/ChartSvgRenderer.cs:1157 — ChartSvgRenderer.AppendTrendline 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExcelBatchEmitter.EmitPivotTables (cyclomatic 34) · ×1
  • ExcelBatchEmitter.EmitPivotTables (cyclomatic 34) src/officecli/Handlers/Excel/ExcelBatchEmitter.Elements.cs:685 — ExcelBatchEmitter.EmitPivotTables 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 · PowerPointHandler.SetOleByPath (cyclomatic 34) · ×1
  • PowerPointHandler.SetOleByPath (cyclomatic 34) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:828 — PowerPointHandler.SetOleByPath has cyclomatic complexity 34 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · PptxBatchEmitter.NormalizeSlideRawSlice (cyclomatic 34) · ×1
  • PptxBatchEmitter.NormalizeSlideRawSlice (cyclomatic 34) src/officecli/Handlers/Pptx/PptxBatchEmitter.cs:1414 — PptxBatchEmitter.NormalizeSlideRawSlice has cyclomatic complexity 34 (threshold 15). Of this number, 27 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 · PptxBatchEmitter.EmitTable (cyclomatic 34) · ×1
  • PptxBatchEmitter.EmitTable (cyclomatic 34) src/officecli/Handlers/Pptx/PptxBatchEmitter.Table.cs:17 — PptxBatchEmitter.EmitTable 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 · WordBatchEmitter.EmitPlainOrHyperlinkRun (cyclomatic 34) · ×1
  • WordBatchEmitter.EmitPlainOrHyperlinkRun (cyclomatic 34) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:4334 — WordBatchEmitter.EmitPlainOrHyperlinkRun 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 · WordBatchEmitter.EmitHeaderFooterPart (cyclomatic 34) · ×1
  • WordBatchEmitter.EmitHeaderFooterPart (cyclomatic 34) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:1379 — WordBatchEmitter.EmitHeaderFooterPart has cyclomatic complexity 34 (threshold 15). Of this number, 30 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 · WordHandler.GetOleEmitData (cyclomatic 34) · ×1
  • WordHandler.GetOleEmitData (cyclomatic 34) src/officecli/Handlers/WordHandler.cs:554 — WordHandler.GetOleEmitData 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ModernFunctionQualifier.AutoQuoteSheetRefs (cyclomatic 33) · ×1
  • ModernFunctionQualifier.AutoQuoteSheetRefs (cyclomatic 33) src/officecli/Core/Formula/ModernFunctionQualifier.cs:406 — ModernFunctionQualifier.AutoQuoteSheetRefs 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 · RawXmlHelper.ExecuteOnXmlString (cyclomatic 33) · ×1
  • RawXmlHelper.ExecuteOnXmlString (cyclomatic 33) src/officecli/Core/RawXmlHelper.cs:124 — RawXmlHelper.ExecuteOnXmlString 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 · ExcelBatchEmitter.EmitCharts (cyclomatic 33) · ×1
  • ExcelBatchEmitter.EmitCharts (cyclomatic 33) src/officecli/Handlers/Excel/ExcelBatchEmitter.Elements.cs:376 — ExcelBatchEmitter.EmitCharts has cyclomatic complexity 33 (threshold 15). Of this number, 27 points are the body's own statements and 6 belong to 3 function literals inside it that branch. To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · ExcelHandler.AddPicture (cyclomatic 33) · ×1
  • ExcelHandler.AddPicture (cyclomatic 33) src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:264 — ExcelHandler.AddPicture 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExcelHandler.ParseDataRangeForChart (cyclomatic 33) · ×1
  • ExcelHandler.ParseDataRangeForChart (cyclomatic 33) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Chart.cs:403 — ExcelHandler.ParseDataRangeForChart 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 · ExcelHandler.BuildConditionalFormatMap (cyclomatic 33) · ×1
  • ExcelHandler.BuildConditionalFormatMap (cyclomatic 33) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:1192 — ExcelHandler.BuildConditionalFormatMap 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 · PowerPointHandler.AddAnimation (cyclomatic 33) · ×1
  • PowerPointHandler.AddAnimation (cyclomatic 33) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1675 — PowerPointHandler.AddAnimation 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 · PowerPointHandler.BuildGradientFill (cyclomatic 33) · ×1
  • PowerPointHandler.BuildGradientFill (cyclomatic 33) src/officecli/Handlers/Pptx/PowerPointHandler.Background.cs:909 — PowerPointHandler.BuildGradientFill 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 · PowerPointHandler.GetShapeFillCss (cyclomatic 33) · ×1
  • PowerPointHandler.GetShapeFillCss (cyclomatic 33) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:23 — PowerPointHandler.GetShapeFillCss 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 · PptxBatchEmitter.EmitGenericAlternateContentForSlide (cyclomatic 33) · ×1
  • PptxBatchEmitter.EmitGenericAlternateContentForSlide (cyclomatic 33) src/officecli/Handlers/Pptx/PptxBatchEmitter.Media.cs:558 — PptxBatchEmitter.EmitGenericAlternateContentForSlide 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 · WordHandler.AddNum (cyclomatic 33) · ×1
  • WordHandler.AddNum (cyclomatic 33) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:2076 — WordHandler.AddNum has cyclomatic complexity 33 (threshold 15). Of this number, 31 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 · WordHandler.ResolveEffectiveRunPropertiesCore (cyclomatic 33) · ×1
  • WordHandler.ResolveEffectiveRunPropertiesCore (cyclomatic 33) src/officecli/Handlers/Word/WordHandler.StyleList.cs:34 — WordHandler.ResolveEffectiveRunPropertiesCore has cyclomatic complexity 33 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BatchItemConverter.Read (cyclomatic 32) · ×1
  • BatchItemConverter.Read (cyclomatic 32) src/officecli/BatchTypes.cs:71 — BatchItemConverter.Read has cyclomatic complexity 32 (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 · CommandBuilder.BuildPluginsLintCommand (cyclomatic 32) · ×1
  • CommandBuilder.BuildPluginsLintCommand (cyclomatic 32) src/officecli/CommandBuilder.Plugins.cs:208 — CommandBuilder.BuildPluginsLintCommand has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 1 of the 32 points is its own statement and the rest belongs to one function literal inside it that branches (line 229). 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 · PivotTableHelper.ComputePivotGeometry (cyclomatic 32) · ×1
  • PivotTableHelper.ComputePivotGeometry (cyclomatic 32) src/officecli/Core/PivotTableHelper.cs:1680 — PivotTableHelper.ComputePivotGeometry has cyclomatic complexity 32 (threshold 15). Of this number, 29 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 · ExcelBatchEmitter.EmitConditionalFormats (cyclomatic 32) · ×1
  • ExcelBatchEmitter.EmitConditionalFormats (cyclomatic 32) src/officecli/Handlers/Excel/ExcelBatchEmitter.Elements.cs:147 — ExcelBatchEmitter.EmitConditionalFormats has cyclomatic complexity 32 (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 · ExcelHandler.RefreshStaleFormulaCaches (cyclomatic 32) · ×1
  • ExcelHandler.RefreshStaleFormulaCaches (cyclomatic 32) src/officecli/Handlers/Excel/ExcelHandler.FormulaCache.cs:150 — ExcelHandler.RefreshStaleFormulaCaches 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 · ExcelHandler.SetRange (cyclomatic 32) · ×1
  • ExcelHandler.SetRange (cyclomatic 32) src/officecli/Handlers/Excel/ExcelHandler.Set.Ranges.cs:21 — ExcelHandler.SetRange 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 · PowerPointHandler.RawSetCore (cyclomatic 32) · ×1
  • PowerPointHandler.RawSetCore (cyclomatic 32) REDACTED:285 — PowerPointHandler.RawSetCore 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 · WordHandler.EmitEffectiveRunProperties (cyclomatic 32) · ×1
  • WordHandler.EmitEffectiveRunProperties (cyclomatic 32) src/officecli/Handlers/Word/WordHandler.StyleList.cs:417 — WordHandler.EmitEffectiveRunProperties has cyclomatic complexity 32 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · watch-sse-core.wordDiffUpdate (cyclomatic 32) · ×1
  • watch-sse-core.wordDiffUpdate (cyclomatic 32) src/officecli/Resources/watch-sse-core.js:138 — watch-sse-core.wordDiffUpdate has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 1 of the 32 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 147, 157, 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 · ChartHelper.RebuildComboChart (cyclomatic 31) · ×1
  • ChartHelper.RebuildComboChart (cyclomatic 31) src/officecli/Core/Chart/ChartHelper.Advanced.cs:500 — ChartHelper.RebuildComboChart has cyclomatic complexity 31 (threshold 15). Of this number, 30 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 · ChartSvgRenderer.RenderRadarChartSvg (cyclomatic 31) · ×1
  • ChartSvgRenderer.RenderRadarChartSvg (cyclomatic 31) src/officecli/Core/Chart/ChartSvgRenderer.cs:2292 — ChartSvgRenderer.RenderRadarChartSvg 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 · MarkdownParser.Parse (cyclomatic 31) · ×1
  • MarkdownParser.Parse (cyclomatic 31) src/officecli/Core/Markdown/MarkdownParser.cs:86 — MarkdownParser.Parse 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 · UpdateChecker.RunRefresh (cyclomatic 31) · ×1
  • UpdateChecker.RunRefresh (cyclomatic 31) src/officecli/Core/UpdateChecker.cs:106 — UpdateChecker.RunRefresh has cyclomatic complexity 31 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · ExcelHandler.GetDumpRowNodes (cyclomatic 31) · ×1
  • ExcelHandler.GetDumpRowNodes (cyclomatic 31) src/officecli/Handlers/Excel/ExcelHandler.DumpSupport.cs:59 — ExcelHandler.GetDumpRowNodes 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 · ExcelHandler.GetFormattedCellValue (cyclomatic 31) · ×1
  • ExcelHandler.GetFormattedCellValue (cyclomatic 31) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:2775 — ExcelHandler.GetFormattedCellValue 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 · ExcelHandler.AddSlicer (cyclomatic 31) · ×1
  • ExcelHandler.AddSlicer (cyclomatic 31) src/officecli/Handlers/Excel/ExcelHandler.Slicer.cs:67 — ExcelHandler.AddSlicer 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 · PowerPointHandler.MatchesGenericAttributes (cyclomatic 31) · ×1
  • PowerPointHandler.MatchesGenericAttributes (cyclomatic 31) src/officecli/Handlers/Pptx/PowerPointHandler.Selector.cs:276 — PowerPointHandler.MatchesGenericAttributes 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 · PowerPointHandler.BuildAnimValueFromProps (cyclomatic 31) · ×1
  • PowerPointHandler.BuildAnimValueFromProps (cyclomatic 31) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:2237 — PowerPointHandler.BuildAnimValueFromProps 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 · WordHandler.EnsureAllParaIds (cyclomatic 31) · ×1
  • WordHandler.EnsureAllParaIds (cyclomatic 31) src/officecli/Handlers/Word/WordHandler.Helpers.Field.cs:325 — WordHandler.EnsureAllParaIds 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 · WordHandler.CollectInlinedPartsEmitData (cyclomatic 31) · ×1
  • WordHandler.CollectInlinedPartsEmitData (cyclomatic 31) src/officecli/Handlers/WordHandler.cs:1284 — WordHandler.CollectInlinedPartsEmitData has cyclomatic complexity 31 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · watch-overlay.applyMarks (cyclomatic 31) · ×1
  • watch-overlay.applyMarks (cyclomatic 31) src/officecli/Resources/watch-overlay.js:423 — watch-overlay.applyMarks 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 · ChartSvgRenderer.RenderMultiRingDoughnut (cyclomatic 30) · ×1
  • ChartSvgRenderer.RenderMultiRingDoughnut (cyclomatic 30) src/officecli/Core/Chart/ChartSvgRenderer.cs:1855 — ChartSvgRenderer.RenderMultiRingDoughnut 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 · ChartSvgRenderer.ExtractFillColor (cyclomatic 30) · ×1
  • ChartSvgRenderer.ExtractFillColor (cyclomatic 30) src/officecli/Core/Chart/ChartSvgRenderer.cs:4365 — ChartSvgRenderer.ExtractFillColor 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 · ChartSvgRenderer.RenderLegendHtml (cyclomatic 30) · ×1
  • ChartSvgRenderer.RenderLegendHtml (cyclomatic 30) src/officecli/Core/Chart/ChartSvgRenderer.cs:4881 — ChartSvgRenderer.RenderLegendHtml 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 · DrawingColorBuilder.ParseColorTransformSuffix (cyclomatic 30) · ×1
  • DrawingColorBuilder.ParseColorTransformSuffix (cyclomatic 30) src/officecli/Core/DrawingColorBuilder.cs:95 — DrawingColorBuilder.ParseColorTransformSuffix 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 · FormulaParser.Tokenize (cyclomatic 30) · ×1
  • FormulaParser.Tokenize (cyclomatic 30) src/officecli/Core/Formula/FormulaParser.cs:985 — FormulaParser.Tokenize has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: FormulaParser.CommandToSymbol (cyclomatic 213) 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 · PowerPointHandler.ResolveEffectiveDefRpCore (cyclomatic 30) · ×1
  • PowerPointHandler.ResolveEffectiveDefRpCore (cyclomatic 30) src/officecli/Handlers/Pptx/PowerPointHandler.StyleList.cs:70 — PowerPointHandler.ResolveEffectiveDefRpCore 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 · PptxBatchEmitter.EmitPresentationProps (cyclomatic 30) · ×1
  • PptxBatchEmitter.EmitPresentationProps (cyclomatic 30) src/officecli/Handlers/Pptx/PptxBatchEmitter.cs:295 — PptxBatchEmitter.EmitPresentationProps 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 · WordBatchEmitter.EmitOneNoteSpecialNotesFixup (cyclomatic 30) · ×1
  • WordBatchEmitter.EmitOneNoteSpecialNotesFixup (cyclomatic 30) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:372 — WordBatchEmitter.EmitOneNoteSpecialNotesFixup has cyclomatic complexity 30 (threshold 15). Of this number, 22 points are the body's own statements and 8 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 · WordHandler.AcceptAllChanges (cyclomatic 30) · ×1
  • WordHandler.AcceptAllChanges (cyclomatic 30) src/officecli/Handlers/Word/WordHandler.Mutations.cs:2118 — WordHandler.AcceptAllChanges has cyclomatic complexity 30 (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 · watch-sse-core.wordPatchUpdate (cyclomatic 30) · ×1
  • watch-sse-core.wordPatchUpdate (cyclomatic 30) src/officecli/Resources/watch-sse-core.js:222 — watch-sse-core.wordPatchUpdate has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 4 of the 30 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 239, 226, 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 · BatchCompat.RemapNumberingIds (cyclomatic 29) · ×1
  • BatchCompat.RemapNumberingIds (cyclomatic 29) src/officecli/Core/BatchCompat.cs:86 — BatchCompat.RemapNumberingIds has cyclomatic complexity 29 (threshold 15). Of this number, 24 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChartHelper.ConvertSeriesToType (cyclomatic 29) · ×1
  • ChartHelper.ConvertSeriesToType (cyclomatic 29) src/officecli/Core/Chart/ChartHelper.Advanced.cs:662 — ChartHelper.ConvertSeriesToType 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 · WatchServer.HandleWatchMessage (cyclomatic 29) · ×1
  • WatchServer.HandleWatchMessage (cyclomatic 29) src/officecli/Core/Watch/WatchServer.cs:666 — WatchServer.HandleWatchMessage 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 · ExcelHandler.PopulateAutoFilterCriteria (cyclomatic 29) · ×1
  • ExcelHandler.PopulateAutoFilterCriteria (cyclomatic 29) src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs:971 — ExcelHandler.PopulateAutoFilterCriteria 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 · ExcelHandler.BuildAlignmentCss (cyclomatic 29) · ×1
  • ExcelHandler.BuildAlignmentCss (cyclomatic 29) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:2614 — ExcelHandler.BuildAlignmentCss 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 · ExcelHandler.Raw (cyclomatic 29) · ×1
  • ExcelHandler.Raw (cyclomatic 29) src/officecli/Handlers/ExcelHandler.cs:184 — ExcelHandler.Raw 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 · PowerPointHandler.ResolveShapeId (cyclomatic 29) · ×1
  • PowerPointHandler.ResolveShapeId (cyclomatic 29) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:697 — PowerPointHandler.ResolveShapeId 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 · PowerPointHandler.BuildClickGroup (cyclomatic 29) · ×1
  • PowerPointHandler.BuildClickGroup (cyclomatic 29) src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:1245 — PowerPointHandler.BuildClickGroup has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: PowerPointHandler.ResolveAnimEffectName (cyclomatic 62) 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 · PowerPointHandler.ApplyPptRunFormatting (cyclomatic 29) · ×1
  • PowerPointHandler.ApplyPptRunFormatting (cyclomatic 29) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.RunFormat.cs:437 — PowerPointHandler.ApplyPptRunFormatting has cyclomatic complexity 29 (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 · PowerPointHandler.GradientToCss (cyclomatic 29) · ×1
  • PowerPointHandler.GradientToCss (cyclomatic 29) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:612 — PowerPointHandler.GradientToCss 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 · PowerPointHandler.TableBorderToCss (cyclomatic 29) · ×1
  • PowerPointHandler.TableBorderToCss (cyclomatic 29) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Tables.cs:470 — PowerPointHandler.TableBorderToCss has cyclomatic complexity 29 (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 · PowerPointHandler.SetMasterOrLayoutBackgroundByPath (cyclomatic 29) · ×1
  • PowerPointHandler.SetMasterOrLayoutBackgroundByPath (cyclomatic 29) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Slide.cs:179 — PowerPointHandler.SetMasterOrLayoutBackgroundByPath 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 · PptxBatchEmitter.EmitGroup (cyclomatic 29) · ×1
  • PptxBatchEmitter.EmitGroup (cyclomatic 29) src/officecli/Handlers/Pptx/PptxBatchEmitter.Shape.cs:739 — PptxBatchEmitter.EmitGroup has cyclomatic complexity 29 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · WordBatchEmitter.IsRichBlockSdt (cyclomatic 29) · ×1
  • WordBatchEmitter.IsRichBlockSdt (cyclomatic 29) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:3074 — WordBatchEmitter.IsRichBlockSdt 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 · WordHandler.ResolveIndentationFromStyle (cyclomatic 29) · ×1
  • WordHandler.ResolveIndentationFromStyle (cyclomatic 29) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:1239 — WordHandler.ResolveIndentationFromStyle 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 · WordHandler.GetCjkFontFallback (cyclomatic 29) · ×1
  • WordHandler.GetCjkFontFallback (cyclomatic 29) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:3357 — WordHandler.GetCjkFontFallback 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 · FormulaEvaluator.EvalDatabase (cyclomatic 28) · ×1
  • FormulaEvaluator.EvalDatabase (cyclomatic 28) src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:2200 — FormulaEvaluator.EvalDatabase has cyclomatic complexity 28 (threshold 15). Of this number, 26 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 · ImageSource.TryGetDimensions (cyclomatic 28) · ×1
  • ImageSource.TryGetDimensions (cyclomatic 28) src/officecli/Core/ImageSource.cs:247 — ImageSource.TryGetDimensions 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 · OleHelper.AddEmbeddedPartFromBytes (cyclomatic 28) · ×1
  • OleHelper.AddEmbeddedPartFromBytes (cyclomatic 28) src/officecli/Core/OleHelper.cs:297 — OleHelper.AddEmbeddedPartFromBytes has cyclomatic complexity 28 (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 · PivotTableHelper.ResolveDefinedName (cyclomatic 28) · ×1
  • PivotTableHelper.ResolveDefinedName (cyclomatic 28) src/officecli/Core/PivotTableHelper.Cache.cs:1261 — PivotTableHelper.ResolveDefinedName 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 · PowerPointHandler.GetMediaOnSlide (cyclomatic 28) · ×1
  • PowerPointHandler.GetMediaOnSlide (cyclomatic 28) REDACTED:3688 — PowerPointHandler.GetMediaOnSlide 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 · PowerPointHandler.FindUnsupportedDescendant (cyclomatic 28) · ×1
  • PowerPointHandler.FindUnsupportedDescendant (cyclomatic 28) src/officecli/Handlers/Pptx/PowerPointHandler.Selector.cs:50 — PowerPointHandler.FindUnsupportedDescendant 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 · WordHandler.ResolveShapeFillCss (cyclomatic 28) · ×1
  • WordHandler.ResolveShapeFillCss (cyclomatic 28) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:131 — WordHandler.ResolveShapeFillCss 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 · WordHandler.RenderCellListItem (cyclomatic 28) · ×1
  • WordHandler.RenderCellListItem (cyclomatic 28) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Tables.cs:1019 — WordHandler.RenderCellListItem 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 · WordHandler.MoveWithTrackChange (cyclomatic 28) · ×1
  • WordHandler.MoveWithTrackChange (cyclomatic 28) src/officecli/Handlers/Word/WordHandler.Mutations.cs:1473 — WordHandler.MoveWithTrackChange has cyclomatic complexity 28 (threshold 15). Of this number, 26 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 · ChartHelper.AddReferenceLine (cyclomatic 27) · ×1
  • ChartHelper.AddReferenceLine (cyclomatic 27) src/officecli/Core/Chart/ChartHelper.Advanced.cs:30 — ChartHelper.AddReferenceLine 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 · ChartHelper.ApplySecondaryAxis (cyclomatic 27) · ×1
  • ChartHelper.ApplySecondaryAxis (cyclomatic 27) src/officecli/Core/Chart/ChartHelper.Setter.cs:4184 — ChartHelper.ApplySecondaryAxis 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 · FormulaEvaluator.ParseFunction (cyclomatic 27) · ×1
  • FormulaEvaluator.ParseFunction (cyclomatic 27) src/officecli/Core/Formula/FormulaEvaluator.cs:1027 — FormulaEvaluator.ParseFunction 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 · FormulaEvaluator.EvalMatch (cyclomatic 27) · ×1
  • FormulaEvaluator.EvalMatch (cyclomatic 27) src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:1116 — FormulaEvaluator.EvalMatch 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 · FormulaEvaluator.EvalXmatch (cyclomatic 27) · ×1
  • FormulaEvaluator.EvalXmatch (cyclomatic 27) src/officecli/Core/Formula/FormulaEvaluator.Helpers.cs:632 — FormulaEvaluator.EvalXmatch 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 · PivotTableHelper.BuildAxisItems (cyclomatic 27) · ×1
  • PivotTableHelper.BuildAxisItems (cyclomatic 27) src/officecli/Core/PivotTableHelper.Definition.cs:539 — PivotTableHelper.BuildAxisItems 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 · ExcelBatchEmitter.EmitNamedRanges (cyclomatic 27) · ×1
  • ExcelBatchEmitter.EmitNamedRanges (cyclomatic 27) src/officecli/Handlers/Excel/ExcelBatchEmitter.cs:242 — ExcelBatchEmitter.EmitNamedRanges has cyclomatic complexity 27 (threshold 15). Of this number, 24 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 · ExcelHandler.GetDumpColumnNodes (cyclomatic 27) · ×1
  • ExcelHandler.GetDumpColumnNodes (cyclomatic 27) src/officecli/Handlers/Excel/ExcelHandler.DumpSupport.cs:269 — ExcelHandler.GetDumpColumnNodes 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 · ExcelHandler.SparklineGroupToNode (cyclomatic 27) · ×1
  • ExcelHandler.SparklineGroupToNode (cyclomatic 27) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Node.cs:19 — ExcelHandler.SparklineGroupToNode 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 · ExcelHandler.TryGetInCellImage (cyclomatic 27) · ×1
  • ExcelHandler.TryGetInCellImage (cyclomatic 27) src/officecli/Handlers/Excel/ExcelHandler.RichValueImage.cs:267 — ExcelHandler.TryGetInCellImage 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, name the conditions: bind each compound test to a 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 · PowerPointHandler.CountLastSiblings (cyclomatic 27) · ×1
  • PowerPointHandler.CountLastSiblings (cyclomatic 27) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Path.cs:414 — PowerPointHandler.CountLastSiblings 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 · PowerPointHandler.SetZoomByPath (cyclomatic 27) · ×1
  • PowerPointHandler.SetZoomByPath (cyclomatic 27) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:539 — PowerPointHandler.SetZoomByPath 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 · PptxBatchEmitter.EmitConnector (cyclomatic 27) · ×1
  • PptxBatchEmitter.EmitConnector (cyclomatic 27) src/officecli/Handlers/Pptx/PptxBatchEmitter.Shape.cs:527 — PptxBatchEmitter.EmitConnector has cyclomatic complexity 27 (threshold 15). Of this number, 25 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 · WordBatchEmitter.EmitSection (cyclomatic 27) · ×1
  • WordBatchEmitter.EmitSection (cyclomatic 27) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:3195 — WordBatchEmitter.EmitSection 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 · WordBatchEmitter.EmitStyles (cyclomatic 27) · ×1
  • WordBatchEmitter.EmitStyles (cyclomatic 27) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:3451 — WordBatchEmitter.EmitStyles 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 · WordHandler.MaterializeInlinedParts (cyclomatic 27) · ×1
  • WordHandler.MaterializeInlinedParts (cyclomatic 27) src/officecli/Handlers/Word/WordHandler.Add.Media.cs:979 — WordHandler.MaterializeInlinedParts 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 · WordHandler.ResolveParagraphsForFind (cyclomatic 27) · ×1
  • WordHandler.ResolveParagraphsForFind (cyclomatic 27) src/officecli/Handlers/Word/WordHandler.Helpers.FindReplace.cs:890 — WordHandler.ResolveParagraphsForFind 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 · WordHandler.AcceptRevision (cyclomatic 27) · ×1
  • WordHandler.AcceptRevision (cyclomatic 27) src/officecli/Handlers/Word/WordHandler.Set.Revision.cs:1215 — WordHandler.AcceptRevision has cyclomatic complexity 27 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · WordHandler.RejectRevision (cyclomatic 27) · ×1
  • WordHandler.RejectRevision (cyclomatic 27) src/officecli/Handlers/Word/WordHandler.Set.Revision.cs:1320 — WordHandler.RejectRevision has cyclomatic complexity 27 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · WordHandler.TrySetFootnoteEndnoteNumProps (cyclomatic 27) · ×1
  • WordHandler.TrySetFootnoteEndnoteNumProps (cyclomatic 27) src/officecli/Handlers/Word/WordHandler.Set.SectionLayout.cs:703 — WordHandler.TrySetFootnoteEndnoteNumProps 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 · ResidentServer.ExecuteBatch (cyclomatic 27) · ×1
  • ResidentServer.ExecuteBatch (cyclomatic 27) src/officecli/ResidentServer.cs:1232 — ResidentServer.ExecuteBatch 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 · CommandBuilder.BuildQueryCommand (cyclomatic 26) · ×1
  • CommandBuilder.BuildQueryCommand (cyclomatic 26) src/officecli/CommandBuilder.GetQuery.cs:168 — CommandBuilder.BuildQueryCommand 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 3 function literals inside it that branch (lines 185, 195, 221). 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 · ChartHelper.ParseSeriesDataExtended (cyclomatic 26) · ×1
  • ChartHelper.ParseSeriesDataExtended (cyclomatic 26) src/officecli/Core/Chart/ChartHelper.cs:374 — ChartHelper.ParseSeriesDataExtended 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 · ExcelStyleManager.GetOrCreateBorder (cyclomatic 26) · ×1
  • ExcelStyleManager.GetOrCreateBorder (cyclomatic 26) src/officecli/Core/ExcelStyleManager.cs:1499 — ExcelStyleManager.GetOrCreateBorder 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 · FontMetricsReader.ReadFamilyNames (cyclomatic 26) · ×1
  • FontMetricsReader.ReadFamilyNames (cyclomatic 26) src/officecli/Core/FontMetricsReader.cs:289 — FontMetricsReader.ReadFamilyNames 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 · PivotTableHelper.ApplyShowDataAs1x1 (cyclomatic 26) · ×1
  • PivotTableHelper.ApplyShowDataAs1x1 (cyclomatic 26) src/officecli/Core/PivotTableHelper.Parse.cs:639 — PivotTableHelper.ApplyShowDataAs1x1 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 · WorksheetBloatFilter.FilterCore (cyclomatic 26) · ×1
  • WorksheetBloatFilter.FilterCore (cyclomatic 26) src/officecli/Core/WorksheetBloatFilter.cs:185 — WorksheetBloatFilter.FilterCore has cyclomatic complexity 26 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · ExcelHandler.GetSpillWidthPt (cyclomatic 26) · ×1
  • ExcelHandler.GetSpillWidthPt (cyclomatic 26) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:1001 — ExcelHandler.GetSpillWidthPt 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 · ExcelHandler.NormalizeDateFormatCase (cyclomatic 26) · ×1
  • ExcelHandler.NormalizeDateFormatCase (cyclomatic 26) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:3926 — ExcelHandler.NormalizeDateFormatCase has cyclomatic complexity 26 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · ExcelHandler.SetColumn (cyclomatic 26) · ×1
  • ExcelHandler.SetColumn (cyclomatic 26) src/officecli/Handlers/Excel/ExcelHandler.Set.RowsCols.cs:21 — ExcelHandler.SetColumn 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PowerPointHandler.AddEmptyGroup (cyclomatic 26) · ×1
  • PowerPointHandler.AddEmptyGroup (cyclomatic 26) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1103 — PowerPointHandler.AddEmptyGroup 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 · PowerPointHandler.AddLineBreak (cyclomatic 26) · ×1
  • PowerPointHandler.AddLineBreak (cyclomatic 26) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Text.cs:470 — PowerPointHandler.AddLineBreak 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 · PowerPointHandler.ResolveAnchorPosition (cyclomatic 26) · ×1
  • PowerPointHandler.ResolveAnchorPosition (cyclomatic 26) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Path.cs:129 — PowerPointHandler.ResolveAnchorPosition 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PowerPointHandler.ResolveSlideLayout (cyclomatic 26) · ×1
  • PowerPointHandler.ResolveSlideLayout (cyclomatic 26) src/officecli/Handlers/Pptx/PowerPointHandler.Resolve.cs:541 — PowerPointHandler.ResolveSlideLayout has cyclomatic complexity 26 (threshold 15). Of this number, 22 points are the body's own statements and 4 belong to 4 function literals inside it that branch. To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · PowerPointHandler.SetModel3DByPath (cyclomatic 26) · ×1
  • PowerPointHandler.SetModel3DByPath (cyclomatic 26) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:696 — PowerPointHandler.SetModel3DByPath 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 · PowerPointHandler.EmitEffectiveFromResolved (cyclomatic 26) · ×1
  • PowerPointHandler.EmitEffectiveFromResolved (cyclomatic 26) src/officecli/Handlers/Pptx/PowerPointHandler.StyleList.cs:433 — PowerPointHandler.EmitEffectiveFromResolved has cyclomatic complexity 26 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · WordBatchEmitter.IsRichInlineSdt (cyclomatic 26) · ×1
  • WordBatchEmitter.IsRichInlineSdt (cyclomatic 26) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:4698 — WordBatchEmitter.IsRichInlineSdt has cyclomatic complexity 26 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · WordHandler.ComputeMathElementPath (cyclomatic 26) · ×1
  • WordHandler.ComputeMathElementPath (cyclomatic 26) src/officecli/Handlers/Word/WordHandler.Navigation.cs:1834 — WordHandler.ComputeMathElementPath 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 · WordHandler.ParseSeqInstruction (cyclomatic 26) · ×1
  • WordHandler.ParseSeqInstruction (cyclomatic 26) src/officecli/Handlers/Word/WordHandler.SeqEval.cs:73 — WordHandler.ParseSeqInstruction 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 · WordHandler.TrySetDocDefaults (cyclomatic 26) · ×1
  • WordHandler.TrySetDocDefaults (cyclomatic 26) src/officecli/Handlers/Word/WordHandler.Set.DocDefaults.cs:15 — WordHandler.TrySetDocDefaults 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 · WordHandler.TryGetParagraphTextWithFieldSentinels (cyclomatic 26) · ×1
  • WordHandler.TryGetParagraphTextWithFieldSentinels (cyclomatic 26) src/officecli/Handlers/Word/WordHandler.View.cs:230 — WordHandler.TryGetParagraphTextWithFieldSentinels 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 · watch-overlay.document.addEventListener("mousemove") (cyclomatic 26) · ×1
  • watch-overlay.document.addEventListener("mousemove") (cyclomatic 26) src/officecli/Resources/watch-overlay.js:822 — watch-overlay.document.addEventListener("mousemove") 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 · (anonymous) (cyclomatic 26) · ×1
  • (anonymous) (cyclomatic 26) src/officecli/Resources/watch-overlay.js:822 — (anonymous) 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 · BlankDocCreator.CreateWord (cyclomatic 25) · ×1
  • BlankDocCreator.CreateWord (cyclomatic 25) src/officecli/BlankDocCreator.cs:135 — BlankDocCreator.CreateWord 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 · CommandBuilder.BuildDumpCommand (cyclomatic 25) · ×1
  • CommandBuilder.BuildDumpCommand (cyclomatic 25) src/officecli/CommandBuilder.Dump.cs:13 — CommandBuilder.BuildDumpCommand 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 39, 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 · ChartHelper.BuildErrorBars (cyclomatic 25) · ×1
  • ChartHelper.BuildErrorBars (cyclomatic 25) src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:261 — ChartHelper.BuildErrorBars has cyclomatic complexity 25 (threshold 15). Of this number, 24 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · OleHelper.AddEmbeddedPart (cyclomatic 25) · ×1
  • OleHelper.AddEmbeddedPart (cyclomatic 25) src/officecli/Core/OleHelper.cs:155 — OleHelper.AddEmbeddedPart has cyclomatic complexity 25 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · PivotTableHelper.ApplyDateGrouping (cyclomatic 25) · ×1
  • PivotTableHelper.ApplyDateGrouping (cyclomatic 25) src/officecli/Core/PivotTableHelper.Cache.cs:56 — PivotTableHelper.ApplyDateGrouping 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 · SsrfGuard.IsPublicAddress (cyclomatic 25) · ×1
  • SsrfGuard.IsPublicAddress (cyclomatic 25) src/officecli/Core/SsrfGuard.cs:110 — SsrfGuard.IsPublicAddress 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 · WatchServer.ComputeWordPatches (cyclomatic 25) · ×1
  • WatchServer.ComputeWordPatches (cyclomatic 25) src/officecli/Core/Watch/WatchServer.cs:1445 — WatchServer.ComputeWordPatches 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 · WatchServer.HandlePostSwitchAsync (cyclomatic 25) · ×1
  • WatchServer.HandlePostSwitchAsync (cyclomatic 25) src/officecli/Core/Watch/WatchServer.cs:2579 — WatchServer.HandlePostSwitchAsync 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 · ExcelHandler.AddCellIs (cyclomatic 25) · ×1
  • ExcelHandler.AddCellIs (cyclomatic 25) src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:512 — ExcelHandler.AddCellIs has cyclomatic complexity 25 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · ExcelHandler.CheckAllGeneralPrecisionLoss (cyclomatic 25) · ×1
  • ExcelHandler.CheckAllGeneralPrecisionLoss (cyclomatic 25) src/officecli/Handlers/Excel/ExcelHandler.CheckGeneralPrecision.cs:44 — ExcelHandler.CheckAllGeneralPrecisionLoss 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 · ExcelHandler.GetSheetChildNodes (cyclomatic 25) · ×1
  • ExcelHandler.GetSheetChildNodes (cyclomatic 25) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Node.cs:132 — ExcelHandler.GetSheetChildNodes 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 · ExcelHandler.NormalizeExcelPath (cyclomatic 25) · ×1
  • ExcelHandler.NormalizeExcelPath (cyclomatic 25) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Sheet.cs:101 — ExcelHandler.NormalizeExcelPath has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: ExcelHandler.InsertSheetProtectionInOrder (cyclomatic 30) 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 · ExcelHandler.ViewAsHtml (cyclomatic 25) · ×1
  • ExcelHandler.ViewAsHtml (cyclomatic 25) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:154 — ExcelHandler.ViewAsHtml has cyclomatic complexity 25 (threshold 15). Of this number, 20 points are the body's own statements and 5 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 · ExcelHandler.DetectTables (cyclomatic 25) · ×1
  • ExcelHandler.DetectTables (cyclomatic 25) src/officecli/Handlers/Excel/ExcelHandler.Query.cs:2141 — ExcelHandler.DetectTables 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 · ExcelHandler.ParseCellSelector (cyclomatic 25) · ×1
  • ExcelHandler.ParseCellSelector (cyclomatic 25) src/officecli/Handlers/Excel/ExcelHandler.Selector.cs:19 — ExcelHandler.ParseCellSelector 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 · ExcelHandler.SetCellRunByPath (cyclomatic 25) · ×1
  • ExcelHandler.SetCellRunByPath (cyclomatic 25) src/officecli/Handlers/Excel/ExcelHandler.Set.Charts.cs:108 — ExcelHandler.SetCellRunByPath 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 · ExcelHandler.SetRow (cyclomatic 25) · ×1
  • ExcelHandler.SetRow (cyclomatic 25) src/officecli/Handlers/Excel/ExcelHandler.Set.RowsCols.cs:308 — ExcelHandler.SetRow 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 · ExcelHandler.PopulateWorkbookSettings (cyclomatic 25) · ×1
  • ExcelHandler.PopulateWorkbookSettings (cyclomatic 25) src/officecli/Handlers/Excel/ExcelHandler.Set.Workbook.cs:432 — ExcelHandler.PopulateWorkbookSettings 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 · PowerPointHandler.AddSlide (cyclomatic 25) · ×1
  • PowerPointHandler.AddSlide (cyclomatic 25) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Slide.cs:13 — PowerPointHandler.AddSlide 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 · PowerPointHandler.GetThemeNode (cyclomatic 25) · ×1
  • PowerPointHandler.GetThemeNode (cyclomatic 25) src/officecli/Handlers/Pptx/PowerPointHandler.Theme.cs:143 — PowerPointHandler.GetThemeNode 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 · WordHandler.ApplySdtExtraProps (cyclomatic 25) · ×1
  • WordHandler.ApplySdtExtraProps (cyclomatic 25) src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:2583 — WordHandler.ApplySdtExtraProps has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: WordHandler.IsUriSafe (cyclomatic 29) 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 · WordHandler.ResolveSpacingFromStyle (cyclomatic 25) · ×1
  • WordHandler.ResolveSpacingFromStyle (cyclomatic 25) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:1117 — WordHandler.ResolveSpacingFromStyle 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · WordHandler.ApplyCropToBlipFill (cyclomatic 25) · ×1
  • WordHandler.ApplyCropToBlipFill (cyclomatic 25) src/officecli/Handlers/Word/WordHandler.ImageHelpers.cs:622 — WordHandler.ApplyCropToBlipFill has cyclomatic complexity 25 (threshold 15). Of this number, 24 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 · CommandBuilder.BuildCreateCommand (cyclomatic 24) · ×1
  • CommandBuilder.BuildCreateCommand (cyclomatic 24) src/officecli/CommandBuilder.Import.cs:268 — CommandBuilder.BuildCreateCommand 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 283). 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 · AttributeFilter.Parse (cyclomatic 24) · ×1
  • AttributeFilter.Parse (cyclomatic 24) src/officecli/Core/AttributeFilter.cs:99 — AttributeFilter.Parse 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 · ChartHelper.BuildBubbleChart (cyclomatic 24) · ×1
  • ChartHelper.BuildBubbleChart (cyclomatic 24) src/officecli/Core/Chart/ChartHelper.Builder.cs:1254 — ChartHelper.BuildBubbleChart 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 · ChartHelper.HandleDataLabelDottedProperty (cyclomatic 24) · ×1
  • ChartHelper.HandleDataLabelDottedProperty (cyclomatic 24) src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:1193 — ChartHelper.HandleDataLabelDottedProperty 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 · ExcelStyleManager.FontMatches (cyclomatic 24) · ×1
  • ExcelStyleManager.FontMatches (cyclomatic 24) src/officecli/Core/ExcelStyleManager.cs:1133 — ExcelStyleManager.FontMatches 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 · FormulaEvaluator.ResolveCellResult (cyclomatic 24) · ×1
  • FormulaEvaluator.ResolveCellResult (cyclomatic 24) src/officecli/Core/Formula/FormulaEvaluator.cs:1248 — FormulaEvaluator.ResolveCellResult 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 · FormulaEvaluator.EvalIndex (cyclomatic 24) · ×1
  • FormulaEvaluator.EvalIndex (cyclomatic 24) src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:1082 — FormulaEvaluator.EvalIndex 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 · FormulaEvaluator.EvalOffset (cyclomatic 24) · ×1
  • FormulaEvaluator.EvalOffset (cyclomatic 24) src/officecli/Core/Formula/FormulaEvaluator.References.cs:166 — FormulaEvaluator.EvalOffset 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 · FormulaEvaluator.EvalTrend (cyclomatic 24) · ×1
  • FormulaEvaluator.EvalTrend (cyclomatic 24) src/officecli/Core/Formula/FormulaEvaluator.Regression.cs:213 — FormulaEvaluator.EvalTrend 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 · ModernFunctionQualifier.CollectLambdaParams (cyclomatic 24) · ×1
  • ModernFunctionQualifier.CollectLambdaParams (cyclomatic 24) src/officecli/Core/Formula/ModernFunctionQualifier.cs:151 — ModernFunctionQualifier.CollectLambdaParams 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 · GenericXmlQuery.TryCreateTypedElement (cyclomatic 24) · ×1
  • GenericXmlQuery.TryCreateTypedElement (cyclomatic 24) REDACTED:522 — GenericXmlQuery.TryCreateTypedElement 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 · PivotTableHelper.ApplyTopNFilter (cyclomatic 24) · ×1
  • PivotTableHelper.ApplyTopNFilter (cyclomatic 24) src/officecli/Core/PivotTableHelper.cs:720 — PivotTableHelper.ApplyTopNFilter 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 · PivotTableHelper.RefreshPivotCellsForView (cyclomatic 24) · ×1
  • PivotTableHelper.RefreshPivotCellsForView (cyclomatic 24) src/officecli/Core/PivotTableHelper.cs:2091 — PivotTableHelper.RefreshPivotCellsForView 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 · PivotTableHelper.ApplyCalculatedFields (cyclomatic 24) · ×1
  • PivotTableHelper.ApplyCalculatedFields (cyclomatic 24) src/officecli/Core/PivotTableHelper.Definition.cs:1495 — PivotTableHelper.ApplyCalculatedFields 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 · WatchServer.HandlePostSendAsync (cyclomatic 24) · ×1
  • WatchServer.HandlePostSendAsync (cyclomatic 24) src/officecli/Core/Watch/WatchServer.cs:2311 — WatchServer.HandlePostSendAsync 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 · ExcelHandler.TryGetStableNumericDisplay (cyclomatic 24) · ×1
  • ExcelHandler.TryGetStableNumericDisplay (cyclomatic 24) src/officecli/Handlers/Excel/ExcelHandler.CheckNumericOverflow.cs:277 — ExcelHandler.TryGetStableNumericDisplay 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 · ExcelHandler.BuildCommentRunProperties (cyclomatic 24) · ×1
  • ExcelHandler.BuildCommentRunProperties (cyclomatic 24) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Node.cs:868 — ExcelHandler.BuildCommentRunProperties 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 · ExcelHandler.MatchesCellSelector (cyclomatic 24) · ×1
  • ExcelHandler.MatchesCellSelector (cyclomatic 24) src/officecli/Handlers/Excel/ExcelHandler.Selector.cs:132 — ExcelHandler.MatchesCellSelector 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 · ExcelHandler.SetTableColumnByPath (cyclomatic 24) · ×1
  • ExcelHandler.SetTableColumnByPath (cyclomatic 24) src/officecli/Handlers/Excel/ExcelHandler.Set.Tables.cs:296 — ExcelHandler.SetTableColumnByPath has cyclomatic complexity 24 (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 · PowerPointHandler.GetOlesOnSlide (cyclomatic 24) · ×1
  • PowerPointHandler.GetOlesOnSlide (cyclomatic 24) REDACTED:4111 — PowerPointHandler.GetOlesOnSlide 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 · PowerPointHandler.ApplyMotionPathAnimation (cyclomatic 24) · ×1
  • PowerPointHandler.ApplyMotionPathAnimation (cyclomatic 24) src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:1702 — PowerPointHandler.ApplyMotionPathAnimation has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: PowerPointHandler.ResolveAnimEffectName (cyclomatic 62) 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 · PowerPointHandler.ParseShapeSelector (cyclomatic 24) · ×1
  • PowerPointHandler.ParseShapeSelector (cyclomatic 24) src/officecli/Handlers/Pptx/PowerPointHandler.Selector.cs:98 — PowerPointHandler.ParseShapeSelector 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 · PowerPointHandler.RenderConnectorSvg (cyclomatic 24) · ×1
  • PowerPointHandler.RenderConnectorSvg (cyclomatic 24) src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:1037 — PowerPointHandler.RenderConnectorSvg 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: PowerPointHandler.GetPresetPolygonPoints (cyclomatic 60) 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 · PowerPointHandler.RenderTableSvg (cyclomatic 24) · ×1
  • PowerPointHandler.RenderTableSvg (cyclomatic 24) src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:1121 — PowerPointHandler.RenderTableSvg has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: PowerPointHandler.GetPresetPolygonPoints (cyclomatic 60) 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 · WordBatchEmitter.TryEmitOleRun (cyclomatic 24) · ×1
  • WordBatchEmitter.TryEmitOleRun (cyclomatic 24) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:4042 — WordBatchEmitter.TryEmitOleRun 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 · WordHandler.AddMarkdown (cyclomatic 24) · ×1
  • WordHandler.AddMarkdown (cyclomatic 24) src/officecli/Handlers/Word/WordHandler.Add.Markdown.cs:32 — WordHandler.AddMarkdown has cyclomatic complexity 24 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · WordHandler.AddBreak (cyclomatic 24) · ×1
  • WordHandler.AddBreak (cyclomatic 24) src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:2067 — WordHandler.AddBreak has cyclomatic complexity 24 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table. This is NOT this file's highest cyclomatic complexity: WordHandler.IsUriSafe (cyclomatic 29) 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 · WordHandler.RecoverWrapperRunTexts (cyclomatic 24) · ×1
  • WordHandler.RecoverWrapperRunTexts (cyclomatic 24) src/officecli/Handlers/Word/WordHandler.Navigation.cs:1111 — WordHandler.RecoverWrapperRunTexts 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 · WordHandler.CollectParaRunInHeaderFooter (cyclomatic 24) · ×1
  • WordHandler.CollectParaRunInHeaderFooter (cyclomatic 24) src/officecli/Handlers/Word/WordHandler.Query.cs:3249 — WordHandler.CollectParaRunInHeaderFooter 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 · SchemaHelpRenderer.RenderProperty (cyclomatic 24) · ×1
  • SchemaHelpRenderer.RenderProperty (cyclomatic 24) src/officecli/Help/SchemaHelpRenderer.cs:319 — SchemaHelpRenderer.RenderProperty 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 · BatchItemConverter.Write (cyclomatic 23) · ×1
  • BatchItemConverter.Write (cyclomatic 23) src/officecli/BatchTypes.cs:117 — BatchItemConverter.Write 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 · ChartHelper.BuildLabelTextProperties (cyclomatic 23) · ×1
  • ChartHelper.BuildLabelTextProperties (cyclomatic 23) src/officecli/Core/Chart/ChartHelper.Setter.cs:3659 — ChartHelper.BuildLabelTextProperties 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 · ChartSvgRenderer.RenderPie3DSvg (cyclomatic 23) · ×1
  • ChartSvgRenderer.RenderPie3DSvg (cyclomatic 23) src/officecli/Core/Chart/ChartSvgRenderer.cs:5276 — ChartSvgRenderer.RenderPie3DSvg 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FormulaEvaluator.EvalLookup (cyclomatic 23) · ×1
  • FormulaEvaluator.EvalLookup (cyclomatic 23) src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:1232 — FormulaEvaluator.EvalLookup 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 · HtmlScreenshot.CaptureClipped (cyclomatic 23) · ×1
  • HtmlScreenshot.CaptureClipped (cyclomatic 23) src/officecli/Core/HtmlScreenshot.cs:186 — HtmlScreenshot.CaptureClipped 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 · ImageSource.TrySniffContentType (cyclomatic 23) · ×1
  • ImageSource.TrySniffContentType (cyclomatic 23) src/officecli/Core/ImageSource.cs:209 — ImageSource.TrySniffContentType has cyclomatic complexity 23 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · PivotTableHelper.ReadColumnDataFromCache (cyclomatic 23) · ×1
  • PivotTableHelper.ReadColumnDataFromCache (cyclomatic 23) src/officecli/Core/PivotTableHelper.cs:1921 — PivotTableHelper.ReadColumnDataFromCache has cyclomatic complexity 23 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · WordNumFmtRenderer.BuildCjkGrouped (cyclomatic 23) · ×1
  • WordNumFmtRenderer.BuildCjkGrouped (cyclomatic 23) src/officecli/Core/WordNumFmtRenderer.cs:320 — WordNumFmtRenderer.BuildCjkGrouped has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: WordNumFmtRenderer.Render (cyclomatic 65) 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 · ExcelBatchEmitter.EmitSheetSettings (cyclomatic 23) · ×1
  • ExcelBatchEmitter.EmitSheetSettings (cyclomatic 23) src/officecli/Handlers/Excel/ExcelBatchEmitter.cs:534 — ExcelBatchEmitter.EmitSheetSettings 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 · ExcelHandler.ApplyTransform2DRotationFlip (cyclomatic 23) · ×1
  • ExcelHandler.ApplyTransform2DRotationFlip (cyclomatic 23) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:245 — ExcelHandler.ApplyTransform2DRotationFlip has cyclomatic complexity 23 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · ExcelHandler.ValidateSqref (cyclomatic 23) · ×1
  • ExcelHandler.ValidateSqref (cyclomatic 23) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Validation.cs:36 — ExcelHandler.ValidateSqref has cyclomatic complexity 23 (threshold 15). Of this number, 15 points are the body's own statements and 8 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 · ExcelHandler.NormalizeValidationFormula (cyclomatic 23) · ×1
  • ExcelHandler.NormalizeValidationFormula (cyclomatic 23) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Validation.cs:374 — ExcelHandler.NormalizeValidationFormula 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 · ExcelHandler.PopulateCfNodeFromDxf (cyclomatic 23) · ×1
  • ExcelHandler.PopulateCfNodeFromDxf (cyclomatic 23) src/officecli/Handlers/Excel/ExcelHandler.Query.cs:2034 — ExcelHandler.PopulateCfNodeFromDxf 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 · PowerPointHandler.BuildPptRunFromProperties (cyclomatic 23) · ×1
  • PowerPointHandler.BuildPptRunFromProperties (cyclomatic 23) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.FindReplace.cs:688 — PowerPointHandler.BuildPptRunFromProperties has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · PowerPointHandler.AggregateTableOuterBorders (cyclomatic 23) · ×1
  • PowerPointHandler.AggregateTableOuterBorders (cyclomatic 23) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:3532 — PowerPointHandler.AggregateTableOuterBorders 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 · WordBatchEmitter.ComputeParagraphChildDocOrder (cyclomatic 23) · ×1
  • WordBatchEmitter.ComputeParagraphChildDocOrder (cyclomatic 23) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:530 — WordBatchEmitter.ComputeParagraphChildDocOrder 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 · WordBatchEmitter.CaptureChartAnchorProps (cyclomatic 23) · ×1
  • WordBatchEmitter.CaptureChartAnchorProps (cyclomatic 23) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:3247 — WordBatchEmitter.CaptureChartAnchorProps 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 · WordBatchEmitter.EmitStructuredHyperlink (cyclomatic 23) · ×1
  • WordBatchEmitter.EmitStructuredHyperlink (cyclomatic 23) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:4494 — WordBatchEmitter.EmitStructuredHyperlink 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 · WordHandler.ComputeAnchorWrapFloatCss (cyclomatic 23) · ×1
  • WordHandler.ComputeAnchorWrapFloatCss (cyclomatic 23) REDACTED:807 — WordHandler.ComputeAnchorWrapFloatCss has cyclomatic complexity 23 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.GetConditionalTypes (cyclomatic 23) · ×1
  • WordHandler.GetConditionalTypes (cyclomatic 23) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Tables.cs:920 — WordHandler.GetConditionalTypes 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 · WordHandler.SetElement (cyclomatic 23) · ×1
  • WordHandler.SetElement (cyclomatic 23) src/officecli/Handlers/Word/WordHandler.Set.cs:599 — WordHandler.SetElement has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: WordHandler.ParseNumberFormat (cyclomatic 65) 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 · WordHandler.PopulateDocDefaults (cyclomatic 23) · ×1
  • WordHandler.PopulateDocDefaults (cyclomatic 23) src/officecli/Handlers/Word/WordHandler.Set.DocDefaults.cs:312 — WordHandler.PopulateDocDefaults 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 · ResidentServer.ExecuteCommand (cyclomatic 23) · ×1
  • ResidentServer.ExecuteCommand (cyclomatic 23) src/officecli/ResidentServer.cs:1112 — ResidentServer.ExecuteCommand has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · watch-overlay.document.addEventListener("click") (cyclomatic 23) · ×1
  • watch-overlay.document.addEventListener("click") (cyclomatic 23) src/officecli/Resources/watch-overlay.js:547 — watch-overlay.document.addEventListener("click") 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 · watch-overlay.document.addEventListener("mouseup") (cyclomatic 23) · ×1
  • watch-overlay.document.addEventListener("mouseup") (cyclomatic 23) src/officecli/Resources/watch-overlay.js:912 — watch-overlay.document.addEventListener("mouseup") has cyclomatic complexity 23 (threshold 15). Of this number, 14 points are the body's own statements and 9 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 · CommandBuilder.CheckPositionOverlap (cyclomatic 22) · ×1
  • CommandBuilder.CheckPositionOverlap (cyclomatic 22) src/officecli/CommandBuilder.cs:2064 — CommandBuilder.CheckPositionOverlap 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 · ChartSvgRenderer.RenderOfPieChartSvg (cyclomatic 22) · ×1
  • ChartSvgRenderer.RenderOfPieChartSvg (cyclomatic 22) src/officecli/Core/Chart/ChartSvgRenderer.cs:1938 — ChartSvgRenderer.RenderOfPieChartSvg 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 · ChartSvgRenderer.RenderStockChartSvg (cyclomatic 22) · ×1
  • ChartSvgRenderer.RenderStockChartSvg (cyclomatic 22) src/officecli/Core/Chart/ChartSvgRenderer.cs:2969 — ChartSvgRenderer.RenderStockChartSvg 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 · FormulaEvaluator.EvalTextBeforeAfter (cyclomatic 22) · ×1
  • FormulaEvaluator.EvalTextBeforeAfter (cyclomatic 22) src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:737 — FormulaEvaluator.EvalTextBeforeAfter 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 · FormulaEvaluator.CompareValues (cyclomatic 22) · ×1
  • FormulaEvaluator.CompareValues (cyclomatic 22) src/officecli/Core/Formula/FormulaEvaluator.Helpers.cs:19 — FormulaEvaluator.CompareValues 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 · MarkdownParser.ParseList (cyclomatic 22) · ×1
  • MarkdownParser.ParseList (cyclomatic 22) src/officecli/Core/Markdown/MarkdownParser.cs:231 — MarkdownParser.ParseList 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 · DumpReaderInvoker.Run (cyclomatic 22) · ×1
  • DumpReaderInvoker.Run (cyclomatic 22) src/officecli/Core/Plugins/DumpReaderInvoker.cs:35 — DumpReaderInvoker.Run has cyclomatic complexity 22 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · RawXmlHelper.FirstOutOfGridToken (cyclomatic 22) · ×1
  • RawXmlHelper.FirstOutOfGridToken (cyclomatic 22) src/officecli/Core/RawXmlHelper.cs:1092 — RawXmlHelper.FirstOutOfGridToken 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 · WatchServer.FindDataPathInHtmlExact (cyclomatic 22) · ×1
  • WatchServer.FindDataPathInHtmlExact (cyclomatic 22) src/officecli/Core/Watch/WatchServer.cs:1090 — WatchServer.FindDataPathInHtmlExact 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 · ExcelHandler.BuildDataBarMap (cyclomatic 22) · ×1
  • ExcelHandler.BuildDataBarMap (cyclomatic 22) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:1383 — ExcelHandler.BuildDataBarMap has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: ExcelHandler.ResolveBuiltInFormat (cyclomatic 25) 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 · ExcelHandler.ApplyCommentVmlMutations (cyclomatic 22) · ×1
  • ExcelHandler.ApplyCommentVmlMutations (cyclomatic 22) src/officecli/Handlers/Excel/ExcelHandler.SheetShift.cs:615 — ExcelHandler.ApplyCommentVmlMutations 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 · PowerPointHandler.NormalizeGradientValue (cyclomatic 22) · ×1
  • PowerPointHandler.NormalizeGradientValue (cyclomatic 22) src/officecli/Handlers/Pptx/PowerPointHandler.Background.cs:734 — PowerPointHandler.NormalizeGradientValue has cyclomatic complexity 22 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · PowerPointHandler.Model3DToNode (cyclomatic 22) · ×1
  • PowerPointHandler.Model3DToNode (cyclomatic 22) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Zoom3D.cs:113 — PowerPointHandler.Model3DToNode has cyclomatic complexity 22 (threshold 15). Of this number, 20 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 · PowerPointHandler.ViewAsHtml (cyclomatic 22) · ×1
  • PowerPointHandler.ViewAsHtml (cyclomatic 22) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.cs:72 — PowerPointHandler.ViewAsHtml 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 · PowerPointHandler.PathToSvgD (cyclomatic 22) · ×1
  • PowerPointHandler.PathToSvgD (cyclomatic 22) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:437 — PowerPointHandler.PathToSvgD has cyclomatic complexity 22 (threshold 15). Of this number, 18 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · PowerPointHandler.RenderGroup (cyclomatic 22) · ×1
  • PowerPointHandler.RenderGroup (cyclomatic 22) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2275 — PowerPointHandler.RenderGroup has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: PowerPointHandler.GetShapeTextInsetPercent (cyclomatic 30) 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 · PptxBatchEmitter.EmitPptx (cyclomatic 22) · ×1
  • PptxBatchEmitter.EmitPptx (cyclomatic 22) src/officecli/Handlers/Pptx/PptxBatchEmitter.cs:378 — PptxBatchEmitter.EmitPptx has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PptxBatchEmitter.EmitNotes (cyclomatic 22) · ×1
  • PptxBatchEmitter.EmitNotes (cyclomatic 22) src/officecli/Handlers/Pptx/PptxBatchEmitter.Notes.cs:25 — PptxBatchEmitter.EmitNotes 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 · WordBatchEmitter.CoalesceHyperlinkRuns (cyclomatic 22) · ×1
  • WordBatchEmitter.CoalesceHyperlinkRuns (cyclomatic 22) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:4852 — WordBatchEmitter.CoalesceHyperlinkRuns 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 · WordBatchEmitter.StripDanglingNoteSeparatorRefs (cyclomatic 22) · ×1
  • WordBatchEmitter.StripDanglingNoteSeparatorRefs (cyclomatic 22) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:157 — WordBatchEmitter.StripDanglingNoteSeparatorRefs has cyclomatic complexity 22 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · WordHandler.AddTab (cyclomatic 22) · ×1
  • WordHandler.AddTab (cyclomatic 22) src/officecli/Handlers/Word/WordHandler.Add.Text.cs:3276 — WordHandler.AddTab 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 · WordHandler.RenderBorderCss (cyclomatic 22) · ×1
  • WordHandler.RenderBorderCss (cyclomatic 22) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:2578 — WordHandler.RenderBorderCss has cyclomatic complexity 22 (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 · WordHandler.ResolveBodyMetricsForMarker (cyclomatic 22) · ×1
  • WordHandler.ResolveBodyMetricsForMarker (cyclomatic 22) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Markers.cs:260 — WordHandler.ResolveBodyMetricsForMarker 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 · WordHandler.RemoveWithTrackChange (cyclomatic 22) · ×1
  • WordHandler.RemoveWithTrackChange (cyclomatic 22) src/officecli/Handlers/Word/WordHandler.Mutations.cs:908 — WordHandler.RemoveWithTrackChange has cyclomatic complexity 22 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.HyperlinkToNode (cyclomatic 22) · ×1
  • WordHandler.HyperlinkToNode (cyclomatic 22) src/officecli/Handlers/Word/WordHandler.Navigation.cs:3110 — WordHandler.HyperlinkToNode 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 · WordHandler.ApplyCommentFormatKeys (cyclomatic 22) · ×1
  • WordHandler.ApplyCommentFormatKeys (cyclomatic 22) src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs:674 — WordHandler.ApplyCommentFormatKeys 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 · WordHandler.EnumerateRevisions (cyclomatic 22) · ×1
  • WordHandler.EnumerateRevisions (cyclomatic 22) src/officecli/Handlers/Word/WordHandler.Set.Revision.cs:1051 — WordHandler.EnumerateRevisions has cyclomatic complexity 22 (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. This is NOT this file's highest cyclomatic complexity: WordHandler.RevisionTypeMatches (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 · McpServer.RunAsync (cyclomatic 22) · ×1
  • McpServer.RunAsync (cyclomatic 22) src/officecli/McpServer.cs:27 — McpServer.RunAsync 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 · BatchItem.ToResidentRequest (cyclomatic 21) · ×1
  • BatchItem.ToResidentRequest (cyclomatic 21) src/officecli/BatchTypes.cs:204 — BatchItem.ToResidentRequest 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 · EmuConverter.ParseEmu (cyclomatic 21) · ×1
  • EmuConverter.ParseEmu (cyclomatic 21) src/officecli/Core/EmuConverter.cs:50 — EmuConverter.ParseEmu 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 · ModernFunctionQualifier.Qualify (cyclomatic 21) · ×1
  • ModernFunctionQualifier.Qualify (cyclomatic 21) src/officecli/Core/Formula/ModernFunctionQualifier.cs:289 — ModernFunctionQualifier.Qualify 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 · PivotTableHelper.BuildMultiColItems (cyclomatic 21) · ×1
  • PivotTableHelper.BuildMultiColItems (cyclomatic 21) src/officecli/Core/PivotTableHelper.Definition.cs:902 — PivotTableHelper.BuildMultiColItems 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 · RawXmlHelper.DetectOutOfGridSheetRefs (cyclomatic 21) · ×1
  • RawXmlHelper.DetectOutOfGridSheetRefs (cyclomatic 21) src/officecli/Core/RawXmlHelper.cs:1001 — RawXmlHelper.DetectOutOfGridSheetRefs 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 · TypedAttributeFallback.TrySet (cyclomatic 21) · ×1
  • TypedAttributeFallback.TrySet (cyclomatic 21) src/officecli/Core/TypedAttributeFallback.cs:84 — TypedAttributeFallback.TrySet 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 · UpdateChecker.IsNativeBinary (cyclomatic 21) · ×1
  • UpdateChecker.IsNativeBinary (cyclomatic 21) src/officecli/Core/UpdateChecker.cs:680 — UpdateChecker.IsNativeBinary 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 · ExcelHandler.BackfillSeriesRangeValues (cyclomatic 21) · ×1
  • ExcelHandler.BackfillSeriesRangeValues (cyclomatic 21) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Chart.cs:701 — ExcelHandler.BackfillSeriesRangeValues has cyclomatic complexity 21 (threshold 15). Of this number, 20 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 · ExcelHandler.TryBuildRichTextHtml (cyclomatic 21) · ×1
  • ExcelHandler.TryBuildRichTextHtml (cyclomatic 21) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:2985 — ExcelHandler.TryBuildRichTextHtml 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: ExcelHandler.ResolveBuiltInFormat (cyclomatic 25) 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 · ExcelHandler.ParseCsv (cyclomatic 21) · ×1
  • ExcelHandler.ParseCsv (cyclomatic 21) src/officecli/Handlers/Excel/ExcelHandler.Import.cs:425 — ExcelHandler.ParseCsv 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 · ExcelHandler.SetNamedRangeByPath (cyclomatic 21) · ×1
  • ExcelHandler.SetNamedRangeByPath (cyclomatic 21) src/officecli/Handlers/Excel/ExcelHandler.Set.Tables.cs:18 — ExcelHandler.SetNamedRangeByPath 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 · PowerPointHandler.RemoveSingleShapeAnimation (cyclomatic 21) · ×1
  • PowerPointHandler.RemoveSingleShapeAnimation (cyclomatic 21) src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:1561 — PowerPointHandler.RemoveSingleShapeAnimation 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: PowerPointHandler.ResolveAnimEffectName (cyclomatic 62) 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 · PowerPointHandler.ChartToNode (cyclomatic 21) · ×1
  • PowerPointHandler.ChartToNode (cyclomatic 21) src/officecli/Handlers/Pptx/PowerPointHandler.Chart.cs:135 — PowerPointHandler.ChartToNode 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 · PowerPointHandler.ZoomToNode (cyclomatic 21) · ×1
  • PowerPointHandler.ZoomToNode (cyclomatic 21) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Zoom3D.cs:207 — PowerPointHandler.ZoomToNode 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 · PowerPointHandler.RenderSlideElements (cyclomatic 21) · ×1
  • PowerPointHandler.RenderSlideElements (cyclomatic 21) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.cs:658 — PowerPointHandler.RenderSlideElements has cyclomatic complexity 21 (threshold 15). Of this number, 15 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 · PowerPointHandler.RenderInheritedShape (cyclomatic 21) · ×1
  • PowerPointHandler.RenderInheritedShape (cyclomatic 21) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.cs:857 — PowerPointHandler.RenderInheritedShape 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 · PowerPointHandler.ResolveFillColor (cyclomatic 21) · ×1
  • PowerPointHandler.ResolveFillColor (cyclomatic 21) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2760 — PowerPointHandler.ResolveFillColor 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 · PowerPointHandler.ResolvePlaceholderFontSize (cyclomatic 21) · ×1
  • PowerPointHandler.ResolvePlaceholderFontSize (cyclomatic 21) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:1030 — PowerPointHandler.ResolvePlaceholderFontSize 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: PowerPointHandler.GetShapeTextInsetPercent (cyclomatic 30) 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 · PowerPointHandler.ResolvePlaceholderLevelPpr (cyclomatic 21) · ×1
  • PowerPointHandler.ResolvePlaceholderLevelPpr (cyclomatic 21) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:1150 — PowerPointHandler.ResolvePlaceholderLevelPpr 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: PowerPointHandler.GetShapeTextInsetPercent (cyclomatic 30) 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 · PowerPointHandler.RenderModel3D (cyclomatic 21) · ×1
  • PowerPointHandler.RenderModel3D (cyclomatic 21) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2709 — PowerPointHandler.RenderModel3D 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: PowerPointHandler.GetShapeTextInsetPercent (cyclomatic 30) 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 · PowerPointHandler.SetTableRowByPath (cyclomatic 21) · ×1
  • PowerPointHandler.SetTableRowByPath (cyclomatic 21) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Table.cs:46 — PowerPointHandler.SetTableRowByPath has cyclomatic complexity 21 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · PowerPointHandler.CustomGeometryToSvgPath (cyclomatic 21) · ×1
  • PowerPointHandler.CustomGeometryToSvgPath (cyclomatic 21) src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:1929 — PowerPointHandler.CustomGeometryToSvgPath 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: PowerPointHandler.GetPresetPolygonPoints (cyclomatic 60) 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 · PowerPointHandler.ViewAsStats (cyclomatic 21) · ×1
  • PowerPointHandler.ViewAsStats (cyclomatic 21) src/officecli/Handlers/Pptx/PowerPointHandler.View.cs:220 — PowerPointHandler.ViewAsStats has cyclomatic complexity 21 (threshold 15). Of this number, 20 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 · WordBatchEmitter.EmitWordWithWarnings (cyclomatic 21) · ×1
  • WordBatchEmitter.EmitWordWithWarnings (cyclomatic 21) src/officecli/Handlers/Word/WordBatchEmitter.cs:182 — WordBatchEmitter.EmitWordWithWarnings has cyclomatic complexity 21 (threshold 15). Of this number, 14 points are the body's own statements and 7 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 · WordBatchEmitter.FoldBorderValue (cyclomatic 21) · ×1
  • WordBatchEmitter.FoldBorderValue (cyclomatic 21) src/officecli/Handlers/Word/WordBatchEmitter.Filters.cs:514 — WordBatchEmitter.FoldBorderValue 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: WordBatchEmitter.IsForwardableNoteFirstParaKey (cyclomatic 45) 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 · WordBatchEmitter.EmitSdt (cyclomatic 21) · ×1
  • WordBatchEmitter.EmitSdt (cyclomatic 21) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:2629 — WordBatchEmitter.EmitSdt 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 · WordHandler.AddChart (cyclomatic 21) · ×1
  • WordHandler.AddChart (cyclomatic 21) src/officecli/Handlers/Word/WordHandler.Add.Media.cs:16 — WordHandler.AddChart 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 · WordHandler.AddBlockAtSplitPoint (cyclomatic 21) · ×1
  • WordHandler.AddBlockAtSplitPoint (cyclomatic 21) src/officecli/Handlers/Word/WordHandler.Helpers.FindReplace.cs:1303 — WordHandler.AddBlockAtSplitPoint 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 · WordHandler.GetRunText (cyclomatic 21) · ×1
  • WordHandler.GetRunText (cyclomatic 21) src/officecli/Handlers/Word/WordHandler.Helpers.Text.cs:380 — WordHandler.GetRunText has cyclomatic complexity 21 (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 · WordHandler.RenderWrapNoneOverlayImage (cyclomatic 21) · ×1
  • WordHandler.RenderWrapNoneOverlayImage (cyclomatic 21) REDACTED:451 — WordHandler.RenderWrapNoneOverlayImage 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 · WordHandler.GetHeaderNode (cyclomatic 21) · ×1
  • WordHandler.GetHeaderNode (cyclomatic 21) src/officecli/Handlers/Word/WordHandler.Query.cs:1506 — WordHandler.GetHeaderNode has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (WordHandler.GetFooterNode) 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 · WordHandler.GetFooterNode (cyclomatic 21) · ×1
  • WordHandler.GetFooterNode (cyclomatic 21) src/officecli/Handlers/Word/WordHandler.Query.cs:1594 — WordHandler.GetFooterNode has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (WordHandler.GetHeaderNode) 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 · WordHandler.ParseBorderValueDetailed (cyclomatic 21) · ×1
  • WordHandler.ParseBorderValueDetailed (cyclomatic 21) src/officecli/Handlers/Word/WordHandler.Set.cs:1046 — WordHandler.ParseBorderValueDetailed 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: WordHandler.ParseNumberFormat (cyclomatic 65) 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 · WordHandler.SetTocPath (cyclomatic 21) · ×1
  • WordHandler.SetTocPath (cyclomatic 21) src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs:425 — WordHandler.SetTocPath 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 · WordHandler.ExtractRevisionText (cyclomatic 21) · ×1
  • WordHandler.ExtractRevisionText (cyclomatic 21) src/officecli/Handlers/Word/WordHandler.Set.Revision.cs:1471 — WordHandler.ExtractRevisionText has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: WordHandler.RevisionTypeMatches (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 · WordHandler.GetTableStructuralBookmarks (cyclomatic 21) · ×1
  • WordHandler.GetTableStructuralBookmarks (cyclomatic 21) src/officecli/Handlers/WordHandler.cs:731 — WordHandler.GetTableStructuralBookmarks 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 · CommandBuilder.BuildRootCommand (cyclomatic 20) · ×1
  • CommandBuilder.BuildRootCommand (cyclomatic 20) src/officecli/CommandBuilder.cs:15 — CommandBuilder.BuildRootCommand has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 2 of the 20 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 88, 33, 136). 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 · ExprParser.ParsePredicate (cyclomatic 20) · ×1
  • ExprParser.ParsePredicate (cyclomatic 20) src/officecli/Core/AttributeFilter.cs:1354 — ExprParser.ParsePredicate 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 · CompoundFile.WriteSingleStream (cyclomatic 20) · ×1
  • CompoundFile.WriteSingleStream (cyclomatic 20) src/officecli/Core/CompoundFile.cs:54 — CompoundFile.WriteSingleStream 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 · ExcelStyleManager.GetOrCreateGradientFill (cyclomatic 20) · ×1
  • ExcelStyleManager.GetOrCreateGradientFill (cyclomatic 20) src/officecli/Core/ExcelStyleManager.cs:1411 — ExcelStyleManager.GetOrCreateGradientFill has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: ExcelStyleManager.ParsePatternType (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · FormulaParser.RewriteOver (cyclomatic 20) · ×1
  • FormulaParser.RewriteOver (cyclomatic 20) src/officecli/Core/Formula/FormulaParser.cs:197 — FormulaParser.RewriteOver has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: FormulaParser.CommandToSymbol (cyclomatic 213) 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 · ImageSource.TryGetJpegDimensions (cyclomatic 20) · ×1
  • ImageSource.TryGetJpegDimensions (cyclomatic 20) src/officecli/Core/ImageSource.cs:329 — ImageSource.TryGetJpegDimensions 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 · Installer.InstallBinary (cyclomatic 20) · ×1
  • Installer.InstallBinary (cyclomatic 20) src/officecli/Core/Installer.cs:115 — Installer.InstallBinary 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 · ParseHelpers.IsCjkOrFullWidth (cyclomatic 20) · ×1
  • ParseHelpers.IsCjkOrFullWidth (cyclomatic 20) src/officecli/Core/ParseHelpers.cs:846 — ParseHelpers.IsCjkOrFullWidth 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 · PivotTableHelper.BuildMultiRowItems (cyclomatic 20) · ×1
  • PivotTableHelper.BuildMultiRowItems (cyclomatic 20) src/officecli/Core/PivotTableHelper.Definition.cs:763 — PivotTableHelper.BuildMultiRowItems 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 · WatchServer.ComputeExcelPatches (cyclomatic 20) · ×1
  • WatchServer.ComputeExcelPatches (cyclomatic 20) src/officecli/Core/Watch/WatchServer.cs:1724 — WatchServer.ComputeExcelPatches 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ExcelBatchEmitter.EmitTables (cyclomatic 20) · ×1
  • ExcelBatchEmitter.EmitTables (cyclomatic 20) src/officecli/Handlers/Excel/ExcelBatchEmitter.Elements.cs:79 — ExcelBatchEmitter.EmitTables 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 · ExcelHandler.ResolveChartRangeCells (cyclomatic 20) · ×1
  • ExcelHandler.ResolveChartRangeCells (cyclomatic 20) src/officecli/Handlers/Excel/ExcelHandler.ChartCache.cs:95 — ExcelHandler.ResolveChartRangeCells 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 · ExcelHandler.EvaluateCellOverflow (cyclomatic 20) · ×1
  • ExcelHandler.EvaluateCellOverflow (cyclomatic 20) src/officecli/Handlers/Excel/ExcelHandler.CheckOverflow.cs:133 — ExcelHandler.EvaluateCellOverflow 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 · ExcelHandler.TrySetAnchorPosition (cyclomatic 20) · ×1
  • ExcelHandler.TrySetAnchorPosition (cyclomatic 20) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:922 — ExcelHandler.TrySetAnchorPosition 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 · ExcelHandler.TryResolveRowColumnCell (cyclomatic 20) · ×1
  • ExcelHandler.TryResolveRowColumnCell (cyclomatic 20) src/officecli/Handlers/Excel/ExcelHandler.Query.RowWhere.cs:390 — ExcelHandler.TryResolveRowColumnCell 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 · ExcelHandler.FindDefinedNameReferences (cyclomatic 20) · ×1
  • ExcelHandler.FindDefinedNameReferences (cyclomatic 20) src/officecli/Handlers/Excel/ExcelHandler.Set.Tables.cs:134 — ExcelHandler.FindDefinedNameReferences 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 · PowerPointHandler.Raw (cyclomatic 20) · ×1
  • PowerPointHandler.Raw (cyclomatic 20) REDACTED:201 — PowerPointHandler.Raw 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 · PowerPointHandler.GetModel3dOnSlide (cyclomatic 20) · ×1
  • PowerPointHandler.GetModel3dOnSlide (cyclomatic 20) REDACTED:3966 — PowerPointHandler.GetModel3dOnSlide 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 · PowerPointHandler.GetShapeStyleXmlWithOrdinal (cyclomatic 20) · ×1
  • PowerPointHandler.GetShapeStyleXmlWithOrdinal (cyclomatic 20) REDACTED:4643 — PowerPointHandler.GetShapeStyleXmlWithOrdinal 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 · PowerPointHandler.AddDiagramAsImage (cyclomatic 20) · ×1
  • PowerPointHandler.AddDiagramAsImage (cyclomatic 20) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Diagram.cs:192 — PowerPointHandler.AddDiagramAsImage 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 · PowerPointHandler.IsPlainReflectionPreset (cyclomatic 20) · ×1
  • PowerPointHandler.IsPlainReflectionPreset (cyclomatic 20) src/officecli/Handlers/Pptx/PowerPointHandler.Effects.cs:152 — PowerPointHandler.IsPlainReflectionPreset has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: PowerPointHandler.ParseLightRig (cyclomatic 29) 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 · PowerPointHandler.AddPptAtFindPosition (cyclomatic 20) · ×1
  • PowerPointHandler.AddPptAtFindPosition (cyclomatic 20) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.FindReplace.cs:589 — PowerPointHandler.AddPptAtFindPosition 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 · PowerPointHandler.SetModernCommentProperties (cyclomatic 20) · ×1
  • PowerPointHandler.SetModernCommentProperties (cyclomatic 20) src/officecli/Handlers/Pptx/PowerPointHandler.ModernComments.cs:409 — PowerPointHandler.SetModernCommentProperties 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 · PowerPointHandler.CloneSlide (cyclomatic 20) · ×1
  • PowerPointHandler.CloneSlide (cyclomatic 20) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1653 — PowerPointHandler.CloneSlide 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 · PowerPointHandler.RemovePictureWithCleanup (cyclomatic 20) · ×1
  • PowerPointHandler.RemovePictureWithCleanup (cyclomatic 20) src/officecli/Handlers/Pptx/PowerPointHandler.Resolve.cs:467 — PowerPointHandler.RemovePictureWithCleanup 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 · PowerPointHandler.SetGroupInnerFrameByPath (cyclomatic 20) · ×1
  • PowerPointHandler.SetGroupInnerFrameByPath (cyclomatic 20) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1572 — PowerPointHandler.SetGroupInnerFrameByPath 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 · PowerPointHandler.ApplyRprLike (cyclomatic 20) · ×1
  • PowerPointHandler.ApplyRprLike (cyclomatic 20) src/officecli/Handlers/Pptx/PowerPointHandler.StyleList.cs:327 — PowerPointHandler.ApplyRprLike 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 · PptxBatchEmitter.EmitPicture (cyclomatic 20) · ×1
  • PptxBatchEmitter.EmitPicture (cyclomatic 20) src/officecli/Handlers/Pptx/PptxBatchEmitter.Media.cs:14 — PptxBatchEmitter.EmitPicture 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 · PptxBatchEmitter.EmitModernComments (cyclomatic 20) · ×1
  • PptxBatchEmitter.EmitModernComments (cyclomatic 20) src/officecli/Handlers/Pptx/PptxBatchEmitter.Notes.cs:219 — PptxBatchEmitter.EmitModernComments 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 · WordBatchEmitter.HasCustomNoteSeparator (cyclomatic 20) · ×1
  • WordBatchEmitter.HasCustomNoteSeparator (cyclomatic 20) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:246 — WordBatchEmitter.HasCustomNoteSeparator 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 · WordBatchEmitter.FoldPgBordersProps (cyclomatic 20) · ×1
  • WordBatchEmitter.FoldPgBordersProps (cyclomatic 20) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:3368 — WordBatchEmitter.FoldPgBordersProps 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 · WordHandler.ApplyNoteRefMarkAndRevision (cyclomatic 20) · ×1
  • WordHandler.ApplyNoteRefMarkAndRevision (cyclomatic 20) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:949 — WordHandler.ApplyNoteRefMarkAndRevision has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: WordHandler.StyleChildOrder (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · WordHandler.FormFieldToNode (cyclomatic 20) · ×1
  • WordHandler.FormFieldToNode (cyclomatic 20) src/officecli/Handlers/Word/WordHandler.FormFields.cs:34 — WordHandler.FormFieldToNode 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 · WordHandler.RenderChartExHtml (cyclomatic 20) · ×1
  • WordHandler.RenderChartExHtml (cyclomatic 20) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Charts.cs:122 — WordHandler.RenderChartExHtml 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 · WordHandler.AppendW14ReflectionBlock (cyclomatic 20) · ×1
  • WordHandler.AppendW14ReflectionBlock (cyclomatic 20) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:2176 — WordHandler.AppendW14ReflectionBlock 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 · WordHandler.GetPictureEffectsCss (cyclomatic 20) · ×1
  • WordHandler.GetPictureEffectsCss (cyclomatic 20) REDACTED:560 — WordHandler.GetPictureEffectsCss 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 · WordHandler.ReadShadingCanonical (cyclomatic 20) · ×1
  • WordHandler.ReadShadingCanonical (cyclomatic 20) src/officecli/Handlers/Word/WordHandler.Navigation.cs:6964 — WordHandler.ReadShadingCanonical 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 · WordHandler.FillUnknownChildProps (cyclomatic 20) · ×1
  • WordHandler.FillUnknownChildProps (cyclomatic 20) src/officecli/Handlers/Word/WordHandler.Navigation.cs:7073 — WordHandler.FillUnknownChildProps 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 · CommandBuilder.BuildAppliedSuffix (cyclomatic 19) · ×1
  • CommandBuilder.BuildAppliedSuffix (cyclomatic 19) src/officecli/CommandBuilder.cs:889 — CommandBuilder.BuildAppliedSuffix has cyclomatic complexity 19 (threshold 15). 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, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · CommandBuilder.BuildImportCommand (cyclomatic 19) · ×1
  • CommandBuilder.BuildImportCommand (cyclomatic 19) src/officecli/CommandBuilder.Import.cs:12 — CommandBuilder.BuildImportCommand 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 one function literal inside it that branches (line 40). 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 · ChartHelper.BuildTrendline (cyclomatic 19) · ×1
  • ChartHelper.BuildTrendline (cyclomatic 19) src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:64 — ChartHelper.BuildTrendline 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 · MermaidImageRenderer.ComposeSource (cyclomatic 19) · ×1
  • MermaidImageRenderer.ComposeSource (cyclomatic 19) src/officecli/Core/Diagram/MermaidImageRenderer.cs:124 — MermaidImageRenderer.ComposeSource 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 · ExtendedPropertiesHandler.PopulateExtendedProperties (cyclomatic 19) · ×1
  • ExtendedPropertiesHandler.PopulateExtendedProperties (cyclomatic 19) src/officecli/Core/ExtendedPropertiesHandler.cs:17 — ExtendedPropertiesHandler.PopulateExtendedProperties 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 · FormulaEvaluator.ParseNumber (cyclomatic 19) · ×1
  • FormulaEvaluator.ParseNumber (cyclomatic 19) src/officecli/Core/Formula/FormulaEvaluator.cs:634 — FormulaEvaluator.ParseNumber 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 · FormulaEvaluator.Expand2DRange (cyclomatic 19) · ×1
  • FormulaEvaluator.Expand2DRange (cyclomatic 19) src/officecli/Core/Formula/FormulaEvaluator.cs:1508 — FormulaEvaluator.Expand2DRange 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 · FormulaEvaluator.EvalVlookup (cyclomatic 19) · ×1
  • FormulaEvaluator.EvalVlookup (cyclomatic 19) src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:1191 — FormulaEvaluator.EvalVlookup 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: one other method here (FormulaEvaluator.EvalHlookup) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: FormulaEvaluator.EvalAggregate (cyclomatic 21) 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 · FormulaEvaluator.EvalHlookup (cyclomatic 19) · ×1
  • FormulaEvaluator.EvalHlookup (cyclomatic 19) src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:1209 — FormulaEvaluator.EvalHlookup 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: one other method here (FormulaEvaluator.EvalVlookup) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: FormulaEvaluator.EvalAggregate (cyclomatic 21) 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 · FormulaEvaluator.ActualActualYearFrac (cyclomatic 19) · ×1
  • FormulaEvaluator.ActualActualYearFrac (cyclomatic 19) src/officecli/Core/Formula/FormulaEvaluator.Securities.cs:86 — FormulaEvaluator.ActualActualYearFrac 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 · NumericText.TryRewriteCommaDecimal (cyclomatic 19) · ×1
  • NumericText.TryRewriteCommaDecimal (cyclomatic 19) src/officecli/Core/NumericText.cs:75 — NumericText.TryRewriteCommaDecimal 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 · ParseHelpers.SanitizeColorForOoxml (cyclomatic 19) · ×1
  • ParseHelpers.SanitizeColorForOoxml (cyclomatic 19) src/officecli/Core/ParseHelpers.cs:755 — ParseHelpers.SanitizeColorForOoxml 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 · PivotTableHelper.ReadSourceData (cyclomatic 19) · ×1
  • PivotTableHelper.ReadSourceData (cyclomatic 19) src/officecli/Core/PivotTableHelper.Cache.cs:255 — PivotTableHelper.ReadSourceData 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 · WatchServer.HandleClientAsync (cyclomatic 19) · ×1
  • WatchServer.HandleClientAsync (cyclomatic 19) src/officecli/Core/Watch/WatchServer.cs:1883 — WatchServer.HandleClientAsync 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 · ExcelHandler.AnchorToEmuRect (cyclomatic 19) · ×1
  • ExcelHandler.AnchorToEmuRect (cyclomatic 19) src/officecli/Handlers/Excel/ExcelHandler.DumpSupport.cs:717 — ExcelHandler.AnchorToEmuRect has cyclomatic complexity 19 (threshold 15). Of this number, 15 points are the body's own statements and 4 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExcelHandler.PopulateChartPositionFormat (cyclomatic 19) · ×1
  • ExcelHandler.PopulateChartPositionFormat (cyclomatic 19) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Chart.cs:67 — ExcelHandler.PopulateChartPositionFormat 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ExcelHandler.BuildFormulaCfFont (cyclomatic 19) · ×1
  • ExcelHandler.BuildFormulaCfFont (cyclomatic 19) src/officecli/Handlers/Excel/ExcelHandler.Helpers.ConditionalFormat.cs:198 — ExcelHandler.BuildFormulaCfFont 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 · ExcelHandler.TrySetShapeEffect (cyclomatic 19) · ×1
  • ExcelHandler.TrySetShapeEffect (cyclomatic 19) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:1226 — ExcelHandler.TrySetShapeEffect 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 · ExcelHandler.BuildCommentTextFromRuns (cyclomatic 19) · ×1
  • ExcelHandler.BuildCommentTextFromRuns (cyclomatic 19) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Node.cs:985 — ExcelHandler.BuildCommentTextFromRuns 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 · ExcelHandler.BuildIconSetMap (cyclomatic 19) · ×1
  • ExcelHandler.BuildIconSetMap (cyclomatic 19) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:1491 — ExcelHandler.BuildIconSetMap has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: ExcelHandler.ResolveBuiltInFormat (cyclomatic 25) 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 · ExcelHandler.ViewAsText (cyclomatic 19) · ×1
  • ExcelHandler.ViewAsText (cyclomatic 19) src/officecli/Handlers/Excel/ExcelHandler.View.cs:16 — ExcelHandler.ViewAsText 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 · ExcelHandler.ViewAsTextJson (cyclomatic 19) · ×1
  • ExcelHandler.ViewAsTextJson (cyclomatic 19) src/officecli/Handlers/Excel/ExcelHandler.View.cs:431 — ExcelHandler.ViewAsTextJson 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 · PowerPointHandler.GetPictureBlipCompanionParts (cyclomatic 19) · ×1
  • PowerPointHandler.GetPictureBlipCompanionParts (cyclomatic 19) REDACTED:4509 — PowerPointHandler.GetPictureBlipCompanionParts 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 · PowerPointHandler.AddModel3D (cyclomatic 19) · ×1
  • PowerPointHandler.AddModel3D (cyclomatic 19) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Model3D.cs:20 — PowerPointHandler.AddModel3D 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 · PowerPointHandler.ApplyBackground (cyclomatic 19) · ×1
  • PowerPointHandler.ApplyBackground (cyclomatic 19) src/officecli/Handlers/Pptx/PowerPointHandler.Background.cs:68 — PowerPointHandler.ApplyBackground 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 · PowerPointHandler.AddSlideComment (cyclomatic 19) · ×1
  • PowerPointHandler.AddSlideComment (cyclomatic 19) src/officecli/Handlers/Pptx/PowerPointHandler.Comments.cs:67 — PowerPointHandler.AddSlideComment 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 · PowerPointHandler.GetMathElement (cyclomatic 19) · ×1
  • PowerPointHandler.GetMathElement (cyclomatic 19) REDACTED:198 — PowerPointHandler.GetMathElement has cyclomatic complexity 19 (threshold 15). Of this number, 14 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 · PowerPointHandler.RenderNestedGroup (cyclomatic 19) · ×1
  • PowerPointHandler.RenderNestedGroup (cyclomatic 19) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2489 — PowerPointHandler.RenderNestedGroup has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: PowerPointHandler.GetShapeTextInsetPercent (cyclomatic 30) 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 · PowerPointHandler.ResolveHyperlinkTarget (cyclomatic 19) · ×1
  • PowerPointHandler.ResolveHyperlinkTarget (cyclomatic 19) src/officecli/Handlers/Pptx/PowerPointHandler.Hyperlinks.cs:33 — PowerPointHandler.ResolveHyperlinkTarget 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 · PowerPointHandler.BuildGroupNode (cyclomatic 19) · ×1
  • PowerPointHandler.BuildGroupNode (cyclomatic 19) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:255 — PowerPointHandler.BuildGroupNode 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 · PowerPointHandler.FillUnknownRunProps (cyclomatic 19) · ×1
  • PowerPointHandler.FillUnknownRunProps (cyclomatic 19) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2552 — PowerPointHandler.FillUnknownRunProps 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 · PowerPointHandler.PopulatePresentationSettings (cyclomatic 19) · ×1
  • PowerPointHandler.PopulatePresentationSettings (cyclomatic 19) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Presentation.cs:193 — PowerPointHandler.PopulatePresentationSettings has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: PowerPointHandler.TrySetPresentationSetting (cyclomatic 28) 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 · PowerPointHandler.RenderPictureSvg (cyclomatic 19) · ×1
  • PowerPointHandler.RenderPictureSvg (cyclomatic 19) src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:898 — PowerPointHandler.RenderPictureSvg has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: PowerPointHandler.GetPresetPolygonPoints (cyclomatic 60) 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 · PptxBatchEmitter.EmitChartAxesIfDifferent (cyclomatic 19) · ×1
  • PptxBatchEmitter.EmitChartAxesIfDifferent (cyclomatic 19) src/officecli/Handlers/Pptx/PptxBatchEmitter.Charts.cs:445 — PptxBatchEmitter.EmitChartAxesIfDifferent 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 · WordHandler.AddDiagramNative (cyclomatic 19) · ×1
  • WordHandler.AddDiagramNative (cyclomatic 19) src/officecli/Handlers/Word/WordHandler.Add.Diagram.cs:66 — WordHandler.AddDiagramNative 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 · WordHandler.AddFlowList (cyclomatic 19) · ×1
  • WordHandler.AddFlowList (cyclomatic 19) src/officecli/Handlers/Word/WordHandler.Add.Markdown.cs:266 — WordHandler.AddFlowList 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 · WordHandler.EvaluateIfFieldPlaceholder (cyclomatic 19) · ×1
  • WordHandler.EvaluateIfFieldPlaceholder (cyclomatic 19) src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:2853 — WordHandler.EvaluateIfFieldPlaceholder has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: WordHandler.IsUriSafe (cyclomatic 29) 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 · WordHandler.AddTableColumn (cyclomatic 19) · ×1
  • WordHandler.AddTableColumn (cyclomatic 19) src/officecli/Handlers/Word/WordHandler.Add.Table.cs:1103 — WordHandler.AddTableColumn 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 · WordHandler.EnsureBookmarkIds (cyclomatic 19) · ×1
  • WordHandler.EnsureBookmarkIds (cyclomatic 19) src/officecli/Handlers/Word/WordHandler.Helpers.Field.cs:711 — WordHandler.EnsureBookmarkIds 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 · WordHandler.SplitParagraphAtOffset (cyclomatic 19) · ×1
  • WordHandler.SplitParagraphAtOffset (cyclomatic 19) src/officecli/Handlers/Word/WordHandler.Helpers.FindReplace.cs:168 — WordHandler.SplitParagraphAtOffset 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 · WordHandler.ApplyTabsShorthand (cyclomatic 19) · ×1
  • WordHandler.ApplyTabsShorthand (cyclomatic 19) src/officecli/Handlers/Word/WordHandler.Helpers.RunFormat.cs:129 — WordHandler.ApplyTabsShorthand has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: WordHandler.NormalizeUnderlineValue (cyclomatic 21) 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 · WordHandler.ResolveThemeCjkFont (cyclomatic 19) · ×1
  • WordHandler.ResolveThemeCjkFont (cyclomatic 19) REDACTED:1833 — WordHandler.ResolveThemeCjkFont has cyclomatic complexity 19 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · WordHandler.FootnoteToNode (cyclomatic 19) · ×1
  • WordHandler.FootnoteToNode (cyclomatic 19) src/officecli/Handlers/Word/WordHandler.Navigation.cs:2011 — WordHandler.FootnoteToNode 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: one other method here (WordHandler.EndnoteToNode) 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 · WordHandler.EndnoteToNode (cyclomatic 19) · ×1
  • WordHandler.EndnoteToNode (cyclomatic 19) src/officecli/Handlers/Word/WordHandler.Navigation.cs:2105 — WordHandler.EndnoteToNode 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: one other method here (WordHandler.FootnoteToNode) 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 · WordHandler.AdvanceOrderedCounter (cyclomatic 19) · ×1
  • WordHandler.AdvanceOrderedCounter (cyclomatic 19) src/officecli/Handlers/Word/WordHandler.StyleList.cs:1074 — WordHandler.AdvanceOrderedCounter 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 · SchemaHelpFlatRenderer.BuildPropertyRecords (cyclomatic 19) · ×1
  • SchemaHelpFlatRenderer.BuildPropertyRecords (cyclomatic 19) src/officecli/Help/SchemaHelpFlatRenderer.cs:177 — SchemaHelpFlatRenderer.BuildPropertyRecords 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 · watch-overlay.applySelectionToDom (cyclomatic 19) · ×1
  • watch-overlay.applySelectionToDom (cyclomatic 19) src/officecli/Resources/watch-overlay.js:97 — watch-overlay.applySelectionToDom has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 9 of the 19 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 143, 158, 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 · LenientStringDictionaryConverter.Read (cyclomatic 18) · ×1
  • LenientStringDictionaryConverter.Read (cyclomatic 18) src/officecli/BatchTypes.cs:11 — LenientStringDictionaryConverter.Read 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 · CommandBuilder.ApplyBatchItems (cyclomatic 18) · ×1
  • CommandBuilder.ApplyBatchItems (cyclomatic 18) src/officecli/CommandBuilder.Batch.cs:65 — CommandBuilder.ApplyBatchItems 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 · ChartHelper.ParseLiteralSeriesData (cyclomatic 18) · ×1
  • ChartHelper.ParseLiteralSeriesData (cyclomatic 18) src/officecli/Core/Chart/ChartHelper.cs:264 — ChartHelper.ParseLiteralSeriesData 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: ChartHelper.ParseChartType (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 · ChartSvgRenderer.FitPolynomial (cyclomatic 18) · ×1
  • ChartSvgRenderer.FitPolynomial (cyclomatic 18) src/officecli/Core/Chart/ChartSvgRenderer.cs:5654 — ChartSvgRenderer.FitPolynomial has cyclomatic complexity 18 (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 · ExcelStyleManager.FindOrCreateCellFormat (cyclomatic 18) · ×1
  • ExcelStyleManager.FindOrCreateCellFormat (cyclomatic 18) src/officecli/Core/ExcelStyleManager.cs:1683 — ExcelStyleManager.FindOrCreateCellFormat has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: ExcelStyleManager.ParsePatternType (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · FormulaEvaluator.ParseComparison (cyclomatic 18) · ×1
  • FormulaEvaluator.ParseComparison (cyclomatic 18) src/officecli/Core/Formula/FormulaEvaluator.cs:684 — FormulaEvaluator.ParseComparison 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 · FormulaEvaluator.ApplyComparison (cyclomatic 18) · ×1
  • FormulaEvaluator.ApplyComparison (cyclomatic 18) src/officecli/Core/Formula/FormulaEvaluator.cs:714 — FormulaEvaluator.ApplyComparison 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 · FormulaEvaluator.ParseAtom (cyclomatic 18) · ×1
  • FormulaEvaluator.ParseAtom (cyclomatic 18) src/officecli/Core/Formula/FormulaEvaluator.cs:998 — FormulaEvaluator.ParseAtom 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 · FormulaEvaluator.ExcludeNestedSubtotalCells (cyclomatic 18) · ×1
  • FormulaEvaluator.ExcludeNestedSubtotalCells (cyclomatic 18) src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:542 — FormulaEvaluator.ExcludeNestedSubtotalCells 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: FormulaEvaluator.EvalAggregate (cyclomatic 21) 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 · FormulaEvaluator.EvalTextJoin (cyclomatic 18) · ×1
  • FormulaEvaluator.EvalTextJoin (cyclomatic 18) src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:920 — FormulaEvaluator.EvalTextJoin 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: FormulaEvaluator.EvalAggregate (cyclomatic 21) 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 · FormulaEvaluator.EvalAddress (cyclomatic 18) · ×1
  • FormulaEvaluator.EvalAddress (cyclomatic 18) src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:1387 — FormulaEvaluator.EvalAddress has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: FormulaEvaluator.EvalAggregate (cyclomatic 21) 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 · FormulaEvaluator.EvalCell (cyclomatic 18) · ×1
  • FormulaEvaluator.EvalCell (cyclomatic 18) src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:1470 — FormulaEvaluator.EvalCell has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table. This is NOT this file's highest cyclomatic complexity: FormulaEvaluator.EvalAggregate (cyclomatic 21) 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 · FormulaEvaluator.EvalDateDif (cyclomatic 18) · ×1
  • FormulaEvaluator.EvalDateDif (cyclomatic 18) src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:1801 — FormulaEvaluator.EvalDateDif has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: FormulaEvaluator.EvalAggregate (cyclomatic 21) 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 · ModernFunctionQualifier.IsDynamicArrayFormula (cyclomatic 18) · ×1
  • ModernFunctionQualifier.IsDynamicArrayFormula (cyclomatic 18) src/officecli/Core/Formula/ModernFunctionQualifier.cs:102 — ModernFunctionQualifier.IsDynamicArrayFormula 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 · ModernFunctionQualifier.FindNonLiteralArrayConstant (cyclomatic 18) · ×1
  • ModernFunctionQualifier.FindNonLiteralArrayConstant (cyclomatic 18) src/officecli/Core/Formula/ModernFunctionQualifier.cs:219 — ModernFunctionQualifier.FindNonLiteralArrayConstant 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 · FormatHandlerSession.Dispose (cyclomatic 18) · ×1
  • FormatHandlerSession.Dispose (cyclomatic 18) REDACTED:316 — FormatHandlerSession.Dispose has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · WatchServer.RunAsync (cyclomatic 18) · ×1
  • WatchServer.RunAsync (cyclomatic 18) src/officecli/Core/Watch/WatchServer.cs:309 — WatchServer.RunAsync 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 branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · ExcelHandler.RefreshStaleChartCaches (cyclomatic 18) · ×1
  • ExcelHandler.RefreshStaleChartCaches (cyclomatic 18) src/officecli/Handlers/Excel/ExcelHandler.ChartCache.cs:44 — ExcelHandler.RefreshStaleChartCaches 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 · ExcelHandler.GetCellDisplayValue (cyclomatic 18) · ×1
  • ExcelHandler.GetCellDisplayValue (cyclomatic 18) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Cell.cs:56 — ExcelHandler.GetCellDisplayValue 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 · ExcelHandler.ValidateFormulaArgCount (cyclomatic 18) · ×1
  • ExcelHandler.ValidateFormulaArgCount (cyclomatic 18) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Validation.cs:218 — ExcelHandler.ValidateFormulaArgCount 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 · ExcelHandler.RenderExcelCxChart (cyclomatic 18) · ×1
  • ExcelHandler.RenderExcelCxChart (cyclomatic 18) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.Charts.cs:484 — ExcelHandler.RenderExcelCxChart 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 · ExcelHandler.AddBorderSideCss (cyclomatic 18) · ×1
  • ExcelHandler.AddBorderSideCss (cyclomatic 18) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:2559 — ExcelHandler.AddBorderSideCss has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: ExcelHandler.ResolveBuiltInFormat (cyclomatic 25) 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 · PowerPointHandler.GetExternalMediaPicsOnSlide (cyclomatic 18) · ×1
  • PowerPointHandler.GetExternalMediaPicsOnSlide (cyclomatic 18) REDACTED:3806 — PowerPointHandler.GetExternalMediaPicsOnSlide 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 · PowerPointHandler.GetPictureBlipPassthroughChildrenXml (cyclomatic 18) · ×1
  • PowerPointHandler.GetPictureBlipPassthroughChildrenXml (cyclomatic 18) REDACTED:4443 — PowerPointHandler.GetPictureBlipPassthroughChildrenXml 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 · PowerPointHandler.GetShapeParagraphFieldXmls (cyclomatic 18) · ×1
  • PowerPointHandler.GetShapeParagraphFieldXmls (cyclomatic 18) REDACTED:4937 — PowerPointHandler.GetShapeParagraphFieldXmls 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 · PowerPointHandler.AddDiagramNative (cyclomatic 18) · ×1
  • PowerPointHandler.AddDiagramNative (cyclomatic 18) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Diagram.cs:64 — PowerPointHandler.AddDiagramNative 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 · PowerPointHandler.ParseEffectClassSuffix (cyclomatic 18) · ×1
  • PowerPointHandler.ParseEffectClassSuffix (cyclomatic 18) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:2265 — PowerPointHandler.ParseEffectClassSuffix has cyclomatic complexity 18 (threshold 15). Of this number, 14 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PowerPointHandler.AddCell (cyclomatic 18) · ×1
  • PowerPointHandler.AddCell (cyclomatic 18) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Table.cs:562 — PowerPointHandler.AddCell has cyclomatic complexity 18 (threshold 15). Of this number, 12 points are the body's own statements and 6 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 · PowerPointHandler.MutateBackgroundImageFill (cyclomatic 18) · ×1
  • PowerPointHandler.MutateBackgroundImageFill (cyclomatic 18) src/officecli/Handlers/Pptx/PowerPointHandler.Background.cs:366 — PowerPointHandler.MutateBackgroundImageFill 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 · PowerPointHandler.ReadSlideHeaderFooter (cyclomatic 18) · ×1
  • PowerPointHandler.ReadSlideHeaderFooter (cyclomatic 18) src/officecli/Handlers/Pptx/PowerPointHandler.Background.cs:507 — PowerPointHandler.ReadSlideHeaderFooter has cyclomatic complexity 18 (threshold 15). Of this number, 15 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 · PowerPointHandler.ReadGradientString (cyclomatic 18) · ×1
  • PowerPointHandler.ReadGradientString (cyclomatic 18) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.RunFormat.cs:363 — PowerPointHandler.ReadGradientString 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 · PowerPointHandler.ReparseFromXml (cyclomatic 18) · ×1
  • PowerPointHandler.ReparseFromXml (cyclomatic 18) REDACTED:239 — PowerPointHandler.ReparseFromXml 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 · PowerPointHandler.ParseOutline (cyclomatic 18) · ×1
  • PowerPointHandler.ParseOutline (cyclomatic 18) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:754 — PowerPointHandler.ParseOutline 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 · PowerPointHandler.RenderAlternateContent (cyclomatic 18) · ×1
  • PowerPointHandler.RenderAlternateContent (cyclomatic 18) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2584 — PowerPointHandler.RenderAlternateContent has cyclomatic complexity 18 (threshold 15). Of this number, 15 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table. This is NOT this file's highest cyclomatic complexity: PowerPointHandler.GetShapeTextInsetPercent (cyclomatic 30) 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 · PowerPointHandler.CopyTableCell (cyclomatic 18) · ×1
  • PowerPointHandler.CopyTableCell (cyclomatic 18) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1419 — PowerPointHandler.CopyTableCell 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 · PowerPointHandler.SetChartByPath (cyclomatic 18) · ×1
  • PowerPointHandler.SetChartByPath (cyclomatic 18) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Chart.cs:29 — PowerPointHandler.SetChartByPath 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 · PowerPointHandler.ApplyShapePropsCore (cyclomatic 18) · ×1
  • PowerPointHandler.ApplyShapePropsCore (cyclomatic 18) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1874 — PowerPointHandler.ApplyShapePropsCore has cyclomatic complexity 18 (threshold 15). Of this number, 13 points are the body's own statements and 5 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 · PowerPointHandler.GetMorphCheckNode (cyclomatic 18) · ×1
  • PowerPointHandler.GetMorphCheckNode (cyclomatic 18) src/officecli/Handlers/Pptx/PowerPointHandler.Theme.cs:27 — PowerPointHandler.GetMorphCheckNode has cyclomatic complexity 18 (threshold 15). Of this number, 10 points are the body's own statements and 8 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. This is NOT this file's highest cyclomatic complexity: PowerPointHandler.SetThemeProperties (cyclomatic 20) 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 · PowerPointHandler.SetFontScheme (cyclomatic 18) · ×1
  • PowerPointHandler.SetFontScheme (cyclomatic 18) src/officecli/Handlers/Pptx/PowerPointHandler.Theme.cs:278 — PowerPointHandler.SetFontScheme has cyclomatic complexity 18 (threshold 15). Of this number, 14 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between 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: PowerPointHandler.SetThemeProperties (cyclomatic 20) 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 · PowerPointHandler.ViewAsStatsJson (cyclomatic 18) · ×1
  • PowerPointHandler.ViewAsStatsJson (cyclomatic 18) src/officecli/Handlers/Pptx/PowerPointHandler.View.cs:338 — PowerPointHandler.ViewAsStatsJson 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 · WordBatchEmitter.TryEmitDisplayEquation (cyclomatic 18) · ×1
  • WordBatchEmitter.TryEmitDisplayEquation (cyclomatic 18) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:644 — WordBatchEmitter.TryEmitDisplayEquation 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 · WordBatchEmitter.TryEmitEquationRun (cyclomatic 18) · ×1
  • WordBatchEmitter.TryEmitEquationRun (cyclomatic 18) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:2012 — WordBatchEmitter.TryEmitEquationRun 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 · WordBatchEmitter.TryEmitFormFieldRun (cyclomatic 18) · ×1
  • WordBatchEmitter.TryEmitFormFieldRun (cyclomatic 18) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:2127 — WordBatchEmitter.TryEmitFormFieldRun 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 · WordHandler.ApplyNoteSeedRevision (cyclomatic 18) · ×1
  • WordHandler.ApplyNoteSeedRevision (cyclomatic 18) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:675 — WordHandler.ApplyNoteSeedRevision has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: WordHandler.StyleChildOrder (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · WordHandler.SetFormField (cyclomatic 18) · ×1
  • WordHandler.SetFormField (cyclomatic 18) src/officecli/Handlers/Word/WordHandler.FormFields.cs:169 — WordHandler.SetFormField 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 · WordHandler.ComputeParagraphAnchorAbsoluteCss (cyclomatic 18) · ×1
  • WordHandler.ComputeParagraphAnchorAbsoluteCss (cyclomatic 18) REDACTED:982 — WordHandler.ComputeParagraphAnchorAbsoluteCss 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 · WordHandler.CreateOleNode (cyclomatic 18) · ×1
  • WordHandler.CreateOleNode (cyclomatic 18) src/officecli/Handlers/Word/WordHandler.ImageHelpers.cs:908 — WordHandler.CreateOleNode 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 · WordHandler.SdtBlockToNode (cyclomatic 18) · ×1
  • WordHandler.SdtBlockToNode (cyclomatic 18) src/officecli/Handlers/Word/WordHandler.Navigation.cs:3684 — WordHandler.SdtBlockToNode 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 (WordHandler.SdtRunToNode) 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 · WordHandler.SdtRunToNode (cyclomatic 18) · ×1
  • WordHandler.SdtRunToNode (cyclomatic 18) src/officecli/Handlers/Word/WordHandler.Navigation.cs:3744 — WordHandler.SdtRunToNode 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 (WordHandler.SdtBlockToNode) 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 · WordHandler.GetParagraphListStyle (cyclomatic 18) · ×1
  • WordHandler.GetParagraphListStyle (cyclomatic 18) src/officecli/Handlers/Word/WordHandler.StyleList.cs:854 — WordHandler.GetParagraphListStyle 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 · WordHandler.FindFormFieldsInParagraph (cyclomatic 18) · ×1
  • WordHandler.FindFormFieldsInParagraph (cyclomatic 18) src/officecli/Handlers/Word/WordHandler.View.cs:81 — WordHandler.FindFormFieldsInParagraph 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 · WordHandler.TryRawSetWithinTableFast (cyclomatic 18) · ×1
  • WordHandler.TryRawSetWithinTableFast (cyclomatic 18) src/officecli/Handlers/WordHandler.cs:1997 — WordHandler.TryRawSetWithinTableFast 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 · SchemaHelpFlatRenderer.AppendPropertyRows (cyclomatic 18) · ×1
  • SchemaHelpFlatRenderer.AppendPropertyRows (cyclomatic 18) src/officecli/Help/SchemaHelpFlatRenderer.cs:274 — SchemaHelpFlatRenderer.AppendPropertyRows 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 · CommandBuilder.TryResident (cyclomatic 17) · ×1
  • CommandBuilder.TryResident (cyclomatic 17) src/officecli/CommandBuilder.cs:591 — CommandBuilder.TryResident 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 · CommandBuilder.PrintBatchResults (cyclomatic 17) · ×1
  • CommandBuilder.PrintBatchResults (cyclomatic 17) src/officecli/CommandBuilder.cs:1482 — CommandBuilder.PrintBatchResults 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 · CommandBuilder.SuggestPropertyWithDistance (cyclomatic 17) · ×1
  • CommandBuilder.SuggestPropertyWithDistance (cyclomatic 17) src/officecli/CommandBuilder.cs:1895 — CommandBuilder.SuggestPropertyWithDistance 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 · ChartExBuilder.BuildLayoutProperties (cyclomatic 17) · ×1
  • ChartExBuilder.BuildLayoutProperties (cyclomatic 17) src/officecli/Core/Chart/ChartExBuilder.cs:942 — ChartExBuilder.BuildLayoutProperties has cyclomatic complexity 17 (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 · ChartHelper.BuildDefaultRunPropertiesFromCompoundSpec (cyclomatic 17) · ×1
  • ChartHelper.BuildDefaultRunPropertiesFromCompoundSpec (cyclomatic 17) src/officecli/Core/Chart/ChartHelper.Builder.cs:1793 — ChartHelper.BuildDefaultRunPropertiesFromCompoundSpec 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: ChartHelper.BuildChartColorElement (cyclomatic 21) 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 · FontMetricsReader.SelectCmapSubtable (cyclomatic 17) · ×1
  • FontMetricsReader.SelectCmapSubtable (cyclomatic 17) src/officecli/Core/FontMetricsReader.cs:515 — FontMetricsReader.SelectCmapSubtable 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 · FormulaEvaluator.TryParseComplex (cyclomatic 17) · ×1
  • FormulaEvaluator.TryParseComplex (cyclomatic 17) src/officecli/Core/Formula/FormulaEvaluator.Complex.cs:22 — FormulaEvaluator.TryParseComplex 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 · FormulaEvaluator.MatchesCriteria (cyclomatic 17) · ×1
  • FormulaEvaluator.MatchesCriteria (cyclomatic 17) src/officecli/Core/Formula/FormulaEvaluator.Helpers.cs:99 — FormulaEvaluator.MatchesCriteria 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 · FormulaEvaluator.EvalMinverse (cyclomatic 17) · ×1
  • FormulaEvaluator.EvalMinverse (cyclomatic 17) src/officecli/Core/Formula/FormulaEvaluator.Helpers.cs:519 — FormulaEvaluator.EvalMinverse has cyclomatic complexity 17 (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 · FormulaEvaluator.EvalToColRow (cyclomatic 17) · ×1
  • FormulaEvaluator.EvalToColRow (cyclomatic 17) src/officecli/Core/Formula/FormulaEvaluator.Spill.cs:286 — FormulaEvaluator.EvalToColRow has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · Installer.MaybeAutoInstall (cyclomatic 17) · ×1
  • Installer.MaybeAutoInstall (cyclomatic 17) src/officecli/Core/Installer.cs:254 — Installer.MaybeAutoInstall 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 · MarkdownParser.TryMatchLinkSyntax (cyclomatic 17) · ×1
  • MarkdownParser.TryMatchLinkSyntax (cyclomatic 17) src/officecli/Core/Markdown/MarkdownParser.cs:470 — MarkdownParser.TryMatchLinkSyntax 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 · PivotTableHelper.ParseFieldList (cyclomatic 17) · ×1
  • PivotTableHelper.ParseFieldList (cyclomatic 17) src/officecli/Core/PivotTableHelper.Parse.cs:68 — PivotTableHelper.ParseFieldList 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: PivotTableHelper.ReducePivotValues (cyclomatic 21) 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 · RawXmlHelper.StripXmlProlog (cyclomatic 17) · ×1
  • RawXmlHelper.StripXmlProlog (cyclomatic 17) src/officecli/Core/RawXmlHelper.cs:1440 — RawXmlHelper.StripXmlProlog 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 · WorksheetBloatFilter.ProcessRow (cyclomatic 17) · ×1
  • WorksheetBloatFilter.ProcessRow (cyclomatic 17) src/officecli/Core/WorksheetBloatFilter.cs:282 — WorksheetBloatFilter.ProcessRow 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 · ExcelHandler.AddOle (cyclomatic 17) · ×1
  • ExcelHandler.AddOle (cyclomatic 17) src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:51 — ExcelHandler.AddOle 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 · ExcelHandler.MaybeExpandTablesForCell (cyclomatic 17) · ×1
  • ExcelHandler.MaybeExpandTablesForCell (cyclomatic 17) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Cell.cs:632 — ExcelHandler.MaybeExpandTablesForCell 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 · ExcelHandler.MaybeSyncTableHeaderName (cyclomatic 17) · ×1
  • ExcelHandler.MaybeSyncTableHeaderName (cyclomatic 17) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Cell.cs:712 — ExcelHandler.MaybeSyncTableHeaderName 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 · ExcelHandler.SyncSheetDimension (cyclomatic 17) · ×1
  • ExcelHandler.SyncSheetDimension (cyclomatic 17) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Sheet.cs:245 — ExcelHandler.SyncSheetDimension 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: ExcelHandler.InsertSheetProtectionInOrder (cyclomatic 30) 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 · ExcelHandler.DescribeRowColumnsHint (cyclomatic 17) · ×1
  • ExcelHandler.DescribeRowColumnsHint (cyclomatic 17) src/officecli/Handlers/Excel/ExcelHandler.Query.RowWhere.cs:475 — ExcelHandler.DescribeRowColumnsHint 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 · ExcelHandler.ViewAsAnnotated (cyclomatic 17) · ×1
  • ExcelHandler.ViewAsAnnotated (cyclomatic 17) src/officecli/Handlers/Excel/ExcelHandler.View.cs:122 — ExcelHandler.ViewAsAnnotated 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 · PowerPointHandler.GetTimingAudioRels (cyclomatic 17) · ×1
  • PowerPointHandler.GetTimingAudioRels (cyclomatic 17) REDACTED:3277 — PowerPointHandler.GetTimingAudioRels 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 · PowerPointHandler.GetShapeBlipTileXmlWithOrdinal (cyclomatic 17) · ×1
  • PowerPointHandler.GetShapeBlipTileXmlWithOrdinal (cyclomatic 17) REDACTED:4870 — PowerPointHandler.GetShapeBlipTileXmlWithOrdinal 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 · PowerPointHandler.AddMotionAnimation (cyclomatic 17) · ×1
  • PowerPointHandler.AddMotionAnimation (cyclomatic 17) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1861 — PowerPointHandler.AddMotionAnimation 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 · PowerPointHandler.ApplyBevel (cyclomatic 17) · ×1
  • PowerPointHandler.ApplyBevel (cyclomatic 17) src/officecli/Handlers/Pptx/PowerPointHandler.Effects.cs:505 — PowerPointHandler.ApplyBevel 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: PowerPointHandler.ParseLightRig (cyclomatic 29) 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 · PowerPointHandler.ProcessPptFind (cyclomatic 17) · ×1
  • PowerPointHandler.ProcessPptFind (cyclomatic 17) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.FindReplace.cs:355 — PowerPointHandler.ProcessPptFind 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 · PowerPointHandler.ReadBorderLine (cyclomatic 17) · ×1
  • PowerPointHandler.ReadBorderLine (cyclomatic 17) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Table.cs:92 — PowerPointHandler.ReadBorderLine 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 · PowerPointHandler.PatternFillToCss (cyclomatic 17) · ×1
  • PowerPointHandler.PatternFillToCss (cyclomatic 17) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:143 — PowerPointHandler.PatternFillToCss 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 · PowerPointHandler.MoveTableRow (cyclomatic 17) · ×1
  • PowerPointHandler.MoveTableRow (cyclomatic 17) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1290 — PowerPointHandler.MoveTableRow 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 · PowerPointHandler.BuildChildNodesIntoContainer (cyclomatic 17) · ×1
  • PowerPointHandler.BuildChildNodesIntoContainer (cyclomatic 17) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:125 — PowerPointHandler.BuildChildNodesIntoContainer has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · PowerPointHandler.FormatPlaceholderType (cyclomatic 17) · ×1
  • PowerPointHandler.FormatPlaceholderType (cyclomatic 17) src/officecli/Handlers/Pptx/PowerPointHandler.Resolve.cs:255 — PowerPointHandler.FormatPlaceholderType 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 · PowerPointHandler.RenderAnnotatedChildren (cyclomatic 17) · ×1
  • PowerPointHandler.RenderAnnotatedChildren (cyclomatic 17) src/officecli/Handlers/Pptx/PowerPointHandler.View.cs:100 — PowerPointHandler.RenderAnnotatedChildren has cyclomatic complexity 17 (threshold 15). Of this number, 13 points are the body's own statements and 4 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 · WordBatchEmitter.EmitWordWithWarnings (cyclomatic 17) · ×1
  • WordBatchEmitter.EmitWordWithWarnings (cyclomatic 17) src/officecli/Handlers/Word/WordBatchEmitter.cs:76 — WordBatchEmitter.EmitWordWithWarnings has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · WordBatchEmitter.TryEmitBookmarkRun (cyclomatic 17) · ×1
  • WordBatchEmitter.TryEmitBookmarkRun (cyclomatic 17) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:1383 — WordBatchEmitter.TryEmitBookmarkRun 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 · WordBatchEmitter.TryEmitBreakRun (cyclomatic 17) · ×1
  • WordBatchEmitter.TryEmitBreakRun (cyclomatic 17) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:1507 — WordBatchEmitter.TryEmitBreakRun 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 · WordHandler.AddFootnote (cyclomatic 17) · ×1
  • WordHandler.AddFootnote (cyclomatic 17) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:704 — WordHandler.AddFootnote has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (WordHandler.AddEndnote) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: WordHandler.StyleChildOrder (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · WordHandler.AddEndnote (cyclomatic 17) · ×1
  • WordHandler.AddEndnote (cyclomatic 17) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:841 — WordHandler.AddEndnote has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (WordHandler.AddFootnote) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: WordHandler.StyleChildOrder (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · WordHandler.ApplySectionColumnWidthsSpaces (cyclomatic 17) · ×1
  • WordHandler.ApplySectionColumnWidthsSpaces (cyclomatic 17) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:3093 — WordHandler.ApplySectionColumnWidthsSpaces has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: WordHandler.StyleChildOrder (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · WordHandler.ResolveRunLineHeightCss (cyclomatic 17) · ×1
  • WordHandler.ResolveRunLineHeightCss (cyclomatic 17) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:1524 — WordHandler.ResolveRunLineHeightCss 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: WordHandler.IsLikelySerif (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 · WordHandler.ReadSdtExtraProps (cyclomatic 17) · ×1
  • WordHandler.ReadSdtExtraProps (cyclomatic 17) src/officecli/Handlers/Word/WordHandler.Navigation.cs:3800 — WordHandler.ReadSdtExtraProps 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.ParseSingleSelector (cyclomatic 17) · ×1
  • WordHandler.ParseSingleSelector (cyclomatic 17) src/officecli/Handlers/Word/WordHandler.Selector.cs:56 — WordHandler.ParseSingleSelector 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 · WordHandler.ApplyFootnoteEndnoteFormatKeys (cyclomatic 17) · ×1
  • WordHandler.ApplyFootnoteEndnoteFormatKeys (cyclomatic 17) src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs:591 — WordHandler.ApplyFootnoteEndnoteFormatKeys 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.SetElementHyperlink (cyclomatic 17) · ×1
  • WordHandler.SetElementHyperlink (cyclomatic 17) src/officecli/Handlers/Word/WordHandler.Set.Element.cs:943 — WordHandler.SetElementHyperlink 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 · ResidentServer.TryAutosaveAsync (cyclomatic 17) · ×1
  • ResidentServer.TryAutosaveAsync (cyclomatic 17) src/officecli/ResidentServer.cs:489 — ResidentServer.TryAutosaveAsync 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 · ResidentServer.ExecuteDump (cyclomatic 17) · ×1
  • ResidentServer.ExecuteDump (cyclomatic 17) src/officecli/ResidentServer.cs:2009 — ResidentServer.ExecuteDump 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 · ResidentServer.ExecuteQuery (cyclomatic 17) · ×1
  • ResidentServer.ExecuteQuery (cyclomatic 17) src/officecli/ResidentServer.cs:2108 — ResidentServer.ExecuteQuery 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · watch-sse-core._replaceDocumentBody (cyclomatic 17) · ×1
  • watch-sse-core._replaceDocumentBody (cyclomatic 17) src/officecli/Resources/watch-sse-core.js:40 — watch-sse-core._replaceDocumentBody 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 5 function literals inside it that branch (lines 41, 76, 49, …). 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 · (anonymous) (cyclomatic 17) · ×1
  • (anonymous) (cyclomatic 17) src/officecli/Resources/watch-overlay.js:642 — (anonymous) 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 · CommandBuilder.BuildMoveCommand (cyclomatic 16) · ×1
  • CommandBuilder.BuildMoveCommand (cyclomatic 16) src/officecli/CommandBuilder.Add.cs:413 — CommandBuilder.BuildMoveCommand 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 2 function literals inside it that branch (lines 440, 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 · CommandBuilder.ApplySetWithCorrection (cyclomatic 16) · ×1
  • CommandBuilder.ApplySetWithCorrection (cyclomatic 16) src/officecli/CommandBuilder.cs:809 — CommandBuilder.ApplySetWithCorrection has cyclomatic complexity 16 (threshold 15). Of this number, 13 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 · CommandBuilder.FormatNodesCompact (cyclomatic 16) · ×1
  • CommandBuilder.FormatNodesCompact (cyclomatic 16) src/officecli/CommandBuilder.GetQuery.cs:316 — CommandBuilder.FormatNodesCompact has cyclomatic complexity 16 (threshold 15). Of this number, 13 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 · AttributeFilter.ApplyWithWarnings (cyclomatic 16) · ×1
  • AttributeFilter.ApplyWithWarnings (cyclomatic 16) src/officecli/Core/AttributeFilter.cs:231 — AttributeFilter.ApplyWithWarnings 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: AttributeFilter.RejectGarbageSelectorHead (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 · AttributeFilter.DiagnoseEmptyResult (cyclomatic 16) · ×1
  • AttributeFilter.DiagnoseEmptyResult (cyclomatic 16) src/officecli/Core/AttributeFilter.cs:320 — AttributeFilter.DiagnoseEmptyResult 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. This is NOT this file's highest cyclomatic complexity: AttributeFilter.RejectGarbageSelectorHead (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 · AttributeFilter.FilterSelector (cyclomatic 16) · ×1
  • AttributeFilter.FilterSelector (cyclomatic 16) src/officecli/Core/AttributeFilter.cs:1100 — AttributeFilter.FilterSelector 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: AttributeFilter.RejectGarbageSelectorHead (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 · ChartHelper.BuildFillElement (cyclomatic 16) · ×1
  • ChartHelper.BuildFillElement (cyclomatic 16) src/officecli/Core/Chart/ChartHelper.Builder.cs:1610 — ChartHelper.BuildFillElement 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: ChartHelper.BuildChartColorElement (cyclomatic 21) 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 · ChartHelper.ApplySeriesRangeRefs (cyclomatic 16) · ×1
  • ChartHelper.ApplySeriesRangeRefs (cyclomatic 16) src/officecli/Core/Chart/ChartHelper.Setter.cs:117 — ChartHelper.ApplySeriesRangeRefs 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: ChartHelper.ApplySeriesMarker (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · DelimitedText.ParseGrid (cyclomatic 16) · ×1
  • DelimitedText.ParseGrid (cyclomatic 16) src/officecli/Core/DelimitedText.cs:30 — DelimitedText.ParseGrid 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 · MermaidParser.Parse (cyclomatic 16) · ×1
  • MermaidParser.Parse (cyclomatic 16) src/officecli/Core/Diagram/MermaidParser.cs:63 — MermaidParser.Parse 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 · FontMetricsReader.GetSplitAscDscOverride (cyclomatic 16) · ×1
  • FontMetricsReader.GetSplitAscDscOverride (cyclomatic 16) src/officecli/Core/FontMetricsReader.cs:420 — FontMetricsReader.GetSplitAscDscOverride 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 · FormulaEvaluator.EvalCumulative (cyclomatic 16) · ×1
  • FormulaEvaluator.EvalCumulative (cyclomatic 16) src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:2101 — FormulaEvaluator.EvalCumulative has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: FormulaEvaluator.EvalAggregate (cyclomatic 21) 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 · FormulaEvaluator.BisectFallback (cyclomatic 16) · ×1
  • FormulaEvaluator.BisectFallback (cyclomatic 16) src/officecli/Core/Formula/FormulaEvaluator.Solver.cs:58 — FormulaEvaluator.BisectFallback 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 · FormulaEvaluator.EvalFilter (cyclomatic 16) · ×1
  • FormulaEvaluator.EvalFilter (cyclomatic 16) src/officecli/Core/Formula/FormulaEvaluator.Spill.cs:216 — FormulaEvaluator.EvalFilter 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 · FormulaParser.TrimControlWordDelimiterSpaces (cyclomatic 16) · ×1
  • FormulaParser.TrimControlWordDelimiterSpaces (cyclomatic 16) src/officecli/Core/Formula/FormulaParser.cs:284 — FormulaParser.TrimControlWordDelimiterSpaces 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: FormulaParser.CommandToSymbol (cyclomatic 213) 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 · ParseHelpers.ValidateXmlText (cyclomatic 16) · ×1
  • ParseHelpers.ValidateXmlText (cyclomatic 16) src/officecli/Core/ParseHelpers.cs:895 — ParseHelpers.ValidateXmlText 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: ParseHelpers.NormalizeSchemeColorName (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 · PivotTableHelper.BuildDateGroupBaseCacheField (cyclomatic 16) · ×1
  • PivotTableHelper.BuildDateGroupBaseCacheField (cyclomatic 16) src/officecli/Core/PivotTableHelper.Cache.cs:632 — PivotTableHelper.BuildDateGroupBaseCacheField 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 · PivotTableHelper.ResolveTableRef (cyclomatic 16) · ×1
  • PivotTableHelper.ResolveTableRef (cyclomatic 16) src/officecli/Core/PivotTableHelper.Cache.cs:1189 — PivotTableHelper.ResolveTableRef 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 · PivotTableHelper.SanitizeXmlText (cyclomatic 16) · ×1
  • PivotTableHelper.SanitizeXmlText (cyclomatic 16) src/officecli/Core/PivotTableHelper.cs:38 — PivotTableHelper.SanitizeXmlText 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: PivotTableHelper.PushGrandTotalsOptions (cyclomatic 21) 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 · SvgImageHelper.TryGetSvgDimensions (cyclomatic 16) · ×1
  • SvgImageHelper.TryGetSvgDimensions (cyclomatic 16) src/officecli/Core/SvgImageHelper.cs:109 — SvgImageHelper.TryGetSvgDimensions 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 · WordTocBuilder.ReplaceTocFieldContent (cyclomatic 16) · ×1
  • WordTocBuilder.ReplaceTocFieldContent (cyclomatic 16) src/officecli/Core/WordTocBuilder.cs:213 — WordTocBuilder.ReplaceTocFieldContent 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 · ExcelHandler.SerializeRichTextRuns (cyclomatic 16) · ×1
  • ExcelHandler.SerializeRichTextRuns (cyclomatic 16) src/officecli/Handlers/Excel/ExcelHandler.DumpSupport.cs:195 — ExcelHandler.SerializeRichTextRuns 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 · ExcelHandler.TrySetShapeFlip (cyclomatic 16) · ×1
  • ExcelHandler.TrySetShapeFlip (cyclomatic 16) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:1125 — ExcelHandler.TrySetShapeFlip 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 · ExcelHandler.SetPictureByPath (cyclomatic 16) · ×1
  • ExcelHandler.SetPictureByPath (cyclomatic 16) src/officecli/Handlers/Excel/ExcelHandler.Set.Drawings.cs:312 — ExcelHandler.SetPictureByPath 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 · ExcelHandler.SetPageBreak (cyclomatic 16) · ×1
  • ExcelHandler.SetPageBreak (cyclomatic 16) src/officecli/Handlers/Excel/ExcelHandler.Set.RowsCols.cs:244 — ExcelHandler.SetPageBreak 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 · PowerPointHandler.GetActiveXOnSlide (cyclomatic 16) · ×1
  • PowerPointHandler.GetActiveXOnSlide (cyclomatic 16) REDACTED:3347 — PowerPointHandler.GetActiveXOnSlide 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 · PowerPointHandler.AddZoom (cyclomatic 16) · ×1
  • PowerPointHandler.AddZoom (cyclomatic 16) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1941 — PowerPointHandler.AddZoom 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 · PowerPointHandler.AlignShapes (cyclomatic 16) · ×1
  • PowerPointHandler.AlignShapes (cyclomatic 16) src/officecli/Handlers/Pptx/PowerPointHandler.Align.cs:23 — PowerPointHandler.AlignShapes 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 · PowerPointHandler.CollectOleNodesForSlide (cyclomatic 16) · ×1
  • PowerPointHandler.CollectOleNodesForSlide (cyclomatic 16) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Ole.cs:73 — PowerPointHandler.CollectOleNodesForSlide 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 · PowerPointHandler.FindElementByAttrInScope (cyclomatic 16) · ×1
  • PowerPointHandler.FindElementByAttrInScope (cyclomatic 16) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Path.cs:591 — PowerPointHandler.FindElementByAttrInScope 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 branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · PowerPointHandler.CustomGeometryToSvgPaths (cyclomatic 16) · ×1
  • PowerPointHandler.CustomGeometryToSvgPaths (cyclomatic 16) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:393 — PowerPointHandler.CustomGeometryToSvgPaths 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 · PowerPointHandler.ResolveBulletColor (cyclomatic 16) · ×1
  • PowerPointHandler.ResolveBulletColor (cyclomatic 16) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2849 — PowerPointHandler.ResolveBulletColor 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 · PowerPointHandler.EnumerateRenderableElements (cyclomatic 16) · ×1
  • PowerPointHandler.EnumerateRenderableElements (cyclomatic 16) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:790 — PowerPointHandler.EnumerateRenderableElements has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · PowerPointHandler.ResolveInheritedDirection (cyclomatic 16) · ×1
  • PowerPointHandler.ResolveInheritedDirection (cyclomatic 16) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:3624 — PowerPointHandler.ResolveInheritedDirection 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 · PowerPointHandler.EnumerateShapeAnimationCTns (cyclomatic 16) · ×1
  • PowerPointHandler.EnumerateShapeAnimationCTns (cyclomatic 16) REDACTED:2382 — PowerPointHandler.EnumerateShapeAnimationCTns has cyclomatic complexity 16 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PowerPointHandler.FindUnsupportedCombinator (cyclomatic 16) · ×1
  • PowerPointHandler.FindUnsupportedCombinator (cyclomatic 16) src/officecli/Handlers/Pptx/PowerPointHandler.Selector.cs:24 — PowerPointHandler.FindUnsupportedCombinator 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 · PowerPointHandler.BuildSvgGradient (cyclomatic 16) · ×1
  • PowerPointHandler.BuildSvgGradient (cyclomatic 16) src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:1772 — PowerPointHandler.BuildSvgGradient 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: PowerPointHandler.GetPresetPolygonPoints (cyclomatic 60) 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 · SlideComposition.PlaceholderMatches (cyclomatic 16) · ×1
  • SlideComposition.PlaceholderMatches (cyclomatic 16) src/officecli/Handlers/Pptx/SlideComposition.cs:112 — SlideComposition.PlaceholderMatches 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 · WordBatchEmitter.ReorderLvlChildren (cyclomatic 16) · ×1
  • WordBatchEmitter.ReorderLvlChildren (cyclomatic 16) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:1237 — WordBatchEmitter.ReorderLvlChildren 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 · WordBatchEmitter.TryEmitElementAdd (cyclomatic 16) · ×1
  • WordBatchEmitter.TryEmitElementAdd (cyclomatic 16) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:3788 — WordBatchEmitter.TryEmitElementAdd 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 · WordBatchEmitter.ExtractCellOnlyProps (cyclomatic 16) · ×1
  • WordBatchEmitter.ExtractCellOnlyProps (cyclomatic 16) src/officecli/Handlers/Word/WordBatchEmitter.Table.cs:1303 — WordBatchEmitter.ExtractCellOnlyProps 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 · WordHandler.AddDiagramAsImage (cyclomatic 16) · ×1
  • WordHandler.AddDiagramAsImage (cyclomatic 16) src/officecli/Handlers/Word/WordHandler.Add.Diagram.cs:182 — WordHandler.AddDiagramAsImage has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · WordHandler.AttachChartSidecars (cyclomatic 16) · ×1
  • WordHandler.AttachChartSidecars (cyclomatic 16) src/officecli/Handlers/Word/WordHandler.Add.Media.cs:198 — WordHandler.AttachChartSidecars has cyclomatic complexity 16 (threshold 15). Of this number, 12 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.AddInlinedPartsRun (cyclomatic 16) · ×1
  • WordHandler.AddInlinedPartsRun (cyclomatic 16) src/officecli/Handlers/Word/WordHandler.Add.Media.cs:896 — WordHandler.AddInlinedPartsRun 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 · WordHandler.AddTextbox (cyclomatic 16) · ×1
  • WordHandler.AddTextbox (cyclomatic 16) src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:3004 — WordHandler.AddTextbox has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: WordHandler.IsUriSafe (cyclomatic 29) 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 · WordHandler.AddToc (cyclomatic 16) · ×1
  • WordHandler.AddToc (cyclomatic 16) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:999 — WordHandler.AddToc 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. This is NOT this file's highest cyclomatic complexity: WordHandler.StyleChildOrder (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · WordHandler.BuildMovePairIdMap (cyclomatic 16) · ×1
  • WordHandler.BuildMovePairIdMap (cyclomatic 16) src/officecli/Handlers/Word/WordHandler.Helpers.Field.cs:522 — WordHandler.BuildMovePairIdMap 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 branches: extract each independent case into its own named function, or replace a long branch ladder over a single value with a data-driven lookup or dispatch table.
D1 · Cyclomatic Complexity · WordHandler.NormalizeNewlineChars (cyclomatic 16) · ×1
  • WordHandler.NormalizeNewlineChars (cyclomatic 16) src/officecli/Handlers/Word/WordHandler.Helpers.FindReplace.cs:78 — WordHandler.NormalizeNewlineChars 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 · WordHandler.AddAtFindPosition (cyclomatic 16) · ×1
  • WordHandler.AddAtFindPosition (cyclomatic 16) src/officecli/Handlers/Word/WordHandler.Helpers.FindReplace.cs:1027 — WordHandler.AddAtFindPosition 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 · WordHandler.GetFooterTexts (cyclomatic 16) · ×1
  • WordHandler.GetFooterTexts (cyclomatic 16) src/officecli/Handlers/Word/WordHandler.Helpers.HeaderFooter.cs:117 — WordHandler.GetFooterTexts 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 · WordHandler.IsContentSpanBookmark (cyclomatic 16) · ×1
  • WordHandler.IsContentSpanBookmark (cyclomatic 16) src/officecli/Handlers/Word/WordHandler.Helpers.Text.cs:511 — WordHandler.IsContentSpanBookmark 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 · WordHandler.BuildMarkerCssProperties (cyclomatic 16) · ×1
  • WordHandler.BuildMarkerCssProperties (cyclomatic 16) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Markers.cs:85 — WordHandler.BuildMarkerCssProperties 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 · WordHandler.ParseTableLook (cyclomatic 16) · ×1
  • WordHandler.ParseTableLook (cyclomatic 16) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Tables.cs:838 — WordHandler.ParseTableLook 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 · WordHandler.ParagraphHasAlignedTab (cyclomatic 16) · ×1
  • WordHandler.ParagraphHasAlignedTab (cyclomatic 16) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Text.cs:61 — WordHandler.ParagraphHasAlignedTab has cyclomatic complexity 16 (threshold 15). Of this number, 14 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 · WordHandler.CopyTableColumn (cyclomatic 16) · ×1
  • WordHandler.CopyTableColumn (cyclomatic 16) src/officecli/Handlers/Word/WordHandler.Mutations.cs:2729 — WordHandler.CopyTableColumn 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 · WordHandler.ValidateAndNormalizePredicate (cyclomatic 16) · ×1
  • WordHandler.ValidateAndNormalizePredicate (cyclomatic 16) src/officecli/Handlers/Word/WordHandler.Navigation.cs:839 — WordHandler.ValidateAndNormalizePredicate 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 · WordHandler.SetWatermarkPath (cyclomatic 16) · ×1
  • WordHandler.SetWatermarkPath (cyclomatic 16) src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs:19 — WordHandler.SetWatermarkPath 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 · WordHandler.ApplyParagraphMarkRevisionNamespaces (cyclomatic 16) · ×1
  • WordHandler.ApplyParagraphMarkRevisionNamespaces (cyclomatic 16) src/officecli/Handlers/Word/WordHandler.Set.Element.cs:1195 — WordHandler.ApplyParagraphMarkRevisionNamespaces has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WordHandler.ViewAsOutline (cyclomatic 16) · ×1
  • WordHandler.ViewAsOutline (cyclomatic 16) src/officecli/Handlers/Word/WordHandler.View.cs:752 — WordHandler.ViewAsOutline 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 · WordHandler.EnsureUniqueMoveRunIds (cyclomatic 16) · ×1
  • WordHandler.EnsureUniqueMoveRunIds (cyclomatic 16) src/officecli/Handlers/WordHandler.cs:2342 — WordHandler.EnsureUniqueMoveRunIds has cyclomatic complexity 16 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline. This is NOT this file's highest cyclomatic complexity: WordHandler.Raw (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · index.ensureCliBinary (cyclomatic 16) · ×1
  • index.ensureCliBinary (cyclomatic 16) sdk/node/index.js:346 — index.ensureCliBinary 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 · watch-overlay.document.addEventListener("mouseup") (cyclomatic 16) · ×1
  • watch-overlay.document.addEventListener("mouseup") (cyclomatic 16) src/officecli/Resources/watch-overlay.js:642 — watch-overlay.document.addEventListener("mouseup") 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.
D15 · Churn × Complexity Hotspots · Repeated repair · ×1
  • Repeated repair: src/officecli/Handlers/Pptx/PowerPointHandler.Notes.cs src/officecli/Handlers/Pptx/PowerPointHandler.Notes.cs:203 — src/officecli/Handlers/Pptx/PowerPointHandler.Notes.cs changed 3 times in last 90 days and 3 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 PowerPointHandler.EnsureNotesMasterPart at line 203), 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(pptx): notes read and write cover every body placeholder on the notes slide”; “fix(pptx): find the speaker-notes body by placeholder type, not idx=1”; “fix(pptx): speaker notes get a notes master to inherit from”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 21:59:06 +08:00' --until='2026-10-20 21:59:06 +08:00' --full-history --no-merges -- src/officecli/Handlers/Pptx/PowerPointHandler.Notes.cs`: 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.
D18 · Solution Shape · Solution references a project that does not exist · ×1
  • Solution references a project that does not exist officecli.slnx — `officecli.slnx` declares 1 project file(s) that are missing from the tree (`tests/OfficeCli.Tests/OfficeCli.Tests.csproj`). A solution-level restore or build fails on a dangling reference, so anyone building the solution rather than an individual project is blocked. Delete the stale entry from the solution, or restore the missing project file.
D2 · Cognitive Complexity · ChartHelper.SetChartProperties (cognitive 1584) · ×1
  • ChartHelper.SetChartProperties (cognitive 1584) src/officecli/Core/Chart/ChartHelper.Setter.cs:219 — ChartHelper.SetChartProperties has cognitive complexity 1584 (threshold 15). Of this number, 1555 points are the body's own statements and 29 belong to 12 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 · WordHandler.ParagraphToNode (cognitive 1182) · ×1
  • WordHandler.ParagraphToNode (cognitive 1182) src/officecli/Handlers/Word/WordHandler.Navigation.cs:4006 — WordHandler.ParagraphToNode has cognitive complexity 1182 (threshold 15). Of this number, 1145 points are the body's own statements and 37 belong to 22 function literals inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.QueryDispatch (cognitive 1164) · ×1
  • WordHandler.QueryDispatch (cognitive 1164) src/officecli/Handlers/Word/WordHandler.Query.cs:1742 — WordHandler.QueryDispatch has cognitive complexity 1164 (threshold 15). Of this number, 1151 points are the body's own statements and 13 belong to 5 function items inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.SetRunOrShapeProperties (cognitive 1162) · ×1
  • PowerPointHandler.SetRunOrShapeProperties (cognitive 1162) src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:165 — PowerPointHandler.SetRunOrShapeProperties has cognitive complexity 1162 (threshold 15). Of this number, 1154 points are the body's own statements and 8 belong to 4 function literals inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ChartHelper.ReadChartProperties (cognitive 769) · ×1
  • ChartHelper.ReadChartProperties (cognitive 769) src/officecli/Core/Chart/ChartHelper.Reader.cs:31 — ChartHelper.ReadChartProperties has cognitive complexity 769 (threshold 15). Of this number, 759 points are the body's own statements and 10 belong to 7 function literals inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ChartSvgRenderer.RenderBarChartSvg (cognitive 711) · ×1
  • ChartSvgRenderer.RenderBarChartSvg (cognitive 711) src/officecli/Core/Chart/ChartSvgRenderer.cs:310 — ChartSvgRenderer.RenderBarChartSvg has cognitive complexity 711 (threshold 15). Of this number, 703 points are the body's own statements and 8 belong to 2 function literals inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.Get (cognitive 703) · ×1
  • PowerPointHandler.Get (cognitive 703) REDACTED:18 — PowerPointHandler.Get has cognitive complexity 703 (threshold 15). Of this number, 699 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ExcelHandler.SetSheetLevel (cognitive 664) · ×1
  • ExcelHandler.SetSheetLevel (cognitive 664) src/officecli/Handlers/Excel/ExcelHandler.Set.Sheet.cs:31 — ExcelHandler.SetSheetLevel has cognitive complexity 664 (threshold 15). Of this number, 640 points are the body's own statements and 24 belong to 7 function items inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.AddPartCore (cognitive 664) · ×1
  • PowerPointHandler.AddPartCore (cognitive 664) REDACTED:744 — PowerPointHandler.AddPartCore has cognitive complexity 664 (threshold 15). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · PowerPointHandler.ShapeToNode (cognitive 646) · ×1
  • PowerPointHandler.ShapeToNode (cognitive 646) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:866 — PowerPointHandler.ShapeToNode has cognitive complexity 646 (threshold 15). Of this number, 638 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.AddParagraph (cognitive 645) · ×1
  • WordHandler.AddParagraph (cognitive 645) src/officecli/Handlers/Word/WordHandler.Add.Text.cs:13 — WordHandler.AddParagraph has cognitive complexity 645 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ExcelHandler.QueryDispatch (cognitive 604) · ×1
  • ExcelHandler.QueryDispatch (cognitive 604) src/officecli/Handlers/Excel/ExcelHandler.Query.cs:1192 — ExcelHandler.QueryDispatch has cognitive complexity 604 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.Get (cognitive 599) · ×1
  • WordHandler.Get (cognitive 599) src/officecli/Handlers/Word/WordHandler.Query.cs:95 — WordHandler.Get has cognitive complexity 599 (threshold 15). Of this number, 598 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.QueryDispatch (cognitive 563) · ×1
  • PowerPointHandler.QueryDispatch (cognitive 563) REDACTED:1545 — PowerPointHandler.QueryDispatch has cognitive complexity 563 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.SetTableCellProperties (cognitive 503) · ×1
  • PowerPointHandler.SetTableCellProperties (cognitive 503) src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:2716 — PowerPointHandler.SetTableCellProperties has cognitive complexity 503 (threshold 15). Of this number, 495 points are the body's own statements and 8 belong to 2 function items inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ExcelHandler.Get (cognitive 473) · ×1
  • ExcelHandler.Get (cognitive 473) src/officecli/Handlers/Excel/ExcelHandler.Query.cs:16 — ExcelHandler.Get has cognitive complexity 473 (threshold 15). Of this number, 461 points are the body's own statements and 12 belong to 6 function literals inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ExcelHandler.RemoveCore (cognitive 439) · ×1
  • ExcelHandler.RemoveCore (cognitive 439) src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:20 — ExcelHandler.RemoveCore has cognitive complexity 439 (threshold 15). Of this number, 437 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ExcelHandler.ApplySheetRangeMutations (cognitive 435) · ×1
  • ExcelHandler.ApplySheetRangeMutations (cognitive 435) src/officecli/Handlers/Excel/ExcelHandler.SheetShift.cs:67 — ExcelHandler.ApplySheetRangeMutations has cognitive complexity 435 (threshold 15). Of this number, 430 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordBatchEmitter.EmitTable (cognitive 425) · ×1
  • WordBatchEmitter.EmitTable (cognitive 425) src/officecli/Handlers/Word/WordBatchEmitter.Table.cs:102 — WordBatchEmitter.EmitTable has cognitive complexity 425 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.RemoveCore (cognitive 418) · ×1
  • WordHandler.RemoveCore (cognitive 418) src/officecli/Handlers/Word/WordHandler.Mutations.cs:21 — WordHandler.RemoveCore has cognitive complexity 418 (threshold 15). Of this number, 407 points are the body's own statements and 11 belong to 11 function literals inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.RenderBodyHtml (cognitive 414) · ×1
  • WordHandler.RenderBodyHtml (cognitive 414) REDACTED:2465 — WordHandler.RenderBodyHtml has cognitive complexity 414 (threshold 15). Of this number, 413 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.AddRun (cognitive 394) · ×1
  • WordHandler.AddRun (cognitive 394) src/officecli/Handlers/Word/WordHandler.Add.Text.cs:2193 — WordHandler.AddRun has cognitive complexity 394 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.RunToNode (cognitive 393) · ×1
  • WordHandler.RunToNode (cognitive 393) src/officecli/Handlers/Word/WordHandler.Navigation.cs:2243 — WordHandler.RunToNode has cognitive complexity 393 (threshold 15). Of this number, 388 points are the body's own statements and 5 belong to 3 function items inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ExcelHandler.CellToNode (cognitive 371) · ×1
  • ExcelHandler.CellToNode (cognitive 371) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Node.cs:295 — ExcelHandler.CellToNode has cognitive complexity 371 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.ViewAsIssues (cognitive 362) · ×1
  • PowerPointHandler.ViewAsIssues (cognitive 362) src/officecli/Handlers/Pptx/PowerPointHandler.View.cs:523 — PowerPointHandler.ViewAsIssues has cognitive complexity 362 (threshold 15). Of this number, 361 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.SetElementTableCell (cognitive 356) · ×1
  • WordHandler.SetElementTableCell (cognitive 356) src/officecli/Handlers/Word/WordHandler.Set.Element.cs:1897 — WordHandler.SetElementTableCell has cognitive complexity 356 (threshold 15). Of this number, 353 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ChartHelper.SetAxisProperties (cognitive 353) · ×1
  • ChartHelper.SetAxisProperties (cognitive 353) src/officecli/Core/Chart/ChartHelper.Axis.cs:248 — ChartHelper.SetAxisProperties has cognitive complexity 353 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ChartSvgRenderer.ExtractChartInfo (cognitive 345) · ×1
  • ChartSvgRenderer.ExtractChartInfo (cognitive 345) src/officecli/Core/Chart/ChartSvgRenderer.cs:3388 — ChartSvgRenderer.ExtractChartInfo has cognitive complexity 345 (threshold 15). Of this number, 340 points are the body's own statements and 5 belong to 3 function literals inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · FormulaParser.ParseCommand (cognitive 334) · ×1
  • FormulaParser.ParseCommand (cognitive 334) src/officecli/Core/Formula/FormulaParser.cs:1284 — FormulaParser.ParseCommand has cognitive complexity 334 (threshold 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 · PivotTableHelper.RenderGeneralPivot (cognitive 332) · ×1
  • PivotTableHelper.RenderGeneralPivot (cognitive 332) src/officecli/Core/PivotTableHelper.Render.cs:1754 — PivotTableHelper.RenderGeneralPivot has cognitive complexity 332 (threshold 15). Of this number, 330 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.TableToNode (cognitive 314) · ×1
  • PowerPointHandler.TableToNode (cognitive 314) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:388 — PowerPointHandler.TableToNode has cognitive complexity 314 (threshold 15). Of this number, 312 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.AddShape (cognitive 309) · ×1
  • PowerPointHandler.AddShape (cognitive 309) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Shape.cs:15 — PowerPointHandler.AddShape has cognitive complexity 309 (threshold 15). Of this number, 298 points are the body's own statements and 11 belong to 4 function items inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · CommandBuilder.BuildViewCommand (cognitive 307) · ×1
  • CommandBuilder.BuildViewCommand (cognitive 307) src/officecli/CommandBuilder.View.cs:12 — CommandBuilder.BuildViewCommand has cognitive complexity 307 (threshold 15). None of this is in the body itself: all 307 points belong to 2 function literals inside it that branch (lines 57, 116). 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 · PivotTableHelper.RenderMatrixPivot (cognitive 305) · ×1
  • PivotTableHelper.RenderMatrixPivot (cognitive 305) src/officecli/Core/PivotTableHelper.Render.cs:1293 — PivotTableHelper.RenderMatrixPivot has cognitive complexity 305 (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.
D2 · Cognitive Complexity · WordHandler.RenderTableHtml (cognitive 292) · ×1
  • WordHandler.RenderTableHtml (cognitive 292) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Tables.cs:26 — WordHandler.RenderTableHtml has cognitive complexity 292 (threshold 15). Of this number, 284 points are the body's own statements and 8 belong to 5 function literals inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ExcelHandler.ApplyCellProperties (cognitive 286) · ×1
  • ExcelHandler.ApplyCellProperties (cognitive 286) src/officecli/Handlers/Excel/ExcelHandler.Set.Cells.cs:90 — ExcelHandler.ApplyCellProperties has cognitive complexity 286 (threshold 15). Of this number, 282 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.SetElementRun (cognitive 277) · ×1
  • WordHandler.SetElementRun (cognitive 277) src/officecli/Handlers/Word/WordHandler.Set.Element.cs:311 — WordHandler.SetElementRun has cognitive complexity 277 (threshold 15). Of this number, 275 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.ApplyRunFormatting (cognitive 276) · ×1
  • WordHandler.ApplyRunFormatting (cognitive 276) src/officecli/Handlers/Word/WordHandler.Helpers.RunFormat.cs:572 — WordHandler.ApplyRunFormatting has cognitive complexity 276 (threshold 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 · PowerPointHandler.RenderShape (cognitive 267) · ×1
  • PowerPointHandler.RenderShape (cognitive 267) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:21 — PowerPointHandler.RenderShape has cognitive complexity 267 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.RemoveCore (cognitive 266) · ×1
  • PowerPointHandler.RemoveCore (cognitive 266) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:19 — PowerPointHandler.RemoveCore has cognitive complexity 266 (threshold 15). Of this number, 265 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.RenderTextBody (cognitive 264) · ×1
  • PowerPointHandler.RenderTextBody (cognitive 264) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Text.cs:17 — PowerPointHandler.RenderTextBody has cognitive complexity 264 (threshold 15). Of this number, 261 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ResidentServer.ExecuteView (cognitive 254) · ×1
  • ResidentServer.ExecuteView (cognitive 254) src/officecli/ResidentServer.cs:1521 — ResidentServer.ExecuteView has cognitive complexity 254 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.ApplyPicturePropertiesCore (cognitive 252) · ×1
  • PowerPointHandler.ApplyPicturePropertiesCore (cognitive 252) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:45 — PowerPointHandler.ApplyPicturePropertiesCore has cognitive complexity 252 (threshold 15). Of this number, 249 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.RenderRunHtml (cognitive 245) · ×1
  • WordHandler.RenderRunHtml (cognitive 245) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Text.cs:769 — WordHandler.RenderRunHtml has cognitive complexity 245 (threshold 15). Of this number, 239 points are the body's own statements and 6 belong to 5 function literals inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.TableToNode (cognitive 239) · ×1
  • WordHandler.TableToNode (cognitive 239) src/officecli/Handlers/Word/WordHandler.Navigation.cs:3175 — WordHandler.TableToNode has cognitive complexity 239 (threshold 15). Of this number, 235 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ExcelHandler.RenderSheetTable (cognitive 232) · ×1
  • ExcelHandler.RenderSheetTable (cognitive 232) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:318 — ExcelHandler.RenderSheetTable has cognitive complexity 232 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ChartSvgRenderer.RenderLineChartSvg (cognitive 227) · ×1
  • ChartSvgRenderer.RenderLineChartSvg (cognitive 227) src/officecli/Core/Chart/ChartSvgRenderer.cs:1325 — ChartSvgRenderer.RenderLineChartSvg has cognitive complexity 227 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.AddTable (cognitive 224) · ×1
  • WordHandler.AddTable (cognitive 224) src/officecli/Handlers/Word/WordHandler.Add.Table.cs:45 — WordHandler.AddTable has cognitive complexity 224 (threshold 15). Of this number, 222 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 · WordHandler.GetParagraphInlineCss (cognitive 224) · ×1
  • WordHandler.GetParagraphInlineCss (cognitive 224) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:336 — WordHandler.GetParagraphInlineCss has cognitive complexity 224 (threshold 15). Of this number, 217 points are the body's own statements and 7 belong to 3 function items inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.AddPicture (cognitive 215) · ×1
  • PowerPointHandler.AddPicture (cognitive 215) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:16 — PowerPointHandler.AddPicture has cognitive complexity 215 (threshold 15). Of this number, 211 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ExcelHandler.AddTable (cognitive 213) · ×1
  • ExcelHandler.AddTable (cognitive 213) src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs:1058 — ExcelHandler.AddTable has cognitive complexity 213 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.NavigateToElement (cognitive 210) · ×1
  • WordHandler.NavigateToElement (cognitive 210) src/officecli/Handlers/Word/WordHandler.Navigation.cs:1184 — WordHandler.NavigateToElement has cognitive complexity 210 (threshold 15). Of this number, 196 points are the body's own statements and 14 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 · WordHandler.ProcessFindInParagraph (cognitive 207) · ×1
  • WordHandler.ProcessFindInParagraph (cognitive 207) src/officecli/Handlers/Word/WordHandler.Helpers.FindReplace.cs:434 — WordHandler.ProcessFindInParagraph has cognitive complexity 207 (threshold 15). Of this number, 205 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 · FormulaEvaluator.Tokenize (cognitive 206) · ×1
  • FormulaEvaluator.Tokenize (cognitive 206) src/officecli/Core/Formula/FormulaEvaluator.cs:400 — FormulaEvaluator.Tokenize has cognitive complexity 206 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordBatchEmitter.CollapseFieldChains (cognitive 204) · ×1
  • WordBatchEmitter.CollapseFieldChains (cognitive 204) src/officecli/Handlers/Word/WordBatchEmitter.Fields.cs:199 — WordBatchEmitter.CollapseFieldChains has cognitive complexity 204 (threshold 15). Of this number, 203 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 · PowerPointHandler.ApplyConnectorProps (cognitive 198) · ×1
  • PowerPointHandler.ApplyConnectorProps (cognitive 198) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:840 — PowerPointHandler.ApplyConnectorProps has cognitive complexity 198 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.AddStyle (cognitive 198) · ×1
  • WordHandler.AddStyle (cognitive 198) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:1143 — WordHandler.AddStyle has cognitive complexity 198 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ChartSvgRenderer.RenderAreaChartSvg (cognitive 197) · ×1
  • ChartSvgRenderer.RenderAreaChartSvg (cognitive 197) src/officecli/Core/Chart/ChartSvgRenderer.cs:2053 — ChartSvgRenderer.RenderAreaChartSvg has cognitive complexity 197 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.AddRun (cognitive 194) · ×1
  • PowerPointHandler.AddRun (cognitive 194) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Text.cs:594 — PowerPointHandler.AddRun has cognitive complexity 194 (threshold 15). Of this number, 193 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordBatchEmitter.TryEmitFieldRun (cognitive 193) · ×1
  • WordBatchEmitter.TryEmitFieldRun (cognitive 193) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:2183 — WordBatchEmitter.TryEmitFieldRun has cognitive complexity 193 (threshold 15). Of this number, 192 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.PictureToNode (cognitive 189) · ×1
  • PowerPointHandler.PictureToNode (cognitive 189) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2603 — PowerPointHandler.PictureToNode has cognitive complexity 189 (threshold 15). Of this number, 188 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.BeginTrackChangeIfRequested (cognitive 189) · ×1
  • WordHandler.BeginTrackChangeIfRequested (cognitive 189) src/officecli/Handlers/Word/WordHandler.Set.Revision.cs:106 — WordHandler.BeginTrackChangeIfRequested has cognitive complexity 189 (threshold 15). Of this number, 122 points are the body's own statements and 67 belong to 6 function literals inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.GetRootNode (cognitive 183) · ×1
  • WordHandler.GetRootNode (cognitive 183) src/officecli/Handlers/Word/WordHandler.Navigation.cs:118 — WordHandler.GetRootNode has cognitive complexity 183 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.ReadCellProps (cognitive 183) · ×1
  • WordHandler.ReadCellProps (cognitive 183) src/officecli/Handlers/Word/WordHandler.Navigation.cs:6555 — WordHandler.ReadCellProps has cognitive complexity 183 (threshold 15). Of this number, 182 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.SetElementParagraph (cognitive 183) · ×1
  • WordHandler.SetElementParagraph (cognitive 183) src/officecli/Handlers/Word/WordHandler.Set.Element.cs:1281 — WordHandler.SetElementParagraph has cognitive complexity 183 (threshold 15). Of this number, 182 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PivotTableHelper.RenderMultiColPivot (cognitive 182) · ×1
  • PivotTableHelper.RenderMultiColPivot (cognitive 182) src/officecli/Core/PivotTableHelper.Render.cs:903 — PivotTableHelper.RenderMultiColPivot has cognitive complexity 182 (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.
D2 · Cognitive Complexity · PowerPointHandler.RenderRun (cognitive 182) · ×1
  • PowerPointHandler.RenderRun (cognitive 182) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Text.cs:804 — PowerPointHandler.RenderRun has cognitive complexity 182 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.RenderParagraphContentHtml (cognitive 180) · ×1
  • WordHandler.RenderParagraphContentHtml (cognitive 180) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Text.cs:412 — WordHandler.RenderParagraphContentHtml has cognitive complexity 180 (threshold 15). Of this number, 179 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.RenderPicture (cognitive 179) · ×1
  • PowerPointHandler.RenderPicture (cognitive 179) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:1278 — PowerPointHandler.RenderPicture has cognitive complexity 179 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.RenderTable (cognitive 178) · ×1
  • PowerPointHandler.RenderTable (cognitive 178) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Tables.cs:18 — PowerPointHandler.RenderTable has cognitive complexity 178 (threshold 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 · PowerPointHandler.SetTablePropsCore (cognitive 178) · ×1
  • PowerPointHandler.SetTablePropsCore (cognitive 178) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Table.cs:228 — PowerPointHandler.SetTablePropsCore has cognitive complexity 178 (threshold 15). Of this number, 173 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 · ExcelHandler.ViewAsIssues (cognitive 175) · ×1
  • ExcelHandler.ViewAsIssues (cognitive 175) src/officecli/Handlers/Excel/ExcelHandler.View.cs:531 — ExcelHandler.ViewAsIssues has cognitive complexity 175 (threshold 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 · CommandBuilder.ExecuteBatchItem (cognitive 174) · ×1
  • CommandBuilder.ExecuteBatchItem (cognitive 174) src/officecli/CommandBuilder.cs:945 — CommandBuilder.ExecuteBatchItem has cognitive complexity 174 (threshold 15). Of this number, 173 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.SetElementTable (cognitive 171) · ×1
  • WordHandler.SetElementTable (cognitive 171) src/officecli/Handlers/Word/WordHandler.Set.Element.cs:2785 — WordHandler.SetElementTable has cognitive complexity 171 (threshold 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 · ChartExBuilder.HandleSetKey (cognitive 166) · ×1
  • ChartExBuilder.HandleSetKey (cognitive 166) src/officecli/Core/Chart/ChartExBuilder.Setter.cs:72 — ChartExBuilder.HandleSetKey has cognitive complexity 166 (threshold 15). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ExcelHandler.Move (cognitive 165) · ×1
  • ExcelHandler.Move (cognitive 165) src/officecli/Handlers/Excel/ExcelHandler.Add.cs:170 — ExcelHandler.Move has cognitive complexity 165 (threshold 15). Of this number, 160 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 · ExcelHandler.CopyFrom (cognitive 158) · ×1
  • ExcelHandler.CopyFrom (cognitive 158) src/officecli/Handlers/Excel/ExcelHandler.Add.cs:744 — ExcelHandler.CopyFrom has cognitive complexity 158 (threshold 15). Of this number, 154 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.AddCell (cognitive 156) · ×1
  • WordHandler.AddCell (cognitive 156) src/officecli/Handlers/Word/WordHandler.Add.Table.cs:1196 — WordHandler.AddCell has cognitive complexity 156 (threshold 15). Of this number, 152 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · CommandBuilder.BuildSetCommand (cognitive 155) · ×1
  • CommandBuilder.BuildSetCommand (cognitive 155) src/officecli/CommandBuilder.Set.cs:12 — CommandBuilder.BuildSetCommand has cognitive complexity 155 (threshold 15). None of this is in the body itself: all 155 points belong to one function literal inside it that branches (line 32). 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 · ChartSvgRenderer.RenderBar3DSvg (cognitive 155) · ×1
  • ChartSvgRenderer.RenderBar3DSvg (cognitive 155) src/officecli/Core/Chart/ChartSvgRenderer.cs:5076 — ChartSvgRenderer.RenderBar3DSvg has cognitive complexity 155 (threshold 15). Of this number, 144 points are the body's own statements and 11 belong to 3 function literals inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.AddSection (cognitive 152) · ×1
  • WordHandler.AddSection (cognitive 152) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:79 — WordHandler.AddSection has cognitive complexity 152 (threshold 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 · PivotTableHelper.RenderMultiRowPivot (cognitive 151) · ×1
  • PivotTableHelper.RenderMultiRowPivot (cognitive 151) src/officecli/Core/PivotTableHelper.Render.cs:577 — PivotTableHelper.RenderMultiRowPivot has cognitive complexity 151 (threshold 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 · WordHandler.AddPicture (cognitive 151) · ×1
  • WordHandler.AddPicture (cognitive 151) src/officecli/Handlers/Word/WordHandler.Add.Media.cs:302 — WordHandler.AddPicture has cognitive complexity 151 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.SetCore (cognitive 150) · ×1
  • WordHandler.SetCore (cognitive 150) src/officecli/Handlers/Word/WordHandler.Set.cs:73 — WordHandler.SetCore has cognitive complexity 150 (threshold 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 · WordHandler.ResolveParagraphStyleCss (cognitive 148) · ×1
  • WordHandler.ResolveParagraphStyleCss (cognitive 148) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:1286 — WordHandler.ResolveParagraphStyleCss has cognitive complexity 148 (threshold 15). Of this number, 147 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PivotTableHelper.ReadPivotTableProperties (cognitive 147) · ×1
  • PivotTableHelper.ReadPivotTableProperties (cognitive 147) src/officecli/Core/PivotTableHelper.Readback.cs:15 — PivotTableHelper.ReadPivotTableProperties has cognitive complexity 147 (threshold 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 · WordHandler.AddEquation (cognitive 147) · ×1
  • WordHandler.AddEquation (cognitive 147) src/officecli/Handlers/Word/WordHandler.Add.Text.cs:1816 — WordHandler.AddEquation has cognitive complexity 147 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · SchemaHelpRenderer.RenderHuman (cognitive 146) · ×1
  • SchemaHelpRenderer.RenderHuman (cognitive 146) src/officecli/Help/SchemaHelpRenderer.cs:33 — SchemaHelpRenderer.RenderHuman has cognitive complexity 146 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PivotTableHelper.SetPivotTableProperties (cognitive 145) · ×1
  • PivotTableHelper.SetPivotTableProperties (cognitive 145) src/officecli/Core/PivotTableHelper.Set.cs:13 — PivotTableHelper.SetPivotTableProperties has cognitive complexity 145 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.SetAbstractNumPath (cognitive 145) · ×1
  • WordHandler.SetAbstractNumPath (cognitive 145) src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs:1261 — WordHandler.SetAbstractNumPath has cognitive complexity 145 (threshold 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 · PivotTableHelper.RenderPivotIntoSheetCore (cognitive 144) · ×1
  • PivotTableHelper.RenderPivotIntoSheetCore (cognitive 144) src/officecli/Core/PivotTableHelper.Render.cs:100 — PivotTableHelper.RenderPivotIntoSheetCore has cognitive complexity 144 (threshold 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 · ExcelHandler.PopulateCfNodeFromRule (cognitive 144) · ×1
  • ExcelHandler.PopulateCfNodeFromRule (cognitive 144) src/officecli/Handlers/Excel/ExcelHandler.Query.Cf.cs:22 — ExcelHandler.PopulateCfNodeFromRule has cognitive complexity 144 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ExcelStyleManager.ApplyStyle (cognitive 142) · ×1
  • ExcelStyleManager.ApplyStyle (cognitive 142) src/officecli/Core/ExcelStyleManager.cs:74 — ExcelStyleManager.ApplyStyle has cognitive complexity 142 (threshold 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 · WordBatchEmitter.FilterEmittableProps (cognitive 142) · ×1
  • WordBatchEmitter.FilterEmittableProps (cognitive 142) src/officecli/Handlers/Word/WordBatchEmitter.Filters.cs:138 — WordBatchEmitter.FilterEmittableProps has cognitive complexity 142 (threshold 15). Of this number, 135 points are the body's own statements and 7 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 · ExcelHandler.RewriteSidecarRefsAfterSort (cognitive 141) · ×1
  • ExcelHandler.RewriteSidecarRefsAfterSort (cognitive 141) src/officecli/Handlers/Excel/ExcelHandler.Set.Ranges.cs:578 — ExcelHandler.RewriteSidecarRefsAfterSort has cognitive complexity 141 (threshold 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 · PptxBatchEmitter.EmitChart (cognitive 139) · ×1
  • PptxBatchEmitter.EmitChart (cognitive 139) src/officecli/Handlers/Pptx/PptxBatchEmitter.Charts.cs:17 — PptxBatchEmitter.EmitChart has cognitive complexity 139 (threshold 15). Of this number, 135 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 · WordHandler.RejectAllChanges (cognitive 139) · ×1
  • WordHandler.RejectAllChanges (cognitive 139) src/officecli/Handlers/Word/WordHandler.Mutations.cs:2282 — WordHandler.RejectAllChanges has cognitive complexity 139 (threshold 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 · WordHandler.GetTableCellInlineCss (cognitive 138) · ×1
  • WordHandler.GetTableCellInlineCss (cognitive 138) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:2248 — WordHandler.GetTableCellInlineCss has cognitive complexity 138 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · CommandBuilder.BuildBatchCommand (cognitive 136) · ×1
  • CommandBuilder.BuildBatchCommand (cognitive 136) src/officecli/CommandBuilder.Batch.cs:175 — CommandBuilder.BuildBatchCommand has cognitive complexity 136 (threshold 15). None of this is in the body itself: all 136 points belong to one function literal inside it that branches (line 206). 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 · WordHandler.GetRunInlineCss (cognitive 135) · ×1
  • WordHandler.GetRunInlineCss (cognitive 135) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:1578 — WordHandler.GetRunInlineCss has cognitive complexity 135 (threshold 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 · WordHandler.BuildSectionNode (cognitive 135) · ×1
  • WordHandler.BuildSectionNode (cognitive 135) src/officecli/Handlers/Word/WordHandler.Query.cs:980 — WordHandler.BuildSectionNode has cognitive complexity 135 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ChartHelper.HandleSeriesDottedProperty (cognitive 134) · ×1
  • ChartHelper.HandleSeriesDottedProperty (cognitive 134) src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:686 — ChartHelper.HandleSeriesDottedProperty has cognitive complexity 134 (threshold 15). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · PowerPointHandler.SetCore (cognitive 133) · ×1
  • PowerPointHandler.SetCore (cognitive 133) src/officecli/Handlers/Pptx/PowerPointHandler.Set.cs:18 — PowerPointHandler.SetCore has cognitive complexity 133 (threshold 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 · FormulaParser.ToLatexByName (cognitive 132) · ×1
  • FormulaParser.ToLatexByName (cognitive 132) src/officecli/Core/Formula/FormulaParser.cs:318 — FormulaParser.ToLatexByName has cognitive complexity 132 (threshold 15). Of this number, 130 points are the body's own statements and 2 belong 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 · PowerPointHandler.GetSmartArtsOnSlide (cognitive 131) · ×1
  • PowerPointHandler.GetSmartArtsOnSlide (cognitive 131) REDACTED:3425 — PowerPointHandler.GetSmartArtsOnSlide has cognitive complexity 131 (threshold 15). Of this number, 128 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.ViewAsIssues (cognitive 131) · ×1
  • WordHandler.ViewAsIssues (cognitive 131) src/officecli/Handlers/Word/WordHandler.View.cs:1174 — WordHandler.ViewAsIssues has cognitive complexity 131 (threshold 15). Of this number, 130 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 · WordHandler.SetStylePath (cognitive 130) · ×1
  • WordHandler.SetStylePath (cognitive 130) src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs:1647 — WordHandler.SetStylePath has cognitive complexity 130 (threshold 15). Of this number, 129 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.ResolveEffectiveParagraphStyleProperties (cognitive 130) · ×1
  • WordHandler.ResolveEffectiveParagraphStyleProperties (cognitive 130) src/officecli/Handlers/Word/WordHandler.StyleList.cs:527 — WordHandler.ResolveEffectiveParagraphStyleProperties has cognitive complexity 130 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.RunToNode (cognitive 129) · ×1
  • PowerPointHandler.RunToNode (cognitive 129) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2251 — PowerPointHandler.RunToNode has cognitive complexity 129 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.SetSectionPath (cognitive 129) · ×1
  • WordHandler.SetSectionPath (cognitive 129) src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs:808 — WordHandler.SetSectionPath has cognitive complexity 129 (threshold 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 · PivotTableHelper.RebuildFieldAreas (cognitive 128) · ×1
  • PivotTableHelper.RebuildFieldAreas (cognitive 128) src/officecli/Core/PivotTableHelper.Set.cs:405 — PivotTableHelper.RebuildFieldAreas has cognitive complexity 128 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ExcelHandler.SetTableByPath (cognitive 126) · ×1
  • ExcelHandler.SetTableByPath (cognitive 126) src/officecli/Handlers/Excel/ExcelHandler.Set.Tables.cs:371 — ExcelHandler.SetTableByPath has cognitive complexity 126 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.ParseGlbBoundingBox (cognitive 126) · ×1
  • PowerPointHandler.ParseGlbBoundingBox (cognitive 126) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Model3D.cs:458 — PowerPointHandler.ParseGlbBoundingBox has cognitive complexity 126 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.RenderTextBodyFO (cognitive 126) · ×1
  • PowerPointHandler.RenderTextBodyFO (cognitive 126) src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:1253 — PowerPointHandler.RenderTextBodyFO has cognitive complexity 126 (threshold 15). Of this number, 125 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordBatchEmitter.EmitParagraph (cognitive 126) · ×1
  • WordBatchEmitter.EmitParagraph (cognitive 126) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:50 — WordBatchEmitter.EmitParagraph has cognitive complexity 126 (threshold 15). Of this number, 111 points are the body's own statements and 15 belong to 9 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 · ChartSvgRenderer.RenderChartSvgContent (cognitive 125) · ×1
  • ChartSvgRenderer.RenderChartSvgContent (cognitive 125) src/officecli/Core/Chart/ChartSvgRenderer.cs:4584 — ChartSvgRenderer.RenderChartSvgContent has cognitive complexity 125 (threshold 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 · ExcelHandler.EvaluateCfRule (cognitive 123) · ×1
  • ExcelHandler.EvaluateCfRule (cognitive 123) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:1715 — ExcelHandler.EvaluateCfRule has cognitive complexity 123 (threshold 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 · WordHandler.ViewAsHtmlCore (cognitive 123) · ×1
  • WordHandler.ViewAsHtmlCore (cognitive 123) REDACTED:143 — WordHandler.ViewAsHtmlCore has cognitive complexity 123 (threshold 15). Of this number, 122 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 · ExcelHandler.FindAndReplace (cognitive 122) · ×1
  • ExcelHandler.FindAndReplace (cognitive 122) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Sheet.cs:444 — ExcelHandler.FindAndReplace has cognitive complexity 122 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.RenderConnector (cognitive 122) · ×1
  • PowerPointHandler.RenderConnector (cognitive 122) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:1783 — PowerPointHandler.RenderConnector has cognitive complexity 122 (threshold 15). Of this number, 120 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordBatchEmitter.TryEmitInlineSectionBreak (cognitive 121) · ×1
  • WordBatchEmitter.TryEmitInlineSectionBreak (cognitive 121) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:691 — WordBatchEmitter.TryEmitInlineSectionBreak has cognitive complexity 121 (threshold 15). Of this number, 105 points are the body's own statements and 16 belong to 3 function literals inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ExcelHandler.AddShape (cognitive 120) · ×1
  • ExcelHandler.AddShape (cognitive 120) src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:570 — ExcelHandler.AddShape has cognitive complexity 120 (threshold 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 · FormulaEvaluator.EvalFunction (cognitive 118) · ×1
  • FormulaEvaluator.EvalFunction (cognitive 118) src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:13 — FormulaEvaluator.EvalFunction has cognitive complexity 118 (threshold 15). Of this number, 96 points are the body's own statements and 22 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 · WordHandler.AddField (cognitive 118) · ×1
  • WordHandler.AddField (cognitive 118) src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:1334 — WordHandler.AddField has cognitive complexity 118 (threshold 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 · ExcelHandler.GetShapeNode (cognitive 116) · ×1
  • ExcelHandler.GetShapeNode (cognitive 116) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:618 — ExcelHandler.GetShapeNode has cognitive complexity 116 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.AddConnector (cognitive 116) · ×1
  • PowerPointHandler.AddConnector (cognitive 116) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:17 — PowerPointHandler.AddConnector has cognitive complexity 116 (threshold 15). Of this number, 109 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChartHelper.ApplySeriesReferences (cognitive 114) · ×1
  • ChartHelper.ApplySeriesReferences (cognitive 114) src/officecli/Core/Chart/ChartHelper.Builder.cs:516 — ChartHelper.ApplySeriesReferences has cognitive complexity 114 (threshold 15). Of this number, 109 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ExcelHandler.ApplyNumberFormatCore (cognitive 113) · ×1
  • ExcelHandler.ApplyNumberFormatCore (cognitive 113) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:3486 — ExcelHandler.ApplyNumberFormatCore has cognitive complexity 113 (threshold 15). Of this number, 110 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 · WordBatchEmitter.TryEmitTextbox (cognitive 113) · ×1
  • WordBatchEmitter.TryEmitTextbox (cognitive 113) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:3530 — WordBatchEmitter.TryEmitTextbox has cognitive complexity 113 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.AddComment (cognitive 113) · ×1
  • WordHandler.AddComment (cognitive 113) src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:13 — WordHandler.AddComment has cognitive complexity 113 (threshold 15). Of this number, 106 points are the body's own statements and 7 belong to 3 function items inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.CopyFromCore (cognitive 113) · ×1
  • WordHandler.CopyFromCore (cognitive 113) src/officecli/Handlers/Word/WordHandler.Mutations.cs:1715 — WordHandler.CopyFromCore has cognitive complexity 113 (threshold 15). Of this number, 103 points are the body's own statements and 10 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 · WordHandler.PopulateDocSettings (cognitive 113) · ×1
  • WordHandler.PopulateDocSettings (cognitive 113) src/officecli/Handlers/Word/WordHandler.Navigation.DocSettings.cs:15 — WordHandler.PopulateDocSettings has cognitive complexity 113 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.SetHeaderFooter (cognitive 113) · ×1
  • WordHandler.SetHeaderFooter (cognitive 113) src/officecli/Handlers/Word/WordHandler.Set.cs:651 — WordHandler.SetHeaderFooter has cognitive complexity 113 (threshold 15). Of this number, 111 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 · ChartHelper.BuildChartSpace (cognitive 112) · ×1
  • ChartHelper.BuildChartSpace (cognitive 112) src/officecli/Core/Chart/ChartHelper.Builder.cs:14 — ChartHelper.BuildChartSpace has cognitive complexity 112 (threshold 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 · WordBatchEmitter.EmitNoteReference (cognitive 112) · ×1
  • WordBatchEmitter.EmitNoteReference (cognitive 112) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:2085 — WordBatchEmitter.EmitNoteReference has cognitive complexity 112 (threshold 15). Of this number, 108 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.MoveCore (cognitive 111) · ×1
  • PowerPointHandler.MoveCore (cognitive 111) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:719 — PowerPointHandler.MoveCore has cognitive complexity 111 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.AddFormField (cognitive 108) · ×1
  • WordHandler.AddFormField (cognitive 108) src/officecli/Handlers/Word/WordHandler.FormFields.cs:293 — WordHandler.AddFormField has cognitive complexity 108 (threshold 15). Of this number, 106 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 · PowerPointHandler.ParseTransitionFromXml (cognitive 107) · ×1
  • PowerPointHandler.ParseTransitionFromXml (cognitive 107) src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2450 — PowerPointHandler.ParseTransitionFromXml has cognitive complexity 107 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.SetMediaByPath (cognitive 107) · ×1
  • PowerPointHandler.SetMediaByPath (cognitive 107) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:959 — PowerPointHandler.SetMediaByPath has cognitive complexity 107 (threshold 15). Of this number, 106 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · CommandBuilder.BuildAddCommand (cognitive 106) · ×1
  • CommandBuilder.BuildAddCommand (cognitive 106) src/officecli/CommandBuilder.Add.cs:13 — CommandBuilder.BuildAddCommand has cognitive complexity 106 (threshold 15). None of this is in the body itself: all 106 points belong to 4 function literals inside it that branch (lines 57, 28, 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 · WordBatchEmitter.TryEmitPictureRun (cognitive 106) · ×1
  • WordBatchEmitter.TryEmitPictureRun (cognitive 106) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:2665 — WordBatchEmitter.TryEmitPictureRun has cognitive complexity 106 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.RenderShapeHtml (cognitive 106) · ×1
  • WordHandler.RenderShapeHtml (cognitive 106) REDACTED:1037 — WordHandler.RenderShapeHtml has cognitive complexity 106 (threshold 15). Of this number, 103 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ExcelHandler.CheckAllNumericOverflow (cognitive 105) · ×1
  • ExcelHandler.CheckAllNumericOverflow (cognitive 105) src/officecli/Handlers/Excel/ExcelHandler.CheckNumericOverflow.cs:33 — ExcelHandler.CheckAllNumericOverflow has cognitive complexity 105 (threshold 15). Of this number, 104 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 · ChartSvgRenderer.RenderScatterChartSvg (cognitive 104) · ×1
  • ChartSvgRenderer.RenderScatterChartSvg (cognitive 104) src/officecli/Core/Chart/ChartSvgRenderer.cs:2537 — ChartSvgRenderer.RenderScatterChartSvg has cognitive complexity 104 (threshold 15). Of this number, 103 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.PresetGeometryToCss (cognitive 104) · ×1
  • PowerPointHandler.PresetGeometryToCss (cognitive 104) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2384 — PowerPointHandler.PresetGeometryToCss has cognitive complexity 104 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · WordHandler.AddSdt (cognitive 103) · ×1
  • WordHandler.AddSdt (cognitive 103) src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:2190 — WordHandler.AddSdt has cognitive complexity 103 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.TrySetSectionLayout (cognitive 103) · ×1
  • WordHandler.TrySetSectionLayout (cognitive 103) src/officecli/Handlers/Word/WordHandler.Set.SectionLayout.cs:17 — WordHandler.TrySetSectionLayout has cognitive complexity 103 (threshold 15). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ChartSvgRenderer.RenderPieChartSvg (cognitive 102) · ×1
  • ChartSvgRenderer.RenderPieChartSvg (cognitive 102) src/officecli/Core/Chart/ChartSvgRenderer.cs:1705 — ChartSvgRenderer.RenderPieChartSvg has cognitive complexity 102 (threshold 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 · WordBatchEmitter.BuildChartProps (cognitive 101) · ×1
  • WordBatchEmitter.BuildChartProps (cognitive 101) src/officecli/Handlers/Word/WordBatchEmitter.Charts.cs:9 — WordBatchEmitter.BuildChartProps has cognitive complexity 101 (threshold 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 · FlowchartLayout.BkPosition (cognitive 100) · ×1
  • FlowchartLayout.BkPosition (cognitive 100) src/officecli/Core/Diagram/FlowchartLayout.cs:424 — FlowchartLayout.BkPosition has cognitive complexity 100 (threshold 15). Of this number, 98 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 · PivotTableHelper.CreatePivotTable (cognitive 100) · ×1
  • PivotTableHelper.CreatePivotTable (cognitive 100) src/officecli/Core/PivotTableHelper.cs:903 — PivotTableHelper.CreatePivotTable has cognitive complexity 100 (threshold 15). Of this number, 99 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 · ExcelHandler.SetShapeByPath (cognitive 100) · ×1
  • ExcelHandler.SetShapeByPath (cognitive 100) src/officecli/Handlers/Excel/ExcelHandler.Set.Drawings.cs:400 — ExcelHandler.SetShapeByPath has cognitive complexity 100 (threshold 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 · ExcelHandler.SetCfByPath (cognitive 100) · ×1
  • ExcelHandler.SetCfByPath (cognitive 100) src/officecli/Handlers/Excel/ExcelHandler.Set.Tables.cs:826 — ExcelHandler.SetCfByPath has cognitive complexity 100 (threshold 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 · MarkdownParser.ParseInlines (cognitive 98) · ×1
  • MarkdownParser.ParseInlines (cognitive 98) src/officecli/Core/Markdown/MarkdownParser.cs:630 — MarkdownParser.ParseInlines has cognitive complexity 98 (threshold 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 · WordHandler.SetFieldPath (cognitive 98) · ×1
  • WordHandler.SetFieldPath (cognitive 98) src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs:178 — WordHandler.SetFieldPath has cognitive complexity 98 (threshold 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 · PowerPointHandler.ProcessFindInPptParagraph (cognitive 96) · ×1
  • PowerPointHandler.ProcessFindInPptParagraph (cognitive 96) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.FindReplace.cs:107 — PowerPointHandler.ProcessFindInPptParagraph has cognitive complexity 96 (threshold 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 · PowerPointHandler.AddParagraph (cognitive 94) · ×1
  • PowerPointHandler.AddParagraph (cognitive 94) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Text.cs:168 — PowerPointHandler.AddParagraph has cognitive complexity 94 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ExcelHandler.BuildRowInnerHtml (cognitive 93) · ×1
  • ExcelHandler.BuildRowInnerHtml (cognitive 93) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:829 — ExcelHandler.BuildRowInnerHtml has cognitive complexity 93 (threshold 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 · WordHandler.CreateImageNode (cognitive 93) · ×1
  • WordHandler.CreateImageNode (cognitive 93) src/officecli/Handlers/Word/WordHandler.ImageHelpers.cs:374 — WordHandler.CreateImageNode has cognitive complexity 93 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.ElementToNode (cognitive 93) · ×1
  • WordHandler.ElementToNode (cognitive 93) src/officecli/Handlers/Word/WordHandler.Navigation.cs:6196 — WordHandler.ElementToNode has cognitive complexity 93 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ExcelHandler.SetOleByPath (cognitive 92) · ×1
  • ExcelHandler.SetOleByPath (cognitive 92) src/officecli/Handlers/Excel/ExcelHandler.Set.Drawings.cs:128 — ExcelHandler.SetOleByPath has cognitive complexity 92 (threshold 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 · ExcelHandler.SortRangeRows (cognitive 92) · ×1
  • ExcelHandler.SortRangeRows (cognitive 92) src/officecli/Handlers/Excel/ExcelHandler.Set.Ranges.cs:241 — ExcelHandler.SortRangeRows has cognitive complexity 92 (threshold 15). Of this number, 90 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 · WordBatchEmitter.EmitComments (cognitive 92) · ×1
  • WordBatchEmitter.EmitComments (cognitive 92) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:1604 — WordBatchEmitter.EmitComments has cognitive complexity 92 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.ApplyParagraphLevelProperty (cognitive 92) · ×1
  • WordHandler.ApplyParagraphLevelProperty (cognitive 92) src/officecli/Handlers/Word/WordHandler.Set.cs:1156 — WordHandler.ApplyParagraphLevelProperty has cognitive complexity 92 (threshold 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 · ChartSvgRenderer.RenderComboChartSvg (cognitive 91) · ×1
  • ChartSvgRenderer.RenderComboChartSvg (cognitive 91) src/officecli/Core/Chart/ChartSvgRenderer.cs:2711 — ChartSvgRenderer.RenderComboChartSvg has cognitive complexity 91 (threshold 15). Of this number, 89 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 · PivotTableHelper.ParseValueFields (cognitive 90) · ×1
  • PivotTableHelper.ParseValueFields (cognitive 90) src/officecli/Core/PivotTableHelper.Parse.cs:122 — PivotTableHelper.ParseValueFields has cognitive complexity 90 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ExcelBatchEmitter.EmitSheet (cognitive 90) · ×1
  • ExcelBatchEmitter.EmitSheet (cognitive 90) src/officecli/Handlers/Excel/ExcelBatchEmitter.cs:325 — ExcelBatchEmitter.EmitSheet has cognitive complexity 90 (threshold 15). Of this number, 88 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 · FlowchartLayout.Route (cognitive 89) · ×1
  • FlowchartLayout.Route (cognitive 89) src/officecli/Core/Diagram/FlowchartLayout.cs:255 — FlowchartLayout.Route has cognitive complexity 89 (threshold 15). Of this number, 84 points are the body's own statements and 5 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 · PowerPointHandler.RenderShapeSvg (cognitive 88) · ×1
  • PowerPointHandler.RenderShapeSvg (cognitive 88) src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:256 — PowerPointHandler.RenderShapeSvg has cognitive complexity 88 (threshold 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 · watch-sse-core.es.addEventListener("update") (cognitive 88) · ×1
  • watch-sse-core.es.addEventListener("update") (cognitive 88) src/officecli/Resources/watch-sse-core.js:318 — watch-sse-core.es.addEventListener("update") has cognitive complexity 88 (threshold 15). Drivers by points: if/else 33 (74 pts), boolean chains 6, loops 1 (6 pts), error handling 1 (2 pts) (nesting depth added 47). Of this number, 42 points are the body's own statements and 46 belong to 2 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · (anonymous) (cognitive 88) · ×1
  • (anonymous) (cognitive 88) src/officecli/Resources/watch-sse-core.js:318 — (anonymous) has cognitive complexity 88 (threshold 15). Drivers by points: if/else 33 (74 pts), boolean chains 6, loops 1 (6 pts), error handling 1 (2 pts) (nesting depth added 47). Of this number, 42 points are the body's own statements and 46 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 · PivotTableHelper.BuildPivotTableDefinition (cognitive 87) · ×1
  • PivotTableHelper.BuildPivotTableDefinition (cognitive 87) src/officecli/Core/PivotTableHelper.Definition.cs:130 — PivotTableHelper.BuildPivotTableDefinition has cognitive complexity 87 (threshold 15). 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 · WordHandler.AddOle (cognitive 87) · ×1
  • WordHandler.AddOle (cognitive 87) src/officecli/Handlers/Word/WordHandler.Add.Media.cs:1235 — WordHandler.AddOle has cognitive complexity 87 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ExcelHandler.SetCore (cognitive 85) · ×1
  • ExcelHandler.SetCore (cognitive 85) src/officecli/Handlers/Excel/ExcelHandler.Set.cs:39 — ExcelHandler.SetCore has cognitive complexity 85 (threshold 15). Of this number, 83 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 · WordBatchEmitter.EmitBody (cognitive 85) · ×1
  • WordBatchEmitter.EmitBody (cognitive 85) src/officecli/Handlers/Word/WordBatchEmitter.cs:627 — WordBatchEmitter.EmitBody has cognitive complexity 85 (threshold 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 · PowerPointHandler.AddTable (cognitive 84) · ×1
  • PowerPointHandler.AddTable (cognitive 84) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Table.cs:17 — PowerPointHandler.AddTable has cognitive complexity 84 (threshold 15). Of this number, 81 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExcelHandler.RefreshStaleFormulaCaches (cognitive 83) · ×1
  • ExcelHandler.RefreshStaleFormulaCaches (cognitive 83) src/officecli/Handlers/Excel/ExcelHandler.FormulaCache.cs:150 — ExcelHandler.RefreshStaleFormulaCaches has cognitive complexity 83 (threshold 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 · ExcelHandler.TrySetWorkbookSetting (cognitive 83) · ×1
  • ExcelHandler.TrySetWorkbookSetting (cognitive 83) src/officecli/Handlers/Excel/ExcelHandler.Set.Workbook.cs:23 — ExcelHandler.TrySetWorkbookSetting has cognitive complexity 83 (threshold 15). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · PowerPointHandler.ApplyTableBorderFanOut (cognitive 83) · ×1
  • PowerPointHandler.ApplyTableBorderFanOut (cognitive 83) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Table.cs:289 — PowerPointHandler.ApplyTableBorderFanOut has cognitive complexity 83 (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.
D2 · Cognitive Complexity · WordHandler.RenderImageHtml (cognitive 82) · ×1
  • WordHandler.RenderImageHtml (cognitive 82) REDACTED:229 — WordHandler.RenderImageHtml has cognitive complexity 82 (threshold 15). Of this number, 80 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · watch-overlay.applyMarks (cognitive 82) · ×1
  • watch-overlay.applyMarks (cognitive 82) src/officecli/Resources/watch-overlay.js:423 — watch-overlay.applyMarks has cognitive complexity 82 (threshold 15). Drivers by points: if/else 22 (66 pts), loops 3 (7 pts), error handling 2 (5 pts), boolean chains 4 (nesting depth added 51). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExcelHandler.SetRange (cognitive 81) · ×1
  • ExcelHandler.SetRange (cognitive 81) src/officecli/Handlers/Excel/ExcelHandler.Set.Ranges.cs:21 — ExcelHandler.SetRange has cognitive complexity 81 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.AppendW14CssEffects (cognitive 81) · ×1
  • WordHandler.AppendW14CssEffects (cognitive 81) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:1988 — WordHandler.AppendW14CssEffects has cognitive complexity 81 (threshold 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 · WordHandler.ViewAsAnnotated (cognitive 81) · ×1
  • WordHandler.ViewAsAnnotated (cognitive 81) src/officecli/Handlers/Word/WordHandler.View.cs:510 — WordHandler.ViewAsAnnotated has cognitive complexity 81 (threshold 15). Of this number, 80 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 · PivotTableHelper.BuildTreeAxisItems (cognitive 80) · ×1
  • PivotTableHelper.BuildTreeAxisItems (cognitive 80) src/officecli/Core/PivotTableHelper.Definition.cs:1063 — PivotTableHelper.BuildTreeAxisItems has cognitive complexity 80 (threshold 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 · WordHandler.AddRow (cognitive 80) · ×1
  • WordHandler.AddRow (cognitive 80) src/officecli/Handlers/Word/WordHandler.Add.Table.cs:845 — WordHandler.AddRow has cognitive complexity 80 (threshold 15). Of this number, 78 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 · WordHandler.ReadW14TextEffects (cognitive 80) · ×1
  • WordHandler.ReadW14TextEffects (cognitive 80) src/officecli/Handlers/Word/WordHandler.Helpers.TextEffect.cs:270 — WordHandler.ReadW14TextEffects has cognitive complexity 80 (threshold 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 · ExcelHandler.ApplyChartPositionSet (cognitive 79) · ×1
  • ExcelHandler.ApplyChartPositionSet (cognitive 79) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Chart.cs:138 — ExcelHandler.ApplyChartPositionSet has cognitive complexity 79 (threshold 15). Of this number, 74 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 · ExcelHandler.BuildConditionalFormatMap (cognitive 79) · ×1
  • ExcelHandler.BuildConditionalFormatMap (cognitive 79) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:1192 — ExcelHandler.BuildConditionalFormatMap has cognitive complexity 79 (threshold 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 · WordHandler.SetElementTableRow (cognitive 79) · ×1
  • WordHandler.SetElementTableRow (cognitive 79) src/officecli/Handlers/Word/WordHandler.Set.Element.cs:2586 — WordHandler.SetElementTableRow has cognitive complexity 79 (threshold 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 · WordHandler.ViewAsTextJson (cognitive 79) · ×1
  • WordHandler.ViewAsTextJson (cognitive 79) src/officecli/Handlers/Word/WordHandler.View.cs:1035 — WordHandler.ViewAsTextJson has cognitive complexity 79 (threshold 15). Of this number, 78 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PivotTableHelper.BuildMultiColItems (cognitive 78) · ×1
  • PivotTableHelper.BuildMultiColItems (cognitive 78) src/officecli/Core/PivotTableHelper.Definition.cs:902 — PivotTableHelper.BuildMultiColItems has cognitive complexity 78 (threshold 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 · PowerPointHandler.AddPlaceholder (cognitive 78) · ×1
  • PowerPointHandler.AddPlaceholder (cognitive 78) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1184 — PowerPointHandler.AddPlaceholder has cognitive complexity 78 (threshold 15). Of this number, 75 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, 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 · PowerPointHandler.ApplyShapeAnimation (cognitive 78) · ×1
  • PowerPointHandler.ApplyShapeAnimation (cognitive 78) src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:787 — PowerPointHandler.ApplyShapeAnimation has cognitive complexity 78 (threshold 15). Of this number, 77 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 · PowerPointHandler.ReadBackground (cognitive 78) · ×1
  • PowerPointHandler.ReadBackground (cognitive 78) src/officecli/Handlers/Pptx/PowerPointHandler.Background.cs:560 — PowerPointHandler.ReadBackground has cognitive complexity 78 (threshold 15). Of this number, 70 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.AddBookmark (cognitive 78) · ×1
  • WordHandler.AddBookmark (cognitive 78) src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:450 — WordHandler.AddBookmark has cognitive complexity 78 (threshold 15). Of this number, 75 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.CollectFormFieldEntries (cognitive 78) · ×1
  • WordHandler.CollectFormFieldEntries (cognitive 78) src/officecli/Handlers/Word/WordHandler.View.cs:1601 — WordHandler.CollectFormFieldEntries has cognitive complexity 78 (threshold 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 · CompoundFile.ReadStream (cognitive 76) · ×1
  • CompoundFile.ReadStream (cognitive 76) src/officecli/Core/CompoundFile.cs:214 — CompoundFile.ReadStream has cognitive complexity 76 (threshold 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 · ExcelHandler.AddAutoFilter (cognitive 76) · ×1
  • ExcelHandler.AddAutoFilter (cognitive 76) src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs:715 — ExcelHandler.AddAutoFilter has cognitive complexity 76 (threshold 15). Of this number, 75 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 · ExcelHandler.PopulateAutoFilterCriteria (cognitive 76) · ×1
  • ExcelHandler.PopulateAutoFilterCriteria (cognitive 76) src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs:971 — ExcelHandler.PopulateAutoFilterCriteria has cognitive complexity 76 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PptxBatchEmitter.EmitTable (cognitive 76) · ×1
  • PptxBatchEmitter.EmitTable (cognitive 76) src/officecli/Handlers/Pptx/PptxBatchEmitter.Table.cs:17 — PptxBatchEmitter.EmitTable has cognitive complexity 76 (threshold 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 · SchemaHelpLoader.ValidateProperties (cognitive 76) · ×1
  • SchemaHelpLoader.ValidateProperties (cognitive 76) src/officecli/Help/SchemaHelpLoader.cs:546 — SchemaHelpLoader.ValidateProperties has cognitive complexity 76 (threshold 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 · ChartSvgRenderer.ExtractCxChartInfo (cognitive 75) · ×1
  • ChartSvgRenderer.ExtractCxChartInfo (cognitive 75) src/officecli/Core/Chart/ChartSvgRenderer.CxExtract.cs:36 — ChartSvgRenderer.ExtractCxChartInfo has cognitive complexity 75 (threshold 15). Of this number, 73 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · FlowchartLayout.Layout (cognitive 75) · ×1
  • FlowchartLayout.Layout (cognitive 75) src/officecli/Core/Diagram/FlowchartLayout.cs:47 — FlowchartLayout.Layout has cognitive complexity 75 (threshold 15). Of this number, 72 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 · FormulaParser.ParseMatrix (cognitive 75) · ×1
  • FormulaParser.ParseMatrix (cognitive 75) src/officecli/Core/Formula/FormulaParser.cs:2378 — FormulaParser.ParseMatrix has cognitive complexity 75 (threshold 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 · ExcelHandler.QueryRowsByColumnPredicate (cognitive 75) · ×1
  • ExcelHandler.QueryRowsByColumnPredicate (cognitive 75) src/officecli/Handlers/Excel/ExcelHandler.Query.RowWhere.cs:60 — ExcelHandler.QueryRowsByColumnPredicate has cognitive complexity 75 (threshold 15). Of this number, 74 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 · PowerPointHandler.ReadShapeAnimation (cognitive 74) · ×1
  • PowerPointHandler.ReadShapeAnimation (cognitive 74) src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2229 — PowerPointHandler.ReadShapeAnimation has cognitive complexity 74 (threshold 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 · WordHandler.AddHyperlink (cognitive 74) · ×1
  • WordHandler.AddHyperlink (cognitive 74) src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:1002 — WordHandler.AddHyperlink has cognitive complexity 74 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ChartSvgRenderer.RenderRadarChartSvg (cognitive 73) · ×1
  • ChartSvgRenderer.RenderRadarChartSvg (cognitive 73) src/officecli/Core/Chart/ChartSvgRenderer.cs:2292 — ChartSvgRenderer.RenderRadarChartSvg has cognitive complexity 73 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.ResolvePptParagraphsForFindInternal (cognitive 73) · ×1
  • PowerPointHandler.ResolvePptParagraphsForFindInternal (cognitive 73) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.FindReplace.cs:431 — PowerPointHandler.ResolvePptParagraphsForFindInternal has cognitive complexity 73 (threshold 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 · PowerPointHandler.RenderTextBodySvg (cognitive 73) · ×1
  • PowerPointHandler.RenderTextBodySvg (cognitive 73) src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:615 — PowerPointHandler.RenderTextBodySvg has cognitive complexity 73 (threshold 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 · PptxBatchEmitter.ScanSlideExoticContent (cognitive 73) · ×1
  • PptxBatchEmitter.ScanSlideExoticContent (cognitive 73) src/officecli/Handlers/Pptx/PptxBatchEmitter.cs:1104 — PptxBatchEmitter.ScanSlideExoticContent has cognitive complexity 73 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · CommandBuilder.BuildMarkCommand (cognitive 72) · ×1
  • CommandBuilder.BuildMarkCommand (cognitive 72) src/officecli/CommandBuilder.Mark.cs:21 — CommandBuilder.BuildMarkCommand has cognitive complexity 72 (threshold 15). None of this is in the body itself: all 72 points belong to one function literal inside it that branches (line 38). 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 · PowerPointHandler.ResolveIdPath (cognitive 72) · ×1
  • PowerPointHandler.ResolveIdPath (cognitive 72) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Path.cs:226 — PowerPointHandler.ResolveIdPath has cognitive complexity 72 (threshold 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 · PowerPointHandler.PopulateAnimationNode (cognitive 72) · ×1
  • PowerPointHandler.PopulateAnimationNode (cognitive 72) REDACTED:2468 — PowerPointHandler.PopulateAnimationNode has cognitive complexity 72 (threshold 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 · ExcelHandler.Import (cognitive 71) · ×1
  • ExcelHandler.Import (cognitive 71) src/officecli/Handlers/Excel/ExcelHandler.Import.cs:25 — ExcelHandler.Import has cognitive complexity 71 (threshold 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 · PowerPointHandler.AddGroup (cognitive 71) · ×1
  • PowerPointHandler.AddGroup (cognitive 71) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:798 — PowerPointHandler.AddGroup has cognitive complexity 71 (threshold 15). Of this number, 68 points are the body's own statements and 3 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 · PowerPointHandler.ConvertOmmlNode (cognitive 71) · ×1
  • PowerPointHandler.ConvertOmmlNode (cognitive 71) src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:2036 — PowerPointHandler.ConvertOmmlNode has cognitive complexity 71 (threshold 15). Of this number, 69 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 · WordHandler.MoveCore (cognitive 71) · ×1
  • WordHandler.MoveCore (cognitive 71) src/officecli/Handlers/Word/WordHandler.Mutations.cs:1227 — WordHandler.MoveCore has cognitive complexity 71 (threshold 15). Of this number, 64 points are the body's own statements and 7 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 · PowerPointHandler.CustomGeometryToClipPath (cognitive 69) · ×1
  • PowerPointHandler.CustomGeometryToClipPath (cognitive 69) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:217 — PowerPointHandler.CustomGeometryToClipPath has cognitive complexity 69 (threshold 15). Of this number, 65 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 · PowerPointHandler.ConnectorToNode (cognitive 69) · ×1
  • PowerPointHandler.ConnectorToNode (cognitive 69) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:3192 — PowerPointHandler.ConnectorToNode has cognitive complexity 69 (threshold 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 · WordHandler.AddLvl (cognitive 69) · ×1
  • WordHandler.AddLvl (cognitive 69) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:2459 — WordHandler.AddLvl has cognitive complexity 69 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · WordHandler.ViewAsText (cognitive 68) · ×1
  • WordHandler.ViewAsText (cognitive 68) src/officecli/Handlers/Word/WordHandler.View.cs:330 — WordHandler.ViewAsText has cognitive complexity 68 (threshold 15). Of this number, 67 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 · ChartSvgRenderer.RenderLegendHtml (cognitive 66) · ×1
  • ChartSvgRenderer.RenderLegendHtml (cognitive 66) src/officecli/Core/Chart/ChartSvgRenderer.cs:4881 — ChartSvgRenderer.RenderLegendHtml has cognitive complexity 66 (threshold 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 · PowerPointHandler.MatchesGenericAttributes (cognitive 66) · ×1
  • PowerPointHandler.MatchesGenericAttributes (cognitive 66) src/officecli/Handlers/Pptx/PowerPointHandler.Selector.cs:276 — PowerPointHandler.MatchesGenericAttributes has cognitive complexity 66 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ChartSvgRenderer.RenderBubbleChartSvg (cognitive 65) · ×1
  • ChartSvgRenderer.RenderBubbleChartSvg (cognitive 65) src/officecli/Core/Chart/ChartSvgRenderer.cs:2394 — ChartSvgRenderer.RenderBubbleChartSvg has cognitive complexity 65 (threshold 15). Of this number, 64 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 · PowerPointHandler.SetShapeAnimationByPath (cognitive 65) · ×1
  • PowerPointHandler.SetShapeAnimationByPath (cognitive 65) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1964 — PowerPointHandler.SetShapeAnimationByPath has cognitive complexity 65 (threshold 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 · WordHandler.SetFormField (cognitive 65) · ×1
  • WordHandler.SetFormField (cognitive 65) src/officecli/Handlers/Word/WordHandler.FormFields.cs:169 — WordHandler.SetFormField has cognitive complexity 65 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · CommandBuilder.RunHelp (cognitive 64) · ×1
  • CommandBuilder.RunHelp (cognitive 64) src/officecli/CommandBuilder.Help.cs:201 — CommandBuilder.RunHelp has cognitive complexity 64 (threshold 15). Of this number, 62 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 · ExcelHandler.RenderExcelChart (cognitive 64) · ×1
  • ExcelHandler.RenderExcelChart (cognitive 64) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.Charts.cs:97 — ExcelHandler.RenderExcelChart has cognitive complexity 64 (threshold 15). Of this number, 62 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 · ExcelStyleManager.GetOrCreateNumFmt (cognitive 63) · ×1
  • ExcelStyleManager.GetOrCreateNumFmt (cognitive 63) src/officecli/Core/ExcelStyleManager.cs:662 — ExcelStyleManager.GetOrCreateNumFmt has cognitive complexity 63 (threshold 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 · ExcelHandler.CheckAllGeneralPrecisionLoss (cognitive 63) · ×1
  • ExcelHandler.CheckAllGeneralPrecisionLoss (cognitive 63) src/officecli/Handlers/Excel/ExcelHandler.CheckGeneralPrecision.cs:44 — ExcelHandler.CheckAllGeneralPrecisionLoss has cognitive complexity 63 (threshold 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 · ExcelHandler.BuildDataBarMap (cognitive 63) · ×1
  • ExcelHandler.BuildDataBarMap (cognitive 63) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:1383 — ExcelHandler.BuildDataBarMap has cognitive complexity 63 (threshold 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 · ExcelHandler.ApplyNumberFormat (cognitive 63) · ×1
  • ExcelHandler.ApplyNumberFormat (cognitive 63) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:3279 — ExcelHandler.ApplyNumberFormat has cognitive complexity 63 (threshold 15). Of this number, 61 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.CollectInlinedPartsEmitData (cognitive 63) · ×1
  • WordHandler.CollectInlinedPartsEmitData (cognitive 63) src/officecli/Handlers/WordHandler.cs:1284 — WordHandler.CollectInlinedPartsEmitData has cognitive complexity 63 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · watch-overlay.document.addEventListener("mousemove") (cognitive 63) · ×1
  • watch-overlay.document.addEventListener("mousemove") (cognitive 63) src/officecli/Resources/watch-overlay.js:822 — watch-overlay.document.addEventListener("mousemove") has cognitive complexity 63 (threshold 15). Drivers by points: if/else 18 (45 pts), loops 2 (12 pts), boolean chains 6 (nesting depth added 37). 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 · (anonymous) (cognitive 63) · ×1
  • (anonymous) (cognitive 63) src/officecli/Resources/watch-overlay.js:822 — (anonymous) has cognitive complexity 63 (threshold 15). Drivers by points: if/else 18 (45 pts), loops 2 (12 pts), boolean chains 6 (nesting depth added 37). 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 · PowerPointHandler.GetShapeFillCss (cognitive 62) · ×1
  • PowerPointHandler.GetShapeFillCss (cognitive 62) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:23 — PowerPointHandler.GetShapeFillCss has cognitive complexity 62 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.CheckTextOverflow (cognitive 62) · ×1
  • PowerPointHandler.CheckTextOverflow (cognitive 62) src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:3957 — PowerPointHandler.CheckTextOverflow has cognitive complexity 62 (threshold 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 · WordHandler.BuildAbstractNumElement (cognitive 62) · ×1
  • WordHandler.BuildAbstractNumElement (cognitive 62) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:2272 — WordHandler.BuildAbstractNumElement has cognitive complexity 62 (threshold 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 · WordHandler.MatchesRunSelector (cognitive 62) · ×1
  • WordHandler.MatchesRunSelector (cognitive 62) src/officecli/Handlers/Word/WordHandler.Selector.cs:287 — WordHandler.MatchesRunSelector has cognitive complexity 62 (threshold 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 · ChartSvgRenderer.RenderMultiRingDoughnut (cognitive 61) · ×1
  • ChartSvgRenderer.RenderMultiRingDoughnut (cognitive 61) src/officecli/Core/Chart/ChartSvgRenderer.cs:1855 — ChartSvgRenderer.RenderMultiRingDoughnut has cognitive complexity 61 (threshold 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 · ModernFunctionQualifier.AutoQuoteSheetRefs (cognitive 61) · ×1
  • ModernFunctionQualifier.AutoQuoteSheetRefs (cognitive 61) src/officecli/Core/Formula/ModernFunctionQualifier.cs:406 — ModernFunctionQualifier.AutoQuoteSheetRefs has cognitive complexity 61 (threshold 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 · PptxBatchEmitter.EmitGenericAlternateContentForSlide (cognitive 61) · ×1
  • PptxBatchEmitter.EmitGenericAlternateContentForSlide (cognitive 61) src/officecli/Handlers/Pptx/PptxBatchEmitter.Media.cs:558 — PptxBatchEmitter.EmitGenericAlternateContentForSlide has cognitive complexity 61 (threshold 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 · PivotTableHelper.RefreshPivotCacheFromSource (cognitive 60) · ×1
  • PivotTableHelper.RefreshPivotCacheFromSource (cognitive 60) src/officecli/Core/PivotTableHelper.Readback.cs:368 — PivotTableHelper.RefreshPivotCacheFromSource has cognitive complexity 60 (threshold 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 · PptxBatchEmitter.EmitParagraph (cognitive 60) · ×1
  • PptxBatchEmitter.EmitParagraph (cognitive 60) src/officecli/Handlers/Pptx/PptxBatchEmitter.Shape.cs:921 — PptxBatchEmitter.EmitParagraph has cognitive complexity 60 (threshold 15). Of this number, 57 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 · ChartSvgRenderer.RenderArea3DSvg (cognitive 59) · ×1
  • ChartSvgRenderer.RenderArea3DSvg (cognitive 59) src/officecli/Core/Chart/ChartSvgRenderer.cs:5440 — ChartSvgRenderer.RenderArea3DSvg has cognitive complexity 59 (threshold 15). Of this number, 56 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 · OutputFormatter.EnrichFromMessage (cognitive 59) · ×1
  • OutputFormatter.EnrichFromMessage (cognitive 59) src/officecli/Core/OutputFormatter.cs:317 — OutputFormatter.EnrichFromMessage has cognitive complexity 59 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ExcelHandler.BuildIconSetMap (cognitive 59) · ×1
  • ExcelHandler.BuildIconSetMap (cognitive 59) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:1491 — ExcelHandler.BuildIconSetMap has cognitive complexity 59 (threshold 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 · PowerPointHandler.SwapCore (cognitive 59) · ×1
  • PowerPointHandler.SwapCore (cognitive 59) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:987 — PowerPointHandler.SwapCore has cognitive complexity 59 (threshold 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 · PowerPointHandler.SetModel3DByPath (cognitive 59) · ×1
  • PowerPointHandler.SetModel3DByPath (cognitive 59) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:696 — PowerPointHandler.SetModel3DByPath has cognitive complexity 59 (threshold 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 · PowerPointHandler.SetZoomByPath (cognitive 58) · ×1
  • PowerPointHandler.SetZoomByPath (cognitive 58) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:539 — PowerPointHandler.SetZoomByPath has cognitive complexity 58 (threshold 15). Of this number, 57 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 · WordBatchEmitter.EmitSdt (cognitive 58) · ×1
  • WordBatchEmitter.EmitSdt (cognitive 58) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:2629 — WordBatchEmitter.EmitSdt has cognitive complexity 58 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PivotTableHelper.ApplyShowDataAs1x1 (cognitive 57) · ×1
  • PivotTableHelper.ApplyShowDataAs1x1 (cognitive 57) src/officecli/Core/PivotTableHelper.Parse.cs:639 — PivotTableHelper.ApplyShowDataAs1x1 has cognitive complexity 57 (threshold 15). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ExcelHandler.AddChart (cognitive 57) · ×1
  • ExcelHandler.AddChart (cognitive 57) src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:21 — ExcelHandler.AddChart has cognitive complexity 57 (threshold 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 · ExcelHandler.AddValidation (cognitive 57) · ×1
  • ExcelHandler.AddValidation (cognitive 57) src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs:501 — ExcelHandler.AddValidation has cognitive complexity 57 (threshold 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 · PowerPointHandler.SetMasterOrLayoutBackgroundByPath (cognitive 57) · ×1
  • PowerPointHandler.SetMasterOrLayoutBackgroundByPath (cognitive 57) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Slide.cs:179 — PowerPointHandler.SetMasterOrLayoutBackgroundByPath has cognitive complexity 57 (threshold 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 · PptxBatchEmitter.NormalizeSlideRawSlice (cognitive 57) · ×1
  • PptxBatchEmitter.NormalizeSlideRawSlice (cognitive 57) src/officecli/Handlers/Pptx/PptxBatchEmitter.cs:1414 — PptxBatchEmitter.NormalizeSlideRawSlice has cognitive complexity 57 (threshold 15). Of this number, 52 points are the body's own statements and 5 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 · ExcelHandler.AddPart (cognitive 56) · ×1
  • ExcelHandler.AddPart (cognitive 56) src/officecli/Handlers/Excel/ExcelHandler.Add.cs:1064 — ExcelHandler.AddPart has cognitive complexity 56 (threshold 15). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · PowerPointHandler.RawSetCore (cognitive 56) · ×1
  • PowerPointHandler.RawSetCore (cognitive 56) REDACTED:285 — PowerPointHandler.RawSetCore has cognitive complexity 56 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.AddChart (cognitive 56) · ×1
  • PowerPointHandler.AddChart (cognitive 56) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:644 — PowerPointHandler.AddChart has cognitive complexity 56 (threshold 15). Of this number, 53 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 · WordHandler.BuildSectionHfBundles (cognitive 56) · ×1
  • WordHandler.BuildSectionHfBundles (cognitive 56) REDACTED:3384 — WordHandler.BuildSectionHfBundles has cognitive complexity 56 (threshold 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 · WordHandler.TryGetParagraphTextWithFieldSentinels (cognitive 56) · ×1
  • WordHandler.TryGetParagraphTextWithFieldSentinels (cognitive 56) src/officecli/Handlers/Word/WordHandler.View.cs:230 — WordHandler.TryGetParagraphTextWithFieldSentinels has cognitive complexity 56 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.RawSetCore (cognitive 56) · ×1
  • WordHandler.RawSetCore (cognitive 56) src/officecli/Handlers/WordHandler.cs:1592 — WordHandler.RawSetCore has cognitive complexity 56 (threshold 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 · ChartHelper.BuildAxisNode (cognitive 55) · ×1
  • ChartHelper.BuildAxisNode (cognitive 55) src/officecli/Core/Chart/ChartHelper.Axis.cs:84 — ChartHelper.BuildAxisNode has cognitive complexity 55 (threshold 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 · ExcelStyleManager.GetOrCreateFont (cognitive 55) · ×1
  • ExcelStyleManager.GetOrCreateFont (cognitive 55) src/officecli/Core/ExcelStyleManager.cs:927 — ExcelStyleManager.GetOrCreateFont has cognitive complexity 55 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · FormulaEvaluator.EvalXlookup (cognitive 55) · ×1
  • FormulaEvaluator.EvalXlookup (cognitive 55) src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:1314 — FormulaEvaluator.EvalXlookup has cognitive complexity 55 (threshold 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 · PowerPointHandler.ReadTransitionDirection (cognitive 55) · ×1
  • PowerPointHandler.ReadTransitionDirection (cognitive 55) src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2742 — PowerPointHandler.ReadTransitionDirection has cognitive complexity 55 (threshold 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 · WordHandler.EnsureAllParaIds (cognitive 55) · ×1
  • WordHandler.EnsureAllParaIds (cognitive 55) src/officecli/Handlers/Word/WordHandler.Helpers.Field.cs:325 — WordHandler.EnsureAllParaIds has cognitive complexity 55 (threshold 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 · WordHandler.ResolveParagraphsForFind (cognitive 55) · ×1
  • WordHandler.ResolveParagraphsForFind (cognitive 55) src/officecli/Handlers/Word/WordHandler.Helpers.FindReplace.cs:890 — WordHandler.ResolveParagraphsForFind has cognitive complexity 55 (threshold 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 · WordHandler.CollectParaRunInHeaderFooter (cognitive 55) · ×1
  • WordHandler.CollectParaRunInHeaderFooter (cognitive 55) src/officecli/Handlers/Word/WordHandler.Query.cs:3249 — WordHandler.CollectParaRunInHeaderFooter has cognitive complexity 55 (threshold 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 · WordHandler.MatchesParagraphAttrs (cognitive 55) · ×1
  • WordHandler.MatchesParagraphAttrs (cognitive 55) src/officecli/Handlers/Word/WordHandler.Selector.cs:169 — WordHandler.MatchesParagraphAttrs has cognitive complexity 55 (threshold 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 · watch-sse-core.wordPatchUpdate (cognitive 55) · ×1
  • watch-sse-core.wordPatchUpdate (cognitive 55) src/officecli/Resources/watch-sse-core.js:222 — watch-sse-core.wordPatchUpdate has cognitive complexity 55 (threshold 15). Drivers by points: if/else 17 (23 pts), loops 6 (20 pts), boolean chains 6, ternaries 2 (6 pts) (nesting depth added 24). Most of this is not in the body itself: 3 of the 55 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 239, 226, 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 · ExcelHandler.GetDumpColumnNodes (cognitive 54) · ×1
  • ExcelHandler.GetDumpColumnNodes (cognitive 54) src/officecli/Handlers/Excel/ExcelHandler.DumpSupport.cs:269 — ExcelHandler.GetDumpColumnNodes has cognitive complexity 54 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.GetOleEmitData (cognitive 54) · ×1
  • WordHandler.GetOleEmitData (cognitive 54) src/officecli/Handlers/WordHandler.cs:554 — WordHandler.GetOleEmitData has cognitive complexity 54 (threshold 15). Of this number, 53 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 · ExcelHandler.AddNamedRange (cognitive 53) · ×1
  • ExcelHandler.AddNamedRange (cognitive 53) src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs:20 — ExcelHandler.AddNamedRange has cognitive complexity 53 (threshold 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 · ExcelHandler.GetDumpRowNodes (cognitive 53) · ×1
  • ExcelHandler.GetDumpRowNodes (cognitive 53) src/officecli/Handlers/Excel/ExcelHandler.DumpSupport.cs:59 — ExcelHandler.GetDumpRowNodes has cognitive complexity 53 (threshold 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 · PowerPointHandler.SetGroupByPath (cognitive 53) · ×1
  • PowerPointHandler.SetGroupByPath (cognitive 53) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:583 — PowerPointHandler.SetGroupByPath has cognitive complexity 53 (threshold 15). Of this number, 52 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 · PowerPointHandler.SetTableRowByPath (cognitive 53) · ×1
  • PowerPointHandler.SetTableRowByPath (cognitive 53) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Table.cs:46 — PowerPointHandler.SetTableRowByPath has cognitive complexity 53 (threshold 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 · WordHandler.ResolveShapeFillCss (cognitive 53) · ×1
  • WordHandler.ResolveShapeFillCss (cognitive 53) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:131 — WordHandler.ResolveShapeFillCss has cognitive complexity 53 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · CommandBuilder.PrintBatchResults (cognitive 52) · ×1
  • CommandBuilder.PrintBatchResults (cognitive 52) src/officecli/CommandBuilder.cs:1482 — CommandBuilder.PrintBatchResults has cognitive complexity 52 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ChartHelper.DetectChartType (cognitive 52) · ×1
  • ChartHelper.DetectChartType (cognitive 52) src/officecli/Core/Chart/ChartHelper.Reader.cs:1740 — ChartHelper.DetectChartType has cognitive complexity 52 (threshold 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 · ChartSvgRenderer.AppendTrendline (cognitive 52) · ×1
  • ChartSvgRenderer.AppendTrendline (cognitive 52) src/officecli/Core/Chart/ChartSvgRenderer.cs:1157 — ChartSvgRenderer.AppendTrendline has cognitive complexity 52 (threshold 15). Of this number, 49 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 · PivotTableHelper.BuildAxisItems (cognitive 52) · ×1
  • PivotTableHelper.BuildAxisItems (cognitive 52) src/officecli/Core/PivotTableHelper.Definition.cs:539 — PivotTableHelper.BuildAxisItems has cognitive complexity 52 (threshold 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 · ExcelBatchEmitter.EmitPivotTables (cognitive 52) · ×1
  • ExcelBatchEmitter.EmitPivotTables (cognitive 52) src/officecli/Handlers/Excel/ExcelBatchEmitter.Elements.cs:685 — ExcelBatchEmitter.EmitPivotTables has cognitive complexity 52 (threshold 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 · ExcelHandler.AddDataBar (cognitive 52) · ×1
  • ExcelHandler.AddDataBar (cognitive 52) src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:84 — ExcelHandler.AddDataBar has cognitive complexity 52 (threshold 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 · ExcelHandler.DetectTables (cognitive 52) · ×1
  • ExcelHandler.DetectTables (cognitive 52) src/officecli/Handlers/Excel/ExcelHandler.Query.cs:2141 — ExcelHandler.DetectTables has cognitive 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExcelHandler.SetSparklineByPath (cognitive 52) · ×1
  • ExcelHandler.SetSparklineByPath (cognitive 52) src/officecli/Handlers/Excel/ExcelHandler.Set.Drawings.cs:20 — ExcelHandler.SetSparklineByPath has cognitive complexity 52 (threshold 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 · PowerPointHandler.GradientToCss (cognitive 52) · ×1
  • PowerPointHandler.GradientToCss (cognitive 52) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:612 — PowerPointHandler.GradientToCss has cognitive complexity 52 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.ResolveEffectiveDefRpCore (cognitive 52) · ×1
  • PowerPointHandler.ResolveEffectiveDefRpCore (cognitive 52) src/officecli/Handlers/Pptx/PowerPointHandler.StyleList.cs:70 — PowerPointHandler.ResolveEffectiveDefRpCore has cognitive complexity 52 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.ReadRowProps (cognitive 52) · ×1
  • WordHandler.ReadRowProps (cognitive 52) src/officecli/Handlers/Word/WordHandler.Navigation.cs:6364 — WordHandler.ReadRowProps has cognitive complexity 52 (threshold 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 · ExcelHandler.AddPicture (cognitive 51) · ×1
  • ExcelHandler.AddPicture (cognitive 51) src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:264 — ExcelHandler.AddPicture has cognitive complexity 51 (threshold 15). Of this number, 49 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 · ExcelHandler.ParseDataRangeForChart (cognitive 51) · ×1
  • ExcelHandler.ParseDataRangeForChart (cognitive 51) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Chart.cs:403 — ExcelHandler.ParseDataRangeForChart has cognitive complexity 51 (threshold 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 · WordHandler.RenderOlePreviewHtml (cognitive 51) · ×1
  • WordHandler.RenderOlePreviewHtml (cognitive 51) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Text.cs:1372 — WordHandler.RenderOlePreviewHtml has cognitive complexity 51 (threshold 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 · WordHandler.ResolveAnchorPosition (cognitive 51) · ×1
  • WordHandler.ResolveAnchorPosition (cognitive 51) src/officecli/Handlers/Word/WordHandler.Navigation.cs:486 — WordHandler.ResolveAnchorPosition has cognitive complexity 51 (threshold 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 · WordHandler.ResolveEffectiveRunPropertiesCore (cognitive 51) · ×1
  • WordHandler.ResolveEffectiveRunPropertiesCore (cognitive 51) src/officecli/Handlers/Word/WordHandler.StyleList.cs:34 — WordHandler.ResolveEffectiveRunPropertiesCore has cognitive complexity 51 (threshold 15). Of this number, 50 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 · WordHandler.MergeRunProperties (cognitive 51) · ×1
  • WordHandler.MergeRunProperties (cognitive 51) src/officecli/Handlers/Word/WordHandler.StyleList.cs:175 — WordHandler.MergeRunProperties has cognitive complexity 51 (threshold 15). Of this number, 50 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 · ModernFunctionQualifier.CollectLambdaParams (cognitive 50) · ×1
  • ModernFunctionQualifier.CollectLambdaParams (cognitive 50) src/officecli/Core/Formula/ModernFunctionQualifier.cs:151 — ModernFunctionQualifier.CollectLambdaParams has cognitive complexity 50 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ExcelHandler.GetCellStyleCss (cognitive 50) · ×1
  • ExcelHandler.GetCellStyleCss (cognitive 50) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:2209 — ExcelHandler.GetCellStyleCss has cognitive complexity 50 (threshold 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 · PowerPointHandler.GetMediaOnSlide (cognitive 50) · ×1
  • PowerPointHandler.GetMediaOnSlide (cognitive 50) REDACTED:3688 — PowerPointHandler.GetMediaOnSlide has cognitive complexity 50 (threshold 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 · WordHandler.ResolveIndentationFromStyle (cognitive 50) · ×1
  • WordHandler.ResolveIndentationFromStyle (cognitive 50) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:1239 — WordHandler.ResolveIndentationFromStyle has cognitive complexity 50 (threshold 15). Of this number, 49 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 · CommandBuilder.BuildPluginsLintCommand (cognitive 49) · ×1
  • CommandBuilder.BuildPluginsLintCommand (cognitive 49) src/officecli/CommandBuilder.Plugins.cs:208 — CommandBuilder.BuildPluginsLintCommand has cognitive complexity 49 (threshold 15). None of this is in the body itself: all 49 points belong to one function literal inside it that branches (line 229). 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 · ExcelHandler.ParseSrcRect (cognitive 49) · ×1
  • ExcelHandler.ParseSrcRect (cognitive 49) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:92 — ExcelHandler.ParseSrcRect has cognitive complexity 49 (threshold 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 · PowerPointHandler.SetOleByPath (cognitive 49) · ×1
  • PowerPointHandler.SetOleByPath (cognitive 49) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:828 — PowerPointHandler.SetOleByPath has cognitive complexity 49 (threshold 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 · PptxBatchEmitter.EmitSlide (cognitive 49) · ×1
  • PptxBatchEmitter.EmitSlide (cognitive 49) src/officecli/Handlers/Pptx/PptxBatchEmitter.cs:501 — PptxBatchEmitter.EmitSlide has cognitive complexity 49 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · WordHandler.AddFooter (cognitive 49) · ×1
  • WordHandler.AddFooter (cognitive 49) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:2898 — WordHandler.AddFooter has cognitive complexity 49 (threshold 15). Of this number, 48 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 · GenericXmlQuery.TryCreateTypedElement (cognitive 48) · ×1
  • GenericXmlQuery.TryCreateTypedElement (cognitive 48) REDACTED:522 — GenericXmlQuery.TryCreateTypedElement has cognitive complexity 48 (threshold 15). Of this number, 47 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 · PowerPointHandler.RenderChart (cognitive 48) · ×1
  • PowerPointHandler.RenderChart (cognitive 48) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Charts.cs:20 — PowerPointHandler.RenderChart has cognitive complexity 48 (threshold 15). Of this number, 46 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, 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 · PowerPointHandler.CopyRelationships (cognitive 48) · ×1
  • PowerPointHandler.CopyRelationships (cognitive 48) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:2077 — PowerPointHandler.CopyRelationships has cognitive complexity 48 (threshold 15). Of this number, 47 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordBatchEmitter.EmitStyles (cognitive 48) · ×1
  • WordBatchEmitter.EmitStyles (cognitive 48) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:3451 — WordBatchEmitter.EmitStyles has cognitive complexity 48 (threshold 15). Of this number, 47 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 · FormulaEvaluator.EvalMatch (cognitive 47) · ×1
  • FormulaEvaluator.EvalMatch (cognitive 47) src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:1116 — FormulaEvaluator.EvalMatch has cognitive complexity 47 (threshold 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 · PivotTableHelper.ApplyCalculatedFields (cognitive 47) · ×1
  • PivotTableHelper.ApplyCalculatedFields (cognitive 47) src/officecli/Core/PivotTableHelper.Definition.cs:1495 — PivotTableHelper.ApplyCalculatedFields has cognitive complexity 47 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · RawXmlHelper.ExecuteOnXmlString (cognitive 47) · ×1
  • RawXmlHelper.ExecuteOnXmlString (cognitive 47) src/officecli/Core/RawXmlHelper.cs:124 — RawXmlHelper.ExecuteOnXmlString has cognitive complexity 47 (threshold 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 · ExcelHandler.GetPictureNode (cognitive 47) · ×1
  • ExcelHandler.GetPictureNode (cognitive 47) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:341 — ExcelHandler.GetPictureNode has cognitive complexity 47 (threshold 15). 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: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.SetElementSdt (cognitive 47) · ×1
  • WordHandler.SetElementSdt (cognitive 47) src/officecli/Handlers/Word/WordHandler.Set.Element.cs:121 — WordHandler.SetElementSdt has cognitive complexity 47 (threshold 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 · WordHandler.SetGroupProps (cognitive 47) · ×1
  • WordHandler.SetGroupProps (cognitive 47) src/officecli/Handlers/Word/WordHandler.Set.Element.cs:3496 — WordHandler.SetGroupProps has cognitive complexity 47 (threshold 15). Of this number, 42 points are the body's own statements and 5 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 · WordHandler.FindFormFieldsInParagraph (cognitive 47) · ×1
  • WordHandler.FindFormFieldsInParagraph (cognitive 47) src/officecli/Handlers/Word/WordHandler.View.cs:81 — WordHandler.FindFormFieldsInParagraph has cognitive complexity 47 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · CommandBuilder.BuildDumpCommand (cognitive 46) · ×1
  • CommandBuilder.BuildDumpCommand (cognitive 46) src/officecli/CommandBuilder.Dump.cs:13 — CommandBuilder.BuildDumpCommand has cognitive complexity 46 (threshold 15). None of this is in the body itself: all 46 points belong to 2 function literals inside it that branch (lines 39, 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 · ChartExBuilder.BuildExtendedChartSpace (cognitive 46) · ×1
  • ChartExBuilder.BuildExtendedChartSpace (cognitive 46) src/officecli/Core/Chart/ChartExBuilder.cs:42 — ChartExBuilder.BuildExtendedChartSpace has cognitive complexity 46 (threshold 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 · PivotTableHelper.RefreshPivotCellsForView (cognitive 46) · ×1
  • PivotTableHelper.RefreshPivotCellsForView (cognitive 46) src/officecli/Core/PivotTableHelper.cs:2091 — PivotTableHelper.RefreshPivotCellsForView has cognitive complexity 46 (threshold 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 · ExcelHandler.RefreshStaleChartCaches (cognitive 46) · ×1
  • ExcelHandler.RefreshStaleChartCaches (cognitive 46) src/officecli/Handlers/Excel/ExcelHandler.ChartCache.cs:44 — ExcelHandler.RefreshStaleChartCaches has cognitive complexity 46 (threshold 15). Of this number, 45 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 · PowerPointHandler.GetOlesOnSlide (cognitive 46) · ×1
  • PowerPointHandler.GetOlesOnSlide (cognitive 46) REDACTED:4111 — PowerPointHandler.GetOlesOnSlide has cognitive complexity 46 (threshold 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 · WordHandler.AddHeader (cognitive 46) · ×1
  • WordHandler.AddHeader (cognitive 46) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:2698 — WordHandler.AddHeader has cognitive complexity 46 (threshold 15). Of this number, 45 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 · ChartSvgRenderer.RenderPie3DSvg (cognitive 45) · ×1
  • ChartSvgRenderer.RenderPie3DSvg (cognitive 45) src/officecli/Core/Chart/ChartSvgRenderer.cs:5276 — ChartSvgRenderer.RenderPie3DSvg has cognitive complexity 45 (threshold 15). Of this number, 44 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 · PivotTableHelper.ComputePivotGeometry (cognitive 45) · ×1
  • PivotTableHelper.ComputePivotGeometry (cognitive 45) src/officecli/Core/PivotTableHelper.cs:1680 — PivotTableHelper.ComputePivotGeometry has cognitive complexity 45 (threshold 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 · ExcelBatchEmitter.EmitCharts (cognitive 45) · ×1
  • ExcelBatchEmitter.EmitCharts (cognitive 45) src/officecli/Handlers/Excel/ExcelBatchEmitter.Elements.cs:376 — ExcelBatchEmitter.EmitCharts has cognitive complexity 45 (threshold 15). Of this number, 40 points are the body's own statements and 5 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 · ExcelHandler.GetSheetChildNodes (cognitive 45) · ×1
  • ExcelHandler.GetSheetChildNodes (cognitive 45) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Node.cs:132 — ExcelHandler.GetSheetChildNodes has cognitive complexity 45 (threshold 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 · ExcelHandler.GetFormattedCellValue (cognitive 45) · ×1
  • ExcelHandler.GetFormattedCellValue (cognitive 45) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:2775 — ExcelHandler.GetFormattedCellValue has cognitive complexity 45 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ExcelHandler.SetNamedRangeByPath (cognitive 45) · ×1
  • ExcelHandler.SetNamedRangeByPath (cognitive 45) src/officecli/Handlers/Excel/ExcelHandler.Set.Tables.cs:18 — ExcelHandler.SetNamedRangeByPath has cognitive complexity 45 (threshold 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 · PowerPointHandler.ViewAsStats (cognitive 45) · ×1
  • PowerPointHandler.ViewAsStats (cognitive 45) src/officecli/Handlers/Pptx/PowerPointHandler.View.cs:220 — PowerPointHandler.ViewAsStats has cognitive complexity 45 (threshold 15). Of this number, 44 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 · WordHandler.ValidateParentChild (cognitive 45) · ×1
  • WordHandler.ValidateParentChild (cognitive 45) src/officecli/Handlers/Word/WordHandler.Add.cs:353 — WordHandler.ValidateParentChild has cognitive complexity 45 (threshold 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 · WordHandler.SetDocumentProperties (cognitive 45) · ×1
  • WordHandler.SetDocumentProperties (cognitive 45) src/officecli/Handlers/Word/WordHandler.Add.cs:651 — WordHandler.SetDocumentProperties has cognitive complexity 45 (threshold 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 · WordHandler.SetShapeProps (cognitive 45) · ×1
  • WordHandler.SetShapeProps (cognitive 45) src/officecli/Handlers/Word/WordHandler.Set.Element.cs:3349 — WordHandler.SetShapeProps has cognitive complexity 45 (threshold 15). Of this number, 40 points are the body's own statements and 5 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 · ResidentServer.ExecuteSet (cognitive 45) · ×1
  • ResidentServer.ExecuteSet (cognitive 45) src/officecli/ResidentServer.cs:2159 — ResidentServer.ExecuteSet has cognitive complexity 45 (threshold 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 · watch-sse-core.wordDiffUpdate (cognitive 45) · ×1
  • watch-sse-core.wordDiffUpdate (cognitive 45) src/officecli/Resources/watch-sse-core.js:138 — watch-sse-core.wordDiffUpdate has cognitive complexity 45 (threshold 15). Drivers by points: if/else 18 (28 pts), loops 5 (9 pts), boolean chains 6, ternaries 1 (2 pts) (nesting depth added 15). None of this is in the body itself: all 45 points belong to 4 function literals inside it that branch (lines 147, 140, 157, …). 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 · ChartHelper.BuildBubbleChart (cognitive 44) · ×1
  • ChartHelper.BuildBubbleChart (cognitive 44) src/officecli/Core/Chart/ChartHelper.Builder.cs:1254 — ChartHelper.BuildBubbleChart has cognitive 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, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ChartSvgRenderer.RenderStockChartSvg (cognitive 44) · ×1
  • ChartSvgRenderer.RenderStockChartSvg (cognitive 44) src/officecli/Core/Chart/ChartSvgRenderer.cs:2969 — ChartSvgRenderer.RenderStockChartSvg has cognitive complexity 44 (threshold 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 · ModernFunctionQualifier.Qualify (cognitive 44) · ×1
  • ModernFunctionQualifier.Qualify (cognitive 44) src/officecli/Core/Formula/ModernFunctionQualifier.cs:289 — ModernFunctionQualifier.Qualify has cognitive complexity 44 (threshold 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 · UpdateChecker.RunRefresh (cognitive 44) · ×1
  • UpdateChecker.RunRefresh (cognitive 44) src/officecli/Core/UpdateChecker.cs:106 — UpdateChecker.RunRefresh has cognitive complexity 44 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.AddLineBreak (cognitive 44) · ×1
  • PowerPointHandler.AddLineBreak (cognitive 44) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Text.cs:470 — PowerPointHandler.AddLineBreak has cognitive complexity 44 (threshold 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 · PowerPointHandler.ResolveAnchorPosition (cognitive 44) · ×1
  • PowerPointHandler.ResolveAnchorPosition (cognitive 44) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Path.cs:129 — PowerPointHandler.ResolveAnchorPosition has cognitive 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WordBatchEmitter.TryEmitOleRun (cognitive 44) · ×1
  • WordBatchEmitter.TryEmitOleRun (cognitive 44) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:4042 — WordBatchEmitter.TryEmitOleRun has cognitive complexity 44 (threshold 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 · WordHandler.AcceptAllChanges (cognitive 44) · ×1
  • WordHandler.AcceptAllChanges (cognitive 44) src/officecli/Handlers/Word/WordHandler.Mutations.cs:2118 — WordHandler.AcceptAllChanges has cognitive complexity 44 (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.
D2 · Cognitive Complexity · FormulaEvaluator.EvalLinest (cognitive 43) · ×1
  • FormulaEvaluator.EvalLinest (cognitive 43) src/officecli/Core/Formula/FormulaEvaluator.Regression.cs:140 — FormulaEvaluator.EvalLinest has cognitive complexity 43 (threshold 15). Of this number, 41 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 · PivotTableHelper.BuildMultiRowItems (cognitive 43) · ×1
  • PivotTableHelper.BuildMultiRowItems (cognitive 43) src/officecli/Core/PivotTableHelper.Definition.cs:763 — PivotTableHelper.BuildMultiRowItems has cognitive complexity 43 (threshold 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 · RawXmlHelper.FirstOutOfGridToken (cognitive 43) · ×1
  • RawXmlHelper.FirstOutOfGridToken (cognitive 43) src/officecli/Core/RawXmlHelper.cs:1092 — RawXmlHelper.FirstOutOfGridToken has cognitive complexity 43 (threshold 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 · TableStyleResolver.MergeRegions (cognitive 43) · ×1
  • TableStyleResolver.MergeRegions (cognitive 43) src/officecli/Core/TableStyles/TableStyleResolver.cs:70 — TableStyleResolver.MergeRegions has cognitive 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExcelHandler.ViewAsTextJson (cognitive 43) · ×1
  • ExcelHandler.ViewAsTextJson (cognitive 43) src/officecli/Handlers/Excel/ExcelHandler.View.cs:431 — ExcelHandler.ViewAsTextJson has cognitive complexity 43 (threshold 15). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PowerPointHandler.RemoveSingleShapeAnimation (cognitive 43) · ×1
  • PowerPointHandler.RemoveSingleShapeAnimation (cognitive 43) src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:1561 — PowerPointHandler.RemoveSingleShapeAnimation has cognitive complexity 43 (threshold 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 · PowerPointHandler.BuildGradientFill (cognitive 43) · ×1
  • PowerPointHandler.BuildGradientFill (cognitive 43) src/officecli/Handlers/Pptx/PowerPointHandler.Background.cs:909 — PowerPointHandler.BuildGradientFill has cognitive complexity 43 (threshold 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 · PowerPointHandler.FindUnsupportedDescendant (cognitive 43) · ×1
  • PowerPointHandler.FindUnsupportedDescendant (cognitive 43) src/officecli/Handlers/Pptx/PowerPointHandler.Selector.cs:50 — PowerPointHandler.FindUnsupportedDescendant has cognitive complexity 43 (threshold 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 · ChartSvgRenderer.ExtractFillColor (cognitive 42) · ×1
  • ChartSvgRenderer.ExtractFillColor (cognitive 42) src/officecli/Core/Chart/ChartSvgRenderer.cs:4365 — ChartSvgRenderer.ExtractFillColor has cognitive complexity 42 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ExcelHandler.ViewAsText (cognitive 42) · ×1
  • ExcelHandler.ViewAsText (cognitive 42) src/officecli/Handlers/Excel/ExcelHandler.View.cs:16 — ExcelHandler.ViewAsText has cognitive complexity 42 (threshold 15). Of this number, 41 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 · PowerPointHandler.ApplyTransition (cognitive 42) · ×1
  • PowerPointHandler.ApplyTransition (cognitive 42) src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:323 — PowerPointHandler.ApplyTransition has cognitive complexity 42 (threshold 15). Of this number, 41 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, 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 · PowerPointHandler.CountLastSiblings (cognitive 42) · ×1
  • PowerPointHandler.CountLastSiblings (cognitive 42) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Path.cs:414 — PowerPointHandler.CountLastSiblings has cognitive complexity 42 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.ResolvePlaceholderFontSize (cognitive 42) · ×1
  • PowerPointHandler.ResolvePlaceholderFontSize (cognitive 42) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:1030 — PowerPointHandler.ResolvePlaceholderFontSize has cognitive complexity 42 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.RenderTableSvg (cognitive 42) · ×1
  • PowerPointHandler.RenderTableSvg (cognitive 42) src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:1121 — PowerPointHandler.RenderTableSvg has cognitive complexity 42 (threshold 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 · PptxBatchEmitter.FilterEmittableProps (cognitive 42) · ×1
  • PptxBatchEmitter.FilterEmittableProps (cognitive 42) src/officecli/Handlers/Pptx/PptxBatchEmitter.Filters.cs:114 — PptxBatchEmitter.FilterEmittableProps has cognitive complexity 42 (threshold 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 · WordBatchEmitter.CoalesceHyperlinkRuns (cognitive 42) · ×1
  • WordBatchEmitter.CoalesceHyperlinkRuns (cognitive 42) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:4852 — WordBatchEmitter.CoalesceHyperlinkRuns has cognitive complexity 42 (threshold 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 · WordHandler.MaterializeInlinedParts (cognitive 42) · ×1
  • WordHandler.MaterializeInlinedParts (cognitive 42) src/officecli/Handlers/Word/WordHandler.Add.Media.cs:979 — WordHandler.MaterializeInlinedParts has cognitive complexity 42 (threshold 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 · WordHandler.PopulateDocDefaults (cognitive 42) · ×1
  • WordHandler.PopulateDocDefaults (cognitive 42) src/officecli/Handlers/Word/WordHandler.Set.DocDefaults.cs:312 — WordHandler.PopulateDocDefaults has cognitive complexity 42 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · FormulaEvaluator.EvalTextJoin (cognitive 41) · ×1
  • FormulaEvaluator.EvalTextJoin (cognitive 41) src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:920 — FormulaEvaluator.EvalTextJoin has cognitive complexity 41 (threshold 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 · FormulaEvaluator.EvalLookup (cognitive 41) · ×1
  • FormulaEvaluator.EvalLookup (cognitive 41) src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:1232 — FormulaEvaluator.EvalLookup has cognitive complexity 41 (threshold 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 · ExcelHandler.SetValidationByPath (cognitive 41) · ×1
  • ExcelHandler.SetValidationByPath (cognitive 41) src/officecli/Handlers/Excel/ExcelHandler.Set.Tables.cs:171 — ExcelHandler.SetValidationByPath has cognitive complexity 41 (threshold 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 · ExcelHandler.PopulateWorkbookSettings (cognitive 41) · ×1
  • ExcelHandler.PopulateWorkbookSettings (cognitive 41) src/officecli/Handlers/Excel/ExcelHandler.Set.Workbook.cs:432 — ExcelHandler.PopulateWorkbookSettings has cognitive complexity 41 (threshold 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 · PowerPointHandler.AddMedia (cognitive 41) · ×1
  • PowerPointHandler.AddMedia (cognitive 41) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:837 — PowerPointHandler.AddMedia has cognitive complexity 41 (threshold 15). Of this number, 40 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, 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 · PowerPointHandler.ProcessPptFind (cognitive 41) · ×1
  • PowerPointHandler.ProcessPptFind (cognitive 41) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.FindReplace.cs:355 — PowerPointHandler.ProcessPptFind has cognitive complexity 41 (threshold 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 · PowerPointHandler.ReparseFromXml (cognitive 41) · ×1
  • PowerPointHandler.ReparseFromXml (cognitive 41) REDACTED:239 — PowerPointHandler.ReparseFromXml has cognitive complexity 41 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.ResolvePlaceholderLevelPpr (cognitive 41) · ×1
  • PowerPointHandler.ResolvePlaceholderLevelPpr (cognitive 41) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:1150 — PowerPointHandler.ResolvePlaceholderLevelPpr has cognitive complexity 41 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.SetSlideByPath (cognitive 41) · ×1
  • PowerPointHandler.SetSlideByPath (cognitive 41) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Slide.cs:303 — PowerPointHandler.SetSlideByPath has cognitive complexity 41 (threshold 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 · PowerPointHandler.ViewAsStatsJson (cognitive 41) · ×1
  • PowerPointHandler.ViewAsStatsJson (cognitive 41) src/officecli/Handlers/Pptx/PowerPointHandler.View.cs:338 — PowerPointHandler.ViewAsStatsJson has cognitive complexity 41 (threshold 15). Of this number, 40 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 · ResidentServer.ProcessRequest (cognitive 41) · ×1
  • ResidentServer.ProcessRequest (cognitive 41) src/officecli/ResidentServer.cs:778 — ResidentServer.ProcessRequest has cognitive complexity 41 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ChartHelper.AddReferenceLine (cognitive 40) · ×1
  • ChartHelper.AddReferenceLine (cognitive 40) src/officecli/Core/Chart/ChartHelper.Advanced.cs:30 — ChartHelper.AddReferenceLine has cognitive complexity 40 (threshold 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 · ChartHelper.ParseLiteralSeriesData (cognitive 40) · ×1
  • ChartHelper.ParseLiteralSeriesData (cognitive 40) src/officecli/Core/Chart/ChartHelper.cs:264 — ChartHelper.ParseLiteralSeriesData has cognitive complexity 40 (threshold 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 · FormulaParser.RewriteOver (cognitive 40) · ×1
  • FormulaParser.RewriteOver (cognitive 40) src/officecli/Core/Formula/FormulaParser.cs:197 — FormulaParser.RewriteOver has cognitive complexity 40 (threshold 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 · FormulaParser.Tokenize (cognitive 40) · ×1
  • FormulaParser.Tokenize (cognitive 40) src/officecli/Core/Formula/FormulaParser.cs:985 — FormulaParser.Tokenize has cognitive complexity 40 (threshold 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 · PivotTableHelper.ApplyDateGrouping (cognitive 40) · ×1
  • PivotTableHelper.ApplyDateGrouping (cognitive 40) src/officecli/Core/PivotTableHelper.Cache.cs:56 — PivotTableHelper.ApplyDateGrouping has cognitive complexity 40 (threshold 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 · ExcelBatchEmitter.ClassifyCell (cognitive 40) · ×1
  • ExcelBatchEmitter.ClassifyCell (cognitive 40) src/officecli/Handlers/Excel/ExcelBatchEmitter.cs:717 — ExcelBatchEmitter.ClassifyCell has cognitive complexity 40 (threshold 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 · ExcelHandler.AddSparkline (cognitive 40) · ×1
  • ExcelHandler.AddSparkline (cognitive 40) src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:957 — ExcelHandler.AddSparkline has cognitive complexity 40 (threshold 15). 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 · ExcelHandler.Raw (cognitive 40) · ×1
  • ExcelHandler.Raw (cognitive 40) src/officecli/Handlers/ExcelHandler.cs:184 — ExcelHandler.Raw has cognitive complexity 40 (threshold 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 · PptxBatchEmitter.EmitShape (cognitive 40) · ×1
  • PptxBatchEmitter.EmitShape (cognitive 40) src/officecli/Handlers/Pptx/PptxBatchEmitter.Shape.cs:186 — PptxBatchEmitter.EmitShape has cognitive complexity 40 (threshold 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 · WordBatchEmitter.EmitStructuredHyperlink (cognitive 40) · ×1
  • WordBatchEmitter.EmitStructuredHyperlink (cognitive 40) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:4494 — WordBatchEmitter.EmitStructuredHyperlink has cognitive complexity 40 (threshold 15). Of this number, 38 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 · WordBatchEmitter.EmitSection (cognitive 40) · ×1
  • WordBatchEmitter.EmitSection (cognitive 40) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:3195 — WordBatchEmitter.EmitSection has cognitive complexity 40 (threshold 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 · WordHandler.SplitParagraphAtOffset (cognitive 40) · ×1
  • WordHandler.SplitParagraphAtOffset (cognitive 40) src/officecli/Handlers/Word/WordHandler.Helpers.FindReplace.cs:168 — WordHandler.SplitParagraphAtOffset has cognitive complexity 40 (threshold 15). Of this number, 39 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 · WordHandler.RenderChartHtml (cognitive 40) · ×1
  • WordHandler.RenderChartHtml (cognitive 40) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Charts.cs:17 — WordHandler.RenderChartHtml has cognitive complexity 40 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChartHelper.ConvertSeriesToType (cognitive 39) · ×1
  • ChartHelper.ConvertSeriesToType (cognitive 39) src/officecli/Core/Chart/ChartHelper.Advanced.cs:662 — ChartHelper.ConvertSeriesToType has cognitive complexity 39 (threshold 15). Of this number, 38 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ModernFunctionQualifier.FindNonLiteralArrayConstant (cognitive 39) · ×1
  • ModernFunctionQualifier.FindNonLiteralArrayConstant (cognitive 39) src/officecli/Core/Formula/ModernFunctionQualifier.cs:219 — ModernFunctionQualifier.FindNonLiteralArrayConstant has cognitive complexity 39 (threshold 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 · ExcelHandler.ViewAsHtml (cognitive 39) · ×1
  • ExcelHandler.ViewAsHtml (cognitive 39) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:154 — ExcelHandler.ViewAsHtml has cognitive complexity 39 (threshold 15). Of this number, 35 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 · PowerPointHandler.ChartToNode (cognitive 39) · ×1
  • PowerPointHandler.ChartToNode (cognitive 39) src/officecli/Handlers/Pptx/PowerPointHandler.Chart.cs:135 — PowerPointHandler.ChartToNode has cognitive complexity 39 (threshold 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 · PptxBatchEmitter.EmitModernComments (cognitive 39) · ×1
  • PptxBatchEmitter.EmitModernComments (cognitive 39) src/officecli/Handlers/Pptx/PptxBatchEmitter.Notes.cs:219 — PptxBatchEmitter.EmitModernComments has cognitive complexity 39 (threshold 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 · WordBatchEmitter.TryEmitEquationRun (cognitive 39) · ×1
  • WordBatchEmitter.TryEmitEquationRun (cognitive 39) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:2012 — WordBatchEmitter.TryEmitEquationRun has cognitive complexity 39 (threshold 15). Of this number, 38 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.EnsureBookmarkIds (cognitive 39) · ×1
  • WordHandler.EnsureBookmarkIds (cognitive 39) src/officecli/Handlers/Word/WordHandler.Helpers.Field.cs:711 — WordHandler.EnsureBookmarkIds has cognitive complexity 39 (threshold 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 · WordHandler.ComputeMathElementPath (cognitive 39) · ×1
  • WordHandler.ComputeMathElementPath (cognitive 39) src/officecli/Handlers/Word/WordHandler.Navigation.cs:1834 — WordHandler.ComputeMathElementPath has cognitive complexity 39 (threshold 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 · WordHandler.FillUnknownChildProps (cognitive 39) · ×1
  • WordHandler.FillUnknownChildProps (cognitive 39) src/officecli/Handlers/Word/WordHandler.Navigation.cs:7073 — WordHandler.FillUnknownChildProps has cognitive complexity 39 (threshold 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 · WordHandler.SetElementHyperlink (cognitive 39) · ×1
  • WordHandler.SetElementHyperlink (cognitive 39) src/officecli/Handlers/Word/WordHandler.Set.Element.cs:943 — WordHandler.SetElementHyperlink has cognitive complexity 39 (threshold 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 · SchemaHelpFlatRenderer.BuildPropertyRecords (cognitive 39) · ×1
  • SchemaHelpFlatRenderer.BuildPropertyRecords (cognitive 39) src/officecli/Help/SchemaHelpFlatRenderer.cs:177 — SchemaHelpFlatRenderer.BuildPropertyRecords has cognitive complexity 39 (threshold 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 · SchemaHelpRenderer.RenderUsageBlock (cognitive 39) · ×1
  • SchemaHelpRenderer.RenderUsageBlock (cognitive 39) src/officecli/Help/SchemaHelpRenderer.cs:233 — SchemaHelpRenderer.RenderUsageBlock has cognitive complexity 39 (threshold 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 · CommandBuilder.ApplyBatchItems (cognitive 38) · ×1
  • CommandBuilder.ApplyBatchItems (cognitive 38) src/officecli/CommandBuilder.Batch.cs:65 — CommandBuilder.ApplyBatchItems has cognitive complexity 38 (threshold 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 · ChartSvgRenderer.RenderOfPieChartSvg (cognitive 38) · ×1
  • ChartSvgRenderer.RenderOfPieChartSvg (cognitive 38) src/officecli/Core/Chart/ChartSvgRenderer.cs:1938 — ChartSvgRenderer.RenderOfPieChartSvg has cognitive complexity 38 (threshold 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 · MarkdownParser.Parse (cognitive 38) · ×1
  • MarkdownParser.Parse (cognitive 38) src/officecli/Core/Markdown/MarkdownParser.cs:86 — MarkdownParser.Parse has cognitive complexity 38 (threshold 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 · PivotTableHelper.ResolveDefinedName (cognitive 38) · ×1
  • PivotTableHelper.ResolveDefinedName (cognitive 38) src/officecli/Core/PivotTableHelper.Cache.cs:1261 — PivotTableHelper.ResolveDefinedName has cognitive complexity 38 (threshold 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 · ExcelBatchEmitter.EmitNamedRanges (cognitive 38) · ×1
  • ExcelBatchEmitter.EmitNamedRanges (cognitive 38) src/officecli/Handlers/Excel/ExcelBatchEmitter.cs:242 — ExcelBatchEmitter.EmitNamedRanges has cognitive complexity 38 (threshold 15). 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 · ExcelHandler.AddColorScaleBackgrounds (cognitive 38) · ×1
  • ExcelHandler.AddColorScaleBackgrounds (cognitive 38) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:1296 — ExcelHandler.AddColorScaleBackgrounds has cognitive complexity 38 (threshold 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 · ExcelHandler.FindDefinedNameReferences (cognitive 38) · ×1
  • ExcelHandler.FindDefinedNameReferences (cognitive 38) src/officecli/Handlers/Excel/ExcelHandler.Set.Tables.cs:134 — ExcelHandler.FindDefinedNameReferences has cognitive complexity 38 (threshold 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 · PowerPointHandler.ResolvePlaceholderShape (cognitive 38) · ×1
  • PowerPointHandler.ResolvePlaceholderShape (cognitive 38) src/officecli/Handlers/Pptx/PowerPointHandler.Resolve.cs:302 — PowerPointHandler.ResolvePlaceholderShape has cognitive complexity 38 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PptxBatchEmitter.EmitChartAxesIfDifferent (cognitive 38) · ×1
  • PptxBatchEmitter.EmitChartAxesIfDifferent (cognitive 38) src/officecli/Handlers/Pptx/PptxBatchEmitter.Charts.cs:445 — PptxBatchEmitter.EmitChartAxesIfDifferent has cognitive complexity 38 (threshold 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 · WordBatchEmitter.EmitHeadersFooters (cognitive 38) · ×1
  • WordBatchEmitter.EmitHeadersFooters (cognitive 38) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:1283 — WordBatchEmitter.EmitHeadersFooters has cognitive complexity 38 (threshold 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 · WordHandler.GetFooterTexts (cognitive 38) · ×1
  • WordHandler.GetFooterTexts (cognitive 38) src/officecli/Handlers/Word/WordHandler.Helpers.HeaderFooter.cs:117 — WordHandler.GetFooterTexts has cognitive complexity 38 (threshold 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 · FormulaEvaluator.EvalIndex (cognitive 37) · ×1
  • FormulaEvaluator.EvalIndex (cognitive 37) src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:1082 — FormulaEvaluator.EvalIndex has cognitive complexity 37 (threshold 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 · FormulaEvaluator.EvalXmatch (cognitive 37) · ×1
  • FormulaEvaluator.EvalXmatch (cognitive 37) src/officecli/Core/Formula/FormulaEvaluator.Helpers.cs:632 — FormulaEvaluator.EvalXmatch has cognitive complexity 37 (threshold 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 · ModernFunctionQualifier.IsDynamicArrayFormula (cognitive 37) · ×1
  • ModernFunctionQualifier.IsDynamicArrayFormula (cognitive 37) src/officecli/Core/Formula/ModernFunctionQualifier.cs:102 — ModernFunctionQualifier.IsDynamicArrayFormula has cognitive complexity 37 (threshold 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 · ExcelHandler.SerializeRichTextRuns (cognitive 37) · ×1
  • ExcelHandler.SerializeRichTextRuns (cognitive 37) src/officecli/Handlers/Excel/ExcelHandler.DumpSupport.cs:195 — ExcelHandler.SerializeRichTextRuns has cognitive complexity 37 (threshold 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 · ExcelHandler.SparklineGroupToNode (cognitive 37) · ×1
  • ExcelHandler.SparklineGroupToNode (cognitive 37) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Node.cs:19 — ExcelHandler.SparklineGroupToNode has cognitive complexity 37 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · PowerPointHandler.ReadCNvPrCreationId (cognitive 37) · ×1
  • PowerPointHandler.ReadCNvPrCreationId (cognitive 37) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.ShapeId.cs:235 — PowerPointHandler.ReadCNvPrCreationId has cognitive complexity 37 (threshold 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 · PowerPointHandler.Model3DToNode (cognitive 37) · ×1
  • PowerPointHandler.Model3DToNode (cognitive 37) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Zoom3D.cs:113 — PowerPointHandler.Model3DToNode has cognitive complexity 37 (threshold 15). Of this number, 32 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.SetModernCommentProperties (cognitive 37) · ×1
  • PowerPointHandler.SetModernCommentProperties (cognitive 37) src/officecli/Handlers/Pptx/PowerPointHandler.ModernComments.cs:409 — PowerPointHandler.SetModernCommentProperties has cognitive complexity 37 (threshold 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 · WordBatchEmitter.BuildFieldAddProps (cognitive 37) · ×1
  • WordBatchEmitter.BuildFieldAddProps (cognitive 37) src/officecli/Handlers/Word/WordBatchEmitter.Fields.cs:786 — WordBatchEmitter.BuildFieldAddProps has cognitive complexity 37 (threshold 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 · WordHandler.GetAllWordCharts (cognitive 37) · ×1
  • WordHandler.GetAllWordCharts (cognitive 37) src/officecli/Handlers/Word/WordHandler.Helpers.Chart.cs:63 — WordHandler.GetAllWordCharts has cognitive complexity 37 (threshold 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 · CommandBuilder.BuildQueryCommand (cognitive 36) · ×1
  • CommandBuilder.BuildQueryCommand (cognitive 36) src/officecli/CommandBuilder.GetQuery.cs:168 — CommandBuilder.BuildQueryCommand has cognitive complexity 36 (threshold 15). None of this is in the body itself: all 36 points belong to 3 function literals inside it that branch (lines 185, 221, 195). 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 · ChartHelper.ApplySecondaryAxis (cognitive 36) · ×1
  • ChartHelper.ApplySecondaryAxis (cognitive 36) src/officecli/Core/Chart/ChartHelper.Setter.cs:4184 — ChartHelper.ApplySecondaryAxis has cognitive complexity 36 (threshold 15). Of this number, 33 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, 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 · DrawingColorBuilder.ParseColorTransformSuffix (cognitive 36) · ×1
  • DrawingColorBuilder.ParseColorTransformSuffix (cognitive 36) src/officecli/Core/DrawingColorBuilder.cs:95 — DrawingColorBuilder.ParseColorTransformSuffix has cognitive complexity 36 (threshold 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 · FormulaEvaluator.TryLiftOverArrays (cognitive 36) · ×1
  • FormulaEvaluator.TryLiftOverArrays (cognitive 36) src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:1039 — FormulaEvaluator.TryLiftOverArrays has cognitive complexity 36 (threshold 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 · FormulaEvaluator.CompareValues (cognitive 36) · ×1
  • FormulaEvaluator.CompareValues (cognitive 36) src/officecli/Core/Formula/FormulaEvaluator.Helpers.cs:19 — FormulaEvaluator.CompareValues has cognitive complexity 36 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WatchServer.HandlePostSwitchAsync (cognitive 36) · ×1
  • WatchServer.HandlePostSwitchAsync (cognitive 36) src/officecli/Core/Watch/WatchServer.cs:2579 — WatchServer.HandlePostSwitchAsync has cognitive complexity 36 (threshold 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 · ExcelHandler.ValidateSqref (cognitive 36) · ×1
  • ExcelHandler.ValidateSqref (cognitive 36) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Validation.cs:36 — ExcelHandler.ValidateSqref has cognitive complexity 36 (threshold 15). Of this number, 26 points are the body's own statements and 10 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 · ExcelHandler.ParseCsv (cognitive 36) · ×1
  • ExcelHandler.ParseCsv (cognitive 36) src/officecli/Handlers/Excel/ExcelHandler.Import.cs:425 — ExcelHandler.ParseCsv has cognitive complexity 36 (threshold 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 · ExcelHandler.PopulateCfNodeFromDxf (cognitive 36) · ×1
  • ExcelHandler.PopulateCfNodeFromDxf (cognitive 36) src/officecli/Handlers/Excel/ExcelHandler.Query.cs:2034 — ExcelHandler.PopulateCfNodeFromDxf has cognitive complexity 36 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ExcelHandler.SetPictureByPath (cognitive 36) · ×1
  • ExcelHandler.SetPictureByPath (cognitive 36) src/officecli/Handlers/Excel/ExcelHandler.Set.Drawings.cs:312 — ExcelHandler.SetPictureByPath has cognitive complexity 36 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ExcelHandler.ViewAsAnnotated (cognitive 36) · ×1
  • ExcelHandler.ViewAsAnnotated (cognitive 36) src/officecli/Handlers/Excel/ExcelHandler.View.cs:122 — ExcelHandler.ViewAsAnnotated has cognitive complexity 36 (threshold 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 · PowerPointHandler.ZoomToNode (cognitive 36) · ×1
  • PowerPointHandler.ZoomToNode (cognitive 36) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Zoom3D.cs:207 — PowerPointHandler.ZoomToNode has cognitive complexity 36 (threshold 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 · PowerPointHandler.SetParagraphOnShapeCore (cognitive 36) · ×1
  • PowerPointHandler.SetParagraphOnShapeCore (cognitive 36) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:203 — PowerPointHandler.SetParagraphOnShapeCore has cognitive 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WordHandler.AddNum (cognitive 36) · ×1
  • WordHandler.AddNum (cognitive 36) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:2076 — WordHandler.AddNum has cognitive 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WordHandler.NormalizeNewlineChars (cognitive 36) · ×1
  • WordHandler.NormalizeNewlineChars (cognitive 36) src/officecli/Handlers/Word/WordHandler.Helpers.FindReplace.cs:78 — WordHandler.NormalizeNewlineChars has cognitive complexity 36 (threshold 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 · ExcelStyleManager.FontMatches (cognitive 35) · ×1
  • ExcelStyleManager.FontMatches (cognitive 35) src/officecli/Core/ExcelStyleManager.cs:1133 — ExcelStyleManager.FontMatches has cognitive complexity 35 (threshold 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 · FormulaEvaluator.ResolveCellResult (cognitive 35) · ×1
  • FormulaEvaluator.ResolveCellResult (cognitive 35) src/officecli/Core/Formula/FormulaEvaluator.cs:1248 — FormulaEvaluator.ResolveCellResult has cognitive complexity 35 (threshold 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 · FormulaRefShifter.WalkFormulaTokens (cognitive 35) · ×1
  • FormulaRefShifter.WalkFormulaTokens (cognitive 35) src/officecli/Core/FormulaRefShifter.cs:97 — FormulaRefShifter.WalkFormulaTokens has cognitive complexity 35 (threshold 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 · ExcelHandler.NormalizeExcelPath (cognitive 35) · ×1
  • ExcelHandler.NormalizeExcelPath (cognitive 35) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Sheet.cs:101 — ExcelHandler.NormalizeExcelPath has cognitive complexity 35 (threshold 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 · ExcelHandler.TryBuildRichTextHtml (cognitive 35) · ×1
  • ExcelHandler.TryBuildRichTextHtml (cognitive 35) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:2985 — ExcelHandler.TryBuildRichTextHtml has cognitive complexity 35 (threshold 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 · ExcelHandler.RawSetCore (cognitive 35) · ×1
  • ExcelHandler.RawSetCore (cognitive 35) src/officecli/Handlers/ExcelHandler.cs:380 — ExcelHandler.RawSetCore has cognitive complexity 35 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.BuildClickGroup (cognitive 35) · ×1
  • PowerPointHandler.BuildClickGroup (cognitive 35) src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:1245 — PowerPointHandler.BuildClickGroup has cognitive complexity 35 (threshold 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 · WordHandler.GetCrossParagraphFieldSpanRanges (cognitive 35) · ×1
  • WordHandler.GetCrossParagraphFieldSpanRanges (cognitive 35) src/officecli/Handlers/Word/WordHandler.Helpers.Field.cs:32 — WordHandler.GetCrossParagraphFieldSpanRanges has cognitive complexity 35 (threshold 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 · WordHandler.GetHeaderNode (cognitive 35) · ×1
  • WordHandler.GetHeaderNode (cognitive 35) src/officecli/Handlers/Word/WordHandler.Query.cs:1506 — WordHandler.GetHeaderNode has cognitive complexity 35 (threshold 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. This shape REPEATS in the file: one other method here (WordHandler.GetFooterNode) 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 · WordHandler.GetFooterNode (cognitive 35) · ×1
  • WordHandler.GetFooterNode (cognitive 35) src/officecli/Handlers/Word/WordHandler.Query.cs:1594 — WordHandler.GetFooterNode has cognitive complexity 35 (threshold 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. This shape REPEATS in the file: one other method here (WordHandler.GetHeaderNode) 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 · CommandBuilder.BuildRootCommand (cognitive 34) · ×1
  • CommandBuilder.BuildRootCommand (cognitive 34) src/officecli/CommandBuilder.cs:15 — CommandBuilder.BuildRootCommand has cognitive complexity 34 (threshold 15). Most of this is not in the body itself: 1 of the 34 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 88, 33, 136). 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 · ChartHelper.ExpandCombinedLayoutKeys (cognitive 34) · ×1
  • ChartHelper.ExpandCombinedLayoutKeys (cognitive 34) src/officecli/Core/Chart/ChartHelper.Setter.cs:4428 — ChartHelper.ExpandCombinedLayoutKeys has cognitive complexity 34 (threshold 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 · ExcelStyleManager.GetOrCreateGradientFill (cognitive 34) · ×1
  • ExcelStyleManager.GetOrCreateGradientFill (cognitive 34) src/officecli/Core/ExcelStyleManager.cs:1411 — ExcelStyleManager.GetOrCreateGradientFill has cognitive complexity 34 (threshold 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 · FormulaEvaluator.TryParseComplex (cognitive 34) · ×1
  • FormulaEvaluator.TryParseComplex (cognitive 34) src/officecli/Core/Formula/FormulaEvaluator.Complex.cs:22 — FormulaEvaluator.TryParseComplex has cognitive complexity 34 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · FormulaEvaluator.ParseFunction (cognitive 34) · ×1
  • FormulaEvaluator.ParseFunction (cognitive 34) src/officecli/Core/Formula/FormulaEvaluator.cs:1027 — FormulaEvaluator.ParseFunction has cognitive complexity 34 (threshold 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 · FormulaEvaluator.EvalTrend (cognitive 34) · ×1
  • FormulaEvaluator.EvalTrend (cognitive 34) src/officecli/Core/Formula/FormulaEvaluator.Regression.cs:213 — FormulaEvaluator.EvalTrend has cognitive complexity 34 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · FormulaEvaluator.EvalStack (cognitive 34) · ×1
  • FormulaEvaluator.EvalStack (cognitive 34) src/officecli/Core/Formula/FormulaEvaluator.Spill.cs:331 — FormulaEvaluator.EvalStack has cognitive complexity 34 (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.
D2 · Cognitive Complexity · PivotTableHelper.ResolveTableRef (cognitive 34) · ×1
  • PivotTableHelper.ResolveTableRef (cognitive 34) src/officecli/Core/PivotTableHelper.Cache.cs:1189 — PivotTableHelper.ResolveTableRef has cognitive complexity 34 (threshold 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 · PivotTableHelper.ParseFieldList (cognitive 34) · ×1
  • PivotTableHelper.ParseFieldList (cognitive 34) src/officecli/Core/PivotTableHelper.Parse.cs:68 — PivotTableHelper.ParseFieldList has cognitive complexity 34 (threshold 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 · ExcelHandler.SerializeCommentRuns (cognitive 34) · ×1
  • ExcelHandler.SerializeCommentRuns (cognitive 34) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Node.cs:949 — ExcelHandler.SerializeCommentRuns has cognitive complexity 34 (threshold 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 · ExcelHandler.SyncSheetDimension (cognitive 34) · ×1
  • ExcelHandler.SyncSheetDimension (cognitive 34) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Sheet.cs:245 — ExcelHandler.SyncSheetDimension has cognitive complexity 34 (threshold 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 · ExcelHandler.SetCellRunByPath (cognitive 34) · ×1
  • ExcelHandler.SetCellRunByPath (cognitive 34) src/officecli/Handlers/Excel/ExcelHandler.Set.Charts.cs:108 — ExcelHandler.SetCellRunByPath has cognitive complexity 34 (threshold 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 · ExcelHandler.ApplyCommentVmlMutations (cognitive 34) · ×1
  • ExcelHandler.ApplyCommentVmlMutations (cognitive 34) src/officecli/Handlers/Excel/ExcelHandler.SheetShift.cs:615 — ExcelHandler.ApplyCommentVmlMutations has cognitive complexity 34 (threshold 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 · PowerPointHandler.GetExternalMediaPicsOnSlide (cognitive 34) · ×1
  • PowerPointHandler.GetExternalMediaPicsOnSlide (cognitive 34) REDACTED:3806 — PowerPointHandler.GetExternalMediaPicsOnSlide has cognitive complexity 34 (threshold 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 · PowerPointHandler.ReadSlideTransition (cognitive 34) · ×1
  • PowerPointHandler.ReadSlideTransition (cognitive 34) src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2639 — PowerPointHandler.ReadSlideTransition has cognitive complexity 34 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.CollectOleNodesForSlide (cognitive 34) · ×1
  • PowerPointHandler.CollectOleNodesForSlide (cognitive 34) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Ole.cs:73 — PowerPointHandler.CollectOleNodesForSlide has cognitive complexity 34 (threshold 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 · PowerPointHandler.RenderGroup (cognitive 34) · ×1
  • PowerPointHandler.RenderGroup (cognitive 34) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2275 — PowerPointHandler.RenderGroup has cognitive complexity 34 (threshold 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 · PowerPointHandler.CloneSlide (cognitive 34) · ×1
  • PowerPointHandler.CloneSlide (cognitive 34) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1653 — PowerPointHandler.CloneSlide has cognitive complexity 34 (threshold 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 · PowerPointHandler.FillUnknownRunProps (cognitive 34) · ×1
  • PowerPointHandler.FillUnknownRunProps (cognitive 34) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2552 — PowerPointHandler.FillUnknownRunProps has cognitive complexity 34 (threshold 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 · WordBatchEmitter.ShouldCollapseSingleRun (cognitive 34) · ×1
  • WordBatchEmitter.ShouldCollapseSingleRun (cognitive 34) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:1224 — WordBatchEmitter.ShouldCollapseSingleRun has cognitive complexity 34 (threshold 15). Of this number, 32 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 · WordHandler.ProcessWordRange (cognitive 34) · ×1
  • WordHandler.ProcessWordRange (cognitive 34) src/officecli/Handlers/Word/WordHandler.Helpers.FindReplace.cs:321 — WordHandler.ProcessWordRange has cognitive complexity 34 (threshold 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 · WordHandler.HyperlinkToNode (cognitive 34) · ×1
  • WordHandler.HyperlinkToNode (cognitive 34) src/officecli/Handlers/Word/WordHandler.Navigation.cs:3110 — WordHandler.HyperlinkToNode has cognitive complexity 34 (threshold 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 · SchemaHelpRenderer.RenderProperty (cognitive 34) · ×1
  • SchemaHelpRenderer.RenderProperty (cognitive 34) src/officecli/Help/SchemaHelpRenderer.cs:319 — SchemaHelpRenderer.RenderProperty has cognitive complexity 34 (threshold 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 · CommandBuilder.BuildCreateCommand (cognitive 33) · ×1
  • CommandBuilder.BuildCreateCommand (cognitive 33) src/officecli/CommandBuilder.Import.cs:268 — CommandBuilder.BuildCreateCommand has cognitive complexity 33 (threshold 15). None of this is in the body itself: all 33 points belong to one function literal inside it that branches (line 283). 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 · ChartSvgRenderer.FitPolynomial (cognitive 33) · ×1
  • ChartSvgRenderer.FitPolynomial (cognitive 33) src/officecli/Core/Chart/ChartSvgRenderer.cs:5654 — ChartSvgRenderer.FitPolynomial has cognitive complexity 33 (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.
D2 · Cognitive Complexity · RawXmlHelper.DetectOutOfGridSheetRefs (cognitive 33) · ×1
  • RawXmlHelper.DetectOutOfGridSheetRefs (cognitive 33) src/officecli/Core/RawXmlHelper.cs:1001 — RawXmlHelper.DetectOutOfGridSheetRefs has cognitive complexity 33 (threshold 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 · PowerPointHandler.ApplyMotionPathAnimation (cognitive 33) · ×1
  • PowerPointHandler.ApplyMotionPathAnimation (cognitive 33) src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:1702 — PowerPointHandler.ApplyMotionPathAnimation has cognitive complexity 33 (threshold 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 · PowerPointHandler.SetChartByPath (cognitive 33) · ×1
  • PowerPointHandler.SetChartByPath (cognitive 33) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Chart.cs:29 — PowerPointHandler.SetChartByPath has cognitive complexity 33 (threshold 15). Of this number, 31 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 · PowerPointHandler.SetGroupInnerFrameByPath (cognitive 33) · ×1
  • PowerPointHandler.SetGroupInnerFrameByPath (cognitive 33) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1572 — PowerPointHandler.SetGroupInnerFrameByPath has cognitive complexity 33 (threshold 15). 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 · PowerPointHandler.RenderAnnotatedChildren (cognitive 33) · ×1
  • PowerPointHandler.RenderAnnotatedChildren (cognitive 33) src/officecli/Handlers/Pptx/PowerPointHandler.View.cs:100 — PowerPointHandler.RenderAnnotatedChildren has cognitive complexity 33 (threshold 15). 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, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordBatchEmitter.EmitHeaderFooterPart (cognitive 33) · ×1
  • WordBatchEmitter.EmitHeaderFooterPart (cognitive 33) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:1379 — WordBatchEmitter.EmitHeaderFooterPart has cognitive complexity 33 (threshold 15). 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 · WordHandler.GetSdtContentCrossParagraphFieldSpanRanges (cognitive 33) · ×1
  • WordHandler.GetSdtContentCrossParagraphFieldSpanRanges (cognitive 33) src/officecli/Handlers/Word/WordHandler.Helpers.Field.cs:113 — WordHandler.GetSdtContentCrossParagraphFieldSpanRanges has cognitive complexity 33 (threshold 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 · WordHandler.RecoverWrapperRunTexts (cognitive 33) · ×1
  • WordHandler.RecoverWrapperRunTexts (cognitive 33) src/officecli/Handlers/Word/WordHandler.Navigation.cs:1111 — WordHandler.RecoverWrapperRunTexts has cognitive complexity 33 (threshold 15). 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 · SchemaHelpFlatRenderer.AppendPropertyRows (cognitive 33) · ×1
  • SchemaHelpFlatRenderer.AppendPropertyRows (cognitive 33) src/officecli/Help/SchemaHelpFlatRenderer.cs:274 — SchemaHelpFlatRenderer.AppendPropertyRows has cognitive complexity 33 (threshold 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 · AttributeFilter.DiagnoseEmptyResult (cognitive 32) · ×1
  • AttributeFilter.DiagnoseEmptyResult (cognitive 32) src/officecli/Core/AttributeFilter.cs:320 — AttributeFilter.DiagnoseEmptyResult has cognitive complexity 32 (threshold 15). 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 · ChartHelper.RebuildComboChart (cognitive 32) · ×1
  • ChartHelper.RebuildComboChart (cognitive 32) src/officecli/Core/Chart/ChartHelper.Advanced.cs:500 — ChartHelper.RebuildComboChart has cognitive complexity 32 (threshold 15). 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 · ChartHelper.ParseSeriesDataExtended (cognitive 32) · ×1
  • ChartHelper.ParseSeriesDataExtended (cognitive 32) src/officecli/Core/Chart/ChartHelper.cs:374 — ChartHelper.ParseSeriesDataExtended has cognitive complexity 32 (threshold 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 · ChartHelper.UpdateSeriesData (cognitive 32) · ×1
  • ChartHelper.UpdateSeriesData (cognitive 32) src/officecli/Core/Chart/ChartHelper.Reader.cs:2555 — ChartHelper.UpdateSeriesData has cognitive complexity 32 (threshold 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 · ExcelHandler.MaybeExpandTablesForCell (cognitive 32) · ×1
  • ExcelHandler.MaybeExpandTablesForCell (cognitive 32) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Cell.cs:632 — ExcelHandler.MaybeExpandTablesForCell has cognitive complexity 32 (threshold 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 · PowerPointHandler.ResolveFillColor (cognitive 32) · ×1
  • PowerPointHandler.ResolveFillColor (cognitive 32) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2760 — PowerPointHandler.ResolveFillColor has cognitive complexity 32 (threshold 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 · PowerPointHandler.CopyPartsAndRelationships (cognitive 32) · ×1
  • PowerPointHandler.CopyPartsAndRelationships (cognitive 32) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1819 — PowerPointHandler.CopyPartsAndRelationships has cognitive complexity 32 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.BuildSvgGradient (cognitive 32) · ×1
  • PowerPointHandler.BuildSvgGradient (cognitive 32) src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:1772 — PowerPointHandler.BuildSvgGradient has cognitive complexity 32 (threshold 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 · PptxBatchEmitter.EmitNotes (cognitive 32) · ×1
  • PptxBatchEmitter.EmitNotes (cognitive 32) src/officecli/Handlers/Pptx/PptxBatchEmitter.Notes.cs:25 — PptxBatchEmitter.EmitNotes has cognitive complexity 32 (threshold 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 · WordBatchEmitter.ComputeParagraphChildDocOrder (cognitive 32) · ×1
  • WordBatchEmitter.ComputeParagraphChildDocOrder (cognitive 32) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:530 — WordBatchEmitter.ComputeParagraphChildDocOrder has cognitive complexity 32 (threshold 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 · WordBatchEmitter.EmitPlainOrHyperlinkRun (cognitive 32) · ×1
  • WordBatchEmitter.EmitPlainOrHyperlinkRun (cognitive 32) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:4334 — WordBatchEmitter.EmitPlainOrHyperlinkRun has cognitive complexity 32 (threshold 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 · WordBatchEmitter.EmitOneNoteSpecialNotesFixup (cognitive 32) · ×1
  • WordBatchEmitter.EmitOneNoteSpecialNotesFixup (cognitive 32) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:372 — WordBatchEmitter.EmitOneNoteSpecialNotesFixup has cognitive complexity 32 (threshold 15). Of this number, 29 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 · WordHandler.MoveWithTrackChange (cognitive 32) · ×1
  • WordHandler.MoveWithTrackChange (cognitive 32) src/officecli/Handlers/Word/WordHandler.Mutations.cs:1473 — WordHandler.MoveWithTrackChange has cognitive complexity 32 (threshold 15). 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: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. 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 · WordHandler.ParsePath (cognitive 32) · ×1
  • WordHandler.ParsePath (cognitive 32) src/officecli/Handlers/Word/WordHandler.Navigation.cs:727 — WordHandler.ParsePath has cognitive complexity 32 (threshold 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 · AttributeFilter.MatchOne (cognitive 31) · ×1
  • AttributeFilter.MatchOne (cognitive 31) src/officecli/Core/AttributeFilter.cs:510 — AttributeFilter.MatchOne has cognitive complexity 31 (threshold 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 · ChartHelper.BuildLabelTextProperties (cognitive 31) · ×1
  • ChartHelper.BuildLabelTextProperties (cognitive 31) src/officecli/Core/Chart/ChartHelper.Setter.cs:3659 — ChartHelper.BuildLabelTextProperties has cognitive complexity 31 (threshold 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 · ChartHelper.HandleDataLabelDottedProperty (cognitive 31) · ×1
  • ChartHelper.HandleDataLabelDottedProperty (cognitive 31) src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:1193 — ChartHelper.HandleDataLabelDottedProperty has cognitive complexity 31 (threshold 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 · MermaidParser.Parse (cognitive 31) · ×1
  • MermaidParser.Parse (cognitive 31) src/officecli/Core/Diagram/MermaidParser.cs:63 — MermaidParser.Parse has cognitive complexity 31 (threshold 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 · FormulaEvaluator.EvalMinverse (cognitive 31) · ×1
  • FormulaEvaluator.EvalMinverse (cognitive 31) src/officecli/Core/Formula/FormulaEvaluator.Helpers.cs:519 — FormulaEvaluator.EvalMinverse has cognitive complexity 31 (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.
D2 · Cognitive Complexity · MarkdownParser.ParseList (cognitive 31) · ×1
  • MarkdownParser.ParseList (cognitive 31) src/officecli/Core/Markdown/MarkdownParser.cs:231 — MarkdownParser.ParseList has cognitive complexity 31 (threshold 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 · PivotTableHelper.HasAnyValueInOuterRowOuterCol (cognitive 31) · ×1
  • PivotTableHelper.HasAnyValueInOuterRowOuterCol (cognitive 31) src/officecli/Core/PivotTableHelper.Render.cs:2491 — PivotTableHelper.HasAnyValueInOuterRowOuterCol has cognitive complexity 31 (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.
D2 · Cognitive Complexity · SsrfGuard.IsPublicAddress (cognitive 31) · ×1
  • SsrfGuard.IsPublicAddress (cognitive 31) src/officecli/Core/SsrfGuard.cs:110 — SsrfGuard.IsPublicAddress has cognitive complexity 31 (threshold 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 · PowerPointHandler.AddAnimation (cognitive 31) · ×1
  • PowerPointHandler.AddAnimation (cognitive 31) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1675 — PowerPointHandler.AddAnimation has cognitive complexity 31 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · PowerPointHandler.RenderNestedGroup (cognitive 31) · ×1
  • PowerPointHandler.RenderNestedGroup (cognitive 31) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2489 — PowerPointHandler.RenderNestedGroup has cognitive complexity 31 (threshold 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 · PowerPointHandler.GetThemeNode (cognitive 31) · ×1
  • PowerPointHandler.GetThemeNode (cognitive 31) src/officecli/Handlers/Pptx/PowerPointHandler.Theme.cs:143 — PowerPointHandler.GetThemeNode has cognitive complexity 31 (threshold 15). Of this number, 28 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · WordHandler.AddChart (cognitive 31) · ×1
  • WordHandler.AddChart (cognitive 31) src/officecli/Handlers/Word/WordHandler.Add.Media.cs:16 — WordHandler.AddChart has cognitive complexity 31 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · WordHandler.ApplyCropToBlipFill (cognitive 31) · ×1
  • WordHandler.ApplyCropToBlipFill (cognitive 31) src/officecli/Handlers/Word/WordHandler.ImageHelpers.cs:622 — WordHandler.ApplyCropToBlipFill has cognitive complexity 31 (threshold 15). Of this number, 30 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 · WordHandler.ApplyCommentFormatKeys (cognitive 31) · ×1
  • WordHandler.ApplyCommentFormatKeys (cognitive 31) src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs:674 — WordHandler.ApplyCommentFormatKeys has cognitive complexity 31 (threshold 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 · WordHandler.GetTableStructuralBookmarks (cognitive 31) · ×1
  • WordHandler.GetTableStructuralBookmarks (cognitive 31) src/officecli/Handlers/WordHandler.cs:731 — WordHandler.GetTableStructuralBookmarks has cognitive complexity 31 (threshold 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 · CommandBuilder.TryResident (cognitive 30) · ×1
  • CommandBuilder.TryResident (cognitive 30) src/officecli/CommandBuilder.cs:591 — CommandBuilder.TryResident has cognitive complexity 30 (threshold 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 · ChartHelper.ApplyColorRule (cognitive 30) · ×1
  • ChartHelper.ApplyColorRule (cognitive 30) src/officecli/Core/Chart/ChartHelper.Advanced.cs:295 — ChartHelper.ApplyColorRule has cognitive complexity 30 (threshold 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 · WatchServer.ComputeWordPatches (cognitive 30) · ×1
  • WatchServer.ComputeWordPatches (cognitive 30) src/officecli/Core/Watch/WatchServer.cs:1445 — WatchServer.ComputeWordPatches has cognitive complexity 30 (threshold 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 · WordHtmlRefresh.ApplyPageNumbers (cognitive 30) · ×1
  • WordHtmlRefresh.ApplyPageNumbers (cognitive 30) src/officecli/Core/WordHtmlRefresh.cs:100 — WordHtmlRefresh.ApplyPageNumbers has cognitive complexity 30 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ExcelHandler.ResolveChartRangeCells (cognitive 30) · ×1
  • ExcelHandler.ResolveChartRangeCells (cognitive 30) src/officecli/Handlers/Excel/ExcelHandler.ChartCache.cs:95 — ExcelHandler.ResolveChartRangeCells has cognitive complexity 30 (threshold 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 · ExcelHandler.GetCellDisplayValue (cognitive 30) · ×1
  • ExcelHandler.GetCellDisplayValue (cognitive 30) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Cell.cs:56 — ExcelHandler.GetCellDisplayValue has cognitive complexity 30 (threshold 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 · ExcelHandler.BuildCommentTextFromRuns (cognitive 30) · ×1
  • ExcelHandler.BuildCommentTextFromRuns (cognitive 30) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Node.cs:985 — ExcelHandler.BuildCommentTextFromRuns has cognitive complexity 30 (threshold 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 · ExcelHandler.TryResolveRowColumnCell (cognitive 30) · ×1
  • ExcelHandler.TryResolveRowColumnCell (cognitive 30) src/officecli/Handlers/Excel/ExcelHandler.Query.RowWhere.cs:390 — ExcelHandler.TryResolveRowColumnCell has cognitive complexity 30 (threshold 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 · ExcelHandler.SetColumn (cognitive 30) · ×1
  • ExcelHandler.SetColumn (cognitive 30) src/officecli/Handlers/Excel/ExcelHandler.Set.RowsCols.cs:21 — ExcelHandler.SetColumn has cognitive 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExcelHandler.AddSlicer (cognitive 30) · ×1
  • ExcelHandler.AddSlicer (cognitive 30) src/officecli/Handlers/Excel/ExcelHandler.Slicer.cs:67 — ExcelHandler.AddSlicer has cognitive complexity 30 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · PowerPointHandler.GetModel3dOnSlide (cognitive 30) · ×1
  • PowerPointHandler.GetModel3dOnSlide (cognitive 30) REDACTED:3966 — PowerPointHandler.GetModel3dOnSlide has cognitive complexity 30 (threshold 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 · PowerPointHandler.ProcessPptRange (cognitive 30) · ×1
  • PowerPointHandler.ProcessPptRange (cognitive 30) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.FindReplace.cs:284 — PowerPointHandler.ProcessPptRange has cognitive complexity 30 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.ParseShapeSelector (cognitive 30) · ×1
  • PowerPointHandler.ParseShapeSelector (cognitive 30) src/officecli/Handlers/Pptx/PowerPointHandler.Selector.cs:98 — PowerPointHandler.ParseShapeSelector has cognitive complexity 30 (threshold 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 · WordHandler.ApplySdtExtraProps (cognitive 30) · ×1
  • WordHandler.ApplySdtExtraProps (cognitive 30) src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:2583 — WordHandler.ApplySdtExtraProps has cognitive complexity 30 (threshold 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 · WordHandler.ReadDocDefaults (cognitive 30) · ×1
  • WordHandler.ReadDocDefaults (cognitive 30) REDACTED:1612 — WordHandler.ReadDocDefaults has cognitive 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: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. 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 · WordHandler.GetConditionalTypes (cognitive 30) · ×1
  • WordHandler.GetConditionalTypes (cognitive 30) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Tables.cs:920 — WordHandler.GetConditionalTypes has cognitive complexity 30 (threshold 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 · WordHandler.FootnoteToNode (cognitive 30) · ×1
  • WordHandler.FootnoteToNode (cognitive 30) src/officecli/Handlers/Word/WordHandler.Navigation.cs:2011 — WordHandler.FootnoteToNode has cognitive complexity 30 (threshold 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. This shape REPEATS in the file: one other method here (WordHandler.EndnoteToNode) 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 · WordHandler.EndnoteToNode (cognitive 30) · ×1
  • WordHandler.EndnoteToNode (cognitive 30) src/officecli/Handlers/Word/WordHandler.Navigation.cs:2105 — WordHandler.EndnoteToNode has cognitive complexity 30 (threshold 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. This shape REPEATS in the file: one other method here (WordHandler.FootnoteToNode) 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 · WordHandler.SetWatermarkPath (cognitive 30) · ×1
  • WordHandler.SetWatermarkPath (cognitive 30) src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs:19 — WordHandler.SetWatermarkPath has cognitive complexity 30 (threshold 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 · WordHandler.ApplyParagraphMarkRevisionNamespaces (cognitive 30) · ×1
  • WordHandler.ApplyParagraphMarkRevisionNamespaces (cognitive 30) src/officecli/Handlers/Word/WordHandler.Set.Element.cs:1195 — WordHandler.ApplyParagraphMarkRevisionNamespaces has cognitive complexity 30 (threshold 15). Of this number, 28 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WordHandler.AdvanceOrderedCounter (cognitive 30) · ×1
  • WordHandler.AdvanceOrderedCounter (cognitive 30) src/officecli/Handlers/Word/WordHandler.StyleList.cs:1074 — WordHandler.AdvanceOrderedCounter has cognitive complexity 30 (threshold 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 · ResidentServer.ExecuteDump (cognitive 30) · ×1
  • ResidentServer.ExecuteDump (cognitive 30) src/officecli/ResidentServer.cs:2009 — ResidentServer.ExecuteDump has cognitive complexity 30 (threshold 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 · watch-overlay.applySelectionToDom (cognitive 30) · ×1
  • watch-overlay.applySelectionToDom (cognitive 30) src/officecli/Resources/watch-overlay.js:97 — watch-overlay.applySelectionToDom has cognitive complexity 30 (threshold 15). Drivers by points: error handling 5 (12 pts), if/else 7 (9 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 12). Of this number, 17 points are the body's own statements and 13 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 · ChartSvgRenderer.ExtractColors (cognitive 29) · ×1
  • ChartSvgRenderer.ExtractColors (cognitive 29) src/officecli/Core/Chart/ChartSvgRenderer.cs:4179 — ChartSvgRenderer.ExtractColors has cognitive complexity 29 (threshold 15). Of this number, 26 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 · EmuConverter.ParseEmu (cognitive 29) · ×1
  • EmuConverter.ParseEmu (cognitive 29) src/officecli/Core/EmuConverter.cs:50 — EmuConverter.ParseEmu has cognitive complexity 29 (threshold 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 · ExcelStyleManager.GetOrCreateBorder (cognitive 29) · ×1
  • ExcelStyleManager.GetOrCreateBorder (cognitive 29) src/officecli/Core/ExcelStyleManager.cs:1499 — ExcelStyleManager.GetOrCreateBorder has cognitive complexity 29 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · FormulaEvaluator.Invert (cognitive 29) · ×1
  • FormulaEvaluator.Invert (cognitive 29) src/officecli/Core/Formula/FormulaEvaluator.Regression.cs:48 — FormulaEvaluator.Invert has cognitive complexity 29 (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.
D2 · Cognitive Complexity · Installer.InstallBinary (cognitive 29) · ×1
  • Installer.InstallBinary (cognitive 29) src/officecli/Core/Installer.cs:115 — Installer.InstallBinary has cognitive complexity 29 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · PivotTableHelper.ApplyTopNFilter (cognitive 29) · ×1
  • PivotTableHelper.ApplyTopNFilter (cognitive 29) src/officecli/Core/PivotTableHelper.cs:720 — PivotTableHelper.ApplyTopNFilter has cognitive complexity 29 (threshold 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 · WatchServer.HandleWatchMessage (cognitive 29) · ×1
  • WatchServer.HandleWatchMessage (cognitive 29) src/officecli/Core/Watch/WatchServer.cs:666 — WatchServer.HandleWatchMessage has cognitive complexity 29 (threshold 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 · ExcelHandler.AddCfExtended (cognitive 29) · ×1
  • ExcelHandler.AddCfExtended (cognitive 29) src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:631 — ExcelHandler.AddCfExtended has cognitive complexity 29 (threshold 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 · ExcelHandler.BackfillSeriesRangeValues (cognitive 29) · ×1
  • ExcelHandler.BackfillSeriesRangeValues (cognitive 29) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Chart.cs:701 — ExcelHandler.BackfillSeriesRangeValues has cognitive complexity 29 (threshold 15). Of this number, 27 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 · ExcelHandler.TrySetAnchorPosition (cognitive 29) · ×1
  • ExcelHandler.TrySetAnchorPosition (cognitive 29) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:922 — ExcelHandler.TrySetAnchorPosition has cognitive complexity 29 (threshold 15). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ExcelHandler.CollectOleNodesForSheet (cognitive 29) · ×1
  • ExcelHandler.CollectOleNodesForSheet (cognitive 29) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Ole.cs:173 — ExcelHandler.CollectOleNodesForSheet has cognitive complexity 29 (threshold 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 · ExcelHandler.SyncTableColumnsAfterColDelete (cognitive 29) · ×1
  • ExcelHandler.SyncTableColumnsAfterColDelete (cognitive 29) src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:1462 — ExcelHandler.SyncTableColumnsAfterColDelete has cognitive complexity 29 (threshold 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 · ExcelHandler.ViewAsStats (cognitive 29) · ×1
  • ExcelHandler.ViewAsStats (cognitive 29) src/officecli/Handlers/Excel/ExcelHandler.View.cs:263 — ExcelHandler.ViewAsStats has cognitive complexity 29 (threshold 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 · PowerPointHandler.GetPictureBlipCompanionParts (cognitive 29) · ×1
  • PowerPointHandler.GetPictureBlipCompanionParts (cognitive 29) REDACTED:4509 — PowerPointHandler.GetPictureBlipCompanionParts has cognitive complexity 29 (threshold 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 · PowerPointHandler.ViewAsHtml (cognitive 29) · ×1
  • PowerPointHandler.ViewAsHtml (cognitive 29) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.cs:72 — PowerPointHandler.ViewAsHtml has cognitive complexity 29 (threshold 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 · PowerPointHandler.SetFontScheme (cognitive 29) · ×1
  • PowerPointHandler.SetFontScheme (cognitive 29) src/officecli/Handlers/Pptx/PowerPointHandler.Theme.cs:278 — PowerPointHandler.SetFontScheme has cognitive complexity 29 (threshold 15). 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: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. 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 · PowerPointHandler.ViewAsText (cognitive 29) · ×1
  • PowerPointHandler.ViewAsText (cognitive 29) src/officecli/Handlers/Pptx/PowerPointHandler.View.cs:19 — PowerPointHandler.ViewAsText has cognitive complexity 29 (threshold 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 · PptxBatchEmitter.EmitPptx (cognitive 29) · ×1
  • PptxBatchEmitter.EmitPptx (cognitive 29) src/officecli/Handlers/Pptx/PptxBatchEmitter.cs:378 — PptxBatchEmitter.EmitPptx has cognitive complexity 29 (threshold 15). Of this number, 28 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WordHandler.BuildGradientXml (cognitive 29) · ×1
  • WordHandler.BuildGradientXml (cognitive 29) src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:3481 — WordHandler.BuildGradientXml has cognitive complexity 29 (threshold 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 · WordHandler.FormFieldToNode (cognitive 29) · ×1
  • WordHandler.FormFieldToNode (cognitive 29) src/officecli/Handlers/Word/WordHandler.FormFields.cs:34 — WordHandler.FormFieldToNode has cognitive complexity 29 (threshold 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 · WordHandler.ResolveBodyMetricsForMarker (cognitive 29) · ×1
  • WordHandler.ResolveBodyMetricsForMarker (cognitive 29) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Markers.cs:260 — WordHandler.ResolveBodyMetricsForMarker has cognitive complexity 29 (threshold 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 · WordHandler.EmitEffectiveRunProperties (cognitive 29) · ×1
  • WordHandler.EmitEffectiveRunProperties (cognitive 29) src/officecli/Handlers/Word/WordHandler.StyleList.cs:417 — WordHandler.EmitEffectiveRunProperties has cognitive complexity 29 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · WordHandler.BuildFormFieldRunMap (cognitive 29) · ×1
  • WordHandler.BuildFormFieldRunMap (cognitive 29) src/officecli/Handlers/Word/WordHandler.View.cs:698 — WordHandler.BuildFormFieldRunMap has cognitive complexity 29 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · SchemaHelpLoader.ResolveElementAlias (cognitive 29) · ×1
  • SchemaHelpLoader.ResolveElementAlias (cognitive 29) src/officecli/Help/SchemaHelpLoader.cs:203 — SchemaHelpLoader.ResolveElementAlias has cognitive complexity 29 (threshold 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 · ResidentServer.ExecuteBatch (cognitive 29) · ×1
  • ResidentServer.ExecuteBatch (cognitive 29) src/officecli/ResidentServer.cs:1232 — ResidentServer.ExecuteBatch has cognitive complexity 29 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · watch-overlay.document.addEventListener("mouseup") (cognitive 29) · ×1
  • watch-overlay.document.addEventListener("mouseup") (cognitive 29) src/officecli/Resources/watch-overlay.js:912 — watch-overlay.document.addEventListener("mouseup") has cognitive complexity 29 (threshold 15). Drivers by points: if/else 17 (24 pts), boolean chains 5 (nesting depth added 7). Of this number, 20 points are the body's own statements and 9 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 · (anonymous) (cognitive 29) · ×1
  • (anonymous) (cognitive 29) src/officecli/Resources/watch-overlay.js:912 — (anonymous) has cognitive complexity 29 (threshold 15). Drivers by points: if/else 17 (24 pts), boolean chains 5 (nesting depth added 7). Of this number, 20 points are the body's own statements and 9 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 · BlankDocCreator.CreateWord (cognitive 28) · ×1
  • BlankDocCreator.CreateWord (cognitive 28) src/officecli/BlankDocCreator.cs:135 — BlankDocCreator.CreateWord has cognitive complexity 28 (threshold 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 · ChartHelper.ApplySeriesRangeRefs (cognitive 28) · ×1
  • ChartHelper.ApplySeriesRangeRefs (cognitive 28) src/officecli/Core/Chart/ChartHelper.Setter.cs:117 — ChartHelper.ApplySeriesRangeRefs has cognitive complexity 28 (threshold 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 · ImageSource.TryGetJpegDimensions (cognitive 28) · ×1
  • ImageSource.TryGetJpegDimensions (cognitive 28) src/officecli/Core/ImageSource.cs:329 — ImageSource.TryGetJpegDimensions has cognitive complexity 28 (threshold 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 · PivotTableHelper.ParseCalculatedFieldSpecs (cognitive 28) · ×1
  • PivotTableHelper.ParseCalculatedFieldSpecs (cognitive 28) src/officecli/Core/PivotTableHelper.Definition.cs:1702 — PivotTableHelper.ParseCalculatedFieldSpecs has cognitive complexity 28 (threshold 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 · SkillInstaller.RefreshInstalled (cognitive 28) · ×1
  • SkillInstaller.RefreshInstalled (cognitive 28) src/officecli/Core/SkillInstaller.cs:601 — SkillInstaller.RefreshInstalled has cognitive complexity 28 (threshold 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 · ExcelBatchEmitter.EmitTables (cognitive 28) · ×1
  • ExcelBatchEmitter.EmitTables (cognitive 28) src/officecli/Handlers/Excel/ExcelBatchEmitter.Elements.cs:79 — ExcelBatchEmitter.EmitTables has cognitive complexity 28 (threshold 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 · ExcelHandler.GetSpillWidthPt (cognitive 28) · ×1
  • ExcelHandler.GetSpillWidthPt (cognitive 28) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:1001 — ExcelHandler.GetSpillWidthPt has cognitive complexity 28 (threshold 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 · ExcelHandler.SetRow (cognitive 28) · ×1
  • ExcelHandler.SetRow (cognitive 28) src/officecli/Handlers/Excel/ExcelHandler.Set.RowsCols.cs:308 — ExcelHandler.SetRow has cognitive complexity 28 (threshold 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 · ExcelHandler.ViewAsOutline (cognitive 28) · ×1
  • ExcelHandler.ViewAsOutline (cognitive 28) src/officecli/Handlers/Excel/ExcelHandler.View.cs:186 — ExcelHandler.ViewAsOutline has cognitive complexity 28 (threshold 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 · ExcelHandler.ViewAsStatsJson (cognitive 28) · ×1
  • ExcelHandler.ViewAsStatsJson (cognitive 28) src/officecli/Handlers/Excel/ExcelHandler.View.cs:325 — ExcelHandler.ViewAsStatsJson has cognitive complexity 28 (threshold 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 · ExcelHandler.EnumerateChartRefFormulas (cognitive 28) · ×1
  • ExcelHandler.EnumerateChartRefFormulas (cognitive 28) src/officecli/Handlers/Excel/ExcelHandler.View.cs:1092 — ExcelHandler.EnumerateChartRefFormulas has cognitive complexity 28 (threshold 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 · PowerPointHandler.GetShapeStyleXmlWithOrdinal (cognitive 28) · ×1
  • PowerPointHandler.GetShapeStyleXmlWithOrdinal (cognitive 28) REDACTED:4643 — PowerPointHandler.GetShapeStyleXmlWithOrdinal has cognitive complexity 28 (threshold 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 · PowerPointHandler.AddSlide (cognitive 28) · ×1
  • PowerPointHandler.AddSlide (cognitive 28) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Slide.cs:13 — PowerPointHandler.AddSlide has cognitive complexity 28 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · PowerPointHandler.AddPptAtFindPosition (cognitive 28) · ×1
  • PowerPointHandler.AddPptAtFindPosition (cognitive 28) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.FindReplace.cs:589 — PowerPointHandler.AddPptAtFindPosition has cognitive complexity 28 (threshold 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 · PowerPointHandler.RenderModel3D (cognitive 28) · ×1
  • PowerPointHandler.RenderModel3D (cognitive 28) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2709 — PowerPointHandler.RenderModel3D has cognitive complexity 28 (threshold 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 · PowerPointHandler.CountModernAuthorReferences (cognitive 28) · ×1
  • PowerPointHandler.CountModernAuthorReferences (cognitive 28) src/officecli/Handlers/Pptx/PowerPointHandler.ModernComments.cs:79 — PowerPointHandler.CountModernAuthorReferences has cognitive complexity 28 (threshold 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 · PowerPointHandler.RemovePictureWithCleanup (cognitive 28) · ×1
  • PowerPointHandler.RemovePictureWithCleanup (cognitive 28) src/officecli/Handlers/Pptx/PowerPointHandler.Resolve.cs:467 — PowerPointHandler.RemovePictureWithCleanup has cognitive complexity 28 (threshold 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 · PowerPointHandler.BuildAnimValueFromProps (cognitive 28) · ×1
  • PowerPointHandler.BuildAnimValueFromProps (cognitive 28) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:2237 — PowerPointHandler.BuildAnimValueFromProps has cognitive complexity 28 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · PowerPointHandler.GetMorphCheckNode (cognitive 28) · ×1
  • PowerPointHandler.GetMorphCheckNode (cognitive 28) src/officecli/Handlers/Pptx/PowerPointHandler.Theme.cs:27 — PowerPointHandler.GetMorphCheckNode has cognitive complexity 28 (threshold 15). Of this number, 19 points are the body's own statements and 9 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 · WordBatchEmitter.CaptureChartAnchorProps (cognitive 28) · ×1
  • WordBatchEmitter.CaptureChartAnchorProps (cognitive 28) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:3247 — WordBatchEmitter.CaptureChartAnchorProps has cognitive complexity 28 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.AddFlowList (cognitive 28) · ×1
  • WordHandler.AddFlowList (cognitive 28) src/officecli/Handlers/Word/WordHandler.Add.Markdown.cs:266 — WordHandler.AddFlowList has cognitive 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WordHandler.RenderCellListItem (cognitive 28) · ×1
  • WordHandler.RenderCellListItem (cognitive 28) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Tables.cs:1019 — WordHandler.RenderCellListItem has cognitive complexity 28 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · WordHandler.ApplyFootnoteEndnoteFormatKeys (cognitive 28) · ×1
  • WordHandler.ApplyFootnoteEndnoteFormatKeys (cognitive 28) src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs:591 — WordHandler.ApplyFootnoteEndnoteFormatKeys has cognitive 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SchemaHelpLoader.MergeSchemaJson (cognitive 28) · ×1
  • SchemaHelpLoader.MergeSchemaJson (cognitive 28) src/officecli/Help/SchemaHelpLoader.cs:290 — SchemaHelpLoader.MergeSchemaJson has cognitive complexity 28 (threshold 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 · McpServer.RunAsync (cognitive 28) · ×1
  • McpServer.RunAsync (cognitive 28) src/officecli/McpServer.cs:27 — McpServer.RunAsync has cognitive complexity 28 (threshold 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 · CompoundFile.WriteSingleStream (cognitive 27) · ×1
  • CompoundFile.WriteSingleStream (cognitive 27) src/officecli/Core/CompoundFile.cs:54 — CompoundFile.WriteSingleStream has cognitive complexity 27 (threshold 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 · FontMetricsReader.CmapHasCodepoint (cognitive 27) · ×1
  • FontMetricsReader.CmapHasCodepoint (cognitive 27) src/officecli/Core/FontMetricsReader.cs:563 — FontMetricsReader.CmapHasCodepoint has cognitive complexity 27 (threshold 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 · FormulaEvaluator.ApplyComparison (cognitive 27) · ×1
  • FormulaEvaluator.ApplyComparison (cognitive 27) src/officecli/Core/Formula/FormulaEvaluator.cs:714 — FormulaEvaluator.ApplyComparison has cognitive complexity 27 (threshold 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 · FormulaEvaluator.EvalVlookup (cognitive 27) · ×1
  • FormulaEvaluator.EvalVlookup (cognitive 27) src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:1191 — FormulaEvaluator.EvalVlookup has cognitive complexity 27 (threshold 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. This shape REPEATS in the file: one other method here (FormulaEvaluator.EvalHlookup) 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 · FormulaEvaluator.EvalHlookup (cognitive 27) · ×1
  • FormulaEvaluator.EvalHlookup (cognitive 27) src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:1209 — FormulaEvaluator.EvalHlookup has cognitive complexity 27 (threshold 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. This shape REPEATS in the file: one other method here (FormulaEvaluator.EvalVlookup) 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 · HtmlScreenshot.CaptureClipped (cognitive 27) · ×1
  • HtmlScreenshot.CaptureClipped (cognitive 27) src/officecli/Core/HtmlScreenshot.cs:186 — HtmlScreenshot.CaptureClipped has cognitive complexity 27 (threshold 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 · RawXmlHelper.EnforceKnownSchemaOrder (cognitive 27) · ×1
  • RawXmlHelper.EnforceKnownSchemaOrder (cognitive 27) src/officecli/Core/RawXmlHelper.cs:320 — RawXmlHelper.EnforceKnownSchemaOrder has cognitive complexity 27 (threshold 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 · ExcelHandler.MaybeSyncTableHeaderName (cognitive 27) · ×1
  • ExcelHandler.MaybeSyncTableHeaderName (cognitive 27) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Cell.cs:712 — ExcelHandler.MaybeSyncTableHeaderName has cognitive complexity 27 (threshold 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 · ExcelHandler.ShiftColumnsLeft (cognitive 27) · ×1
  • ExcelHandler.ShiftColumnsLeft (cognitive 27) src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:1393 — ExcelHandler.ShiftColumnsLeft has cognitive 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PowerPointHandler.ApplyBackground (cognitive 27) · ×1
  • PowerPointHandler.ApplyBackground (cognitive 27) src/officecli/Handlers/Pptx/PowerPointHandler.Background.cs:68 — PowerPointHandler.ApplyBackground has cognitive complexity 27 (threshold 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 · PowerPointHandler.SetSlideCommentProperties (cognitive 27) · ×1
  • PowerPointHandler.SetSlideCommentProperties (cognitive 27) src/officecli/Handlers/Pptx/PowerPointHandler.Comments.cs:277 — PowerPointHandler.SetSlideCommentProperties has cognitive complexity 27 (threshold 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 · PowerPointHandler.GetMathElement (cognitive 27) · ×1
  • PowerPointHandler.GetMathElement (cognitive 27) REDACTED:198 — PowerPointHandler.GetMathElement has cognitive complexity 27 (threshold 15). Of this number, 22 points are the body's own statements and 5 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 · PowerPointHandler.PopulatePresentationSettings (cognitive 27) · ×1
  • PowerPointHandler.PopulatePresentationSettings (cognitive 27) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Presentation.cs:193 — PowerPointHandler.PopulatePresentationSettings has cognitive complexity 27 (threshold 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 · WordBatchEmitter.FoldPgBordersProps (cognitive 27) · ×1
  • WordBatchEmitter.FoldPgBordersProps (cognitive 27) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:3368 — WordBatchEmitter.FoldPgBordersProps has cognitive complexity 27 (threshold 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 · WordHandler.AddDiagramNative (cognitive 27) · ×1
  • WordHandler.AddDiagramNative (cognitive 27) src/officecli/Handlers/Word/WordHandler.Add.Diagram.cs:66 — WordHandler.AddDiagramNative has cognitive complexity 27 (threshold 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 · WordHandler.AddTableColumn (cognitive 27) · ×1
  • WordHandler.AddTableColumn (cognitive 27) src/officecli/Handlers/Word/WordHandler.Add.Table.cs:1103 — WordHandler.AddTableColumn has cognitive complexity 27 (threshold 15). Of this number, 24 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 · WordHandler.BuildChartFrame (cognitive 27) · ×1
  • WordHandler.BuildChartFrame (cognitive 27) src/officecli/Handlers/Word/WordHandler.Helpers.Chart.cs:194 — WordHandler.BuildChartFrame has cognitive complexity 27 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · WordHandler.AddBlockAtSplitPoint (cognitive 27) · ×1
  • WordHandler.AddBlockAtSplitPoint (cognitive 27) src/officecli/Handlers/Word/WordHandler.Helpers.FindReplace.cs:1303 — WordHandler.AddBlockAtSplitPoint has cognitive complexity 27 (threshold 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 · WordHandler.GetPictureEffectsCss (cognitive 27) · ×1
  • WordHandler.GetPictureEffectsCss (cognitive 27) REDACTED:560 — WordHandler.GetPictureEffectsCss has cognitive complexity 27 (threshold 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 · WordHandler.CreateOleNode (cognitive 27) · ×1
  • WordHandler.CreateOleNode (cognitive 27) src/officecli/Handlers/Word/WordHandler.ImageHelpers.cs:908 — WordHandler.CreateOleNode has cognitive complexity 27 (threshold 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 · WordHandler.SdtBlockToNode (cognitive 27) · ×1
  • WordHandler.SdtBlockToNode (cognitive 27) src/officecli/Handlers/Word/WordHandler.Navigation.cs:3684 — WordHandler.SdtBlockToNode has cognitive complexity 27 (threshold 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. This shape REPEATS in the file: one other method here (WordHandler.SdtRunToNode) 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 · WordHandler.SdtRunToNode (cognitive 27) · ×1
  • WordHandler.SdtRunToNode (cognitive 27) src/officecli/Handlers/Word/WordHandler.Navigation.cs:3744 — WordHandler.SdtRunToNode has cognitive complexity 27 (threshold 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. This shape REPEATS in the file: one other method here (WordHandler.SdtBlockToNode) 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 · WordHandler.ParseSeqInstruction (cognitive 27) · ×1
  • WordHandler.ParseSeqInstruction (cognitive 27) src/officecli/Handlers/Word/WordHandler.SeqEval.cs:73 — WordHandler.ParseSeqInstruction has cognitive complexity 27 (threshold 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 · WordHandler.EnumerateRevisions (cognitive 27) · ×1
  • WordHandler.EnumerateRevisions (cognitive 27) src/officecli/Handlers/Word/WordHandler.Set.Revision.cs:1051 — WordHandler.EnumerateRevisions has cognitive complexity 27 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · CommandBuilder.FormatNodesCompact (cognitive 26) · ×1
  • CommandBuilder.FormatNodesCompact (cognitive 26) src/officecli/CommandBuilder.GetQuery.cs:316 — CommandBuilder.FormatNodesCompact has cognitive complexity 26 (threshold 15). Of this number, 21 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 · CommandBuilder.BuildGetMarksCommand (cognitive 26) · ×1
  • CommandBuilder.BuildGetMarksCommand (cognitive 26) src/officecli/CommandBuilder.Mark.cs:303 — CommandBuilder.BuildGetMarksCommand has cognitive complexity 26 (threshold 15). None of this is in the body itself: all 26 points belong to one function literal inside it that branches (line 312). 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 · FormulaEvaluator.Expand2DRange (cognitive 26) · ×1
  • FormulaEvaluator.Expand2DRange (cognitive 26) src/officecli/Core/Formula/FormulaEvaluator.cs:1508 — FormulaEvaluator.Expand2DRange has cognitive complexity 26 (threshold 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 · ThemeHandler.TrySetTheme (cognitive 26) · ×1
  • ThemeHandler.TrySetTheme (cognitive 26) src/officecli/Core/ThemeHandler.cs:88 — ThemeHandler.TrySetTheme has cognitive complexity 26 (threshold 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 · ExcelHandler.ValidateFormulaArgCount (cognitive 26) · ×1
  • ExcelHandler.ValidateFormulaArgCount (cognitive 26) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Validation.cs:218 — ExcelHandler.ValidateFormulaArgCount has cognitive complexity 26 (threshold 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 · ExcelHandler.NormalizeValidationFormula (cognitive 26) · ×1
  • ExcelHandler.NormalizeValidationFormula (cognitive 26) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Validation.cs:374 — ExcelHandler.NormalizeValidationFormula has cognitive complexity 26 (threshold 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 · ExcelHandler.MatchesCellSelector (cognitive 26) · ×1
  • ExcelHandler.MatchesCellSelector (cognitive 26) src/officecli/Handlers/Excel/ExcelHandler.Selector.cs:132 — ExcelHandler.MatchesCellSelector has cognitive complexity 26 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · PowerPointHandler.GrowSlideLayoutParts (cognitive 26) · ×1
  • PowerPointHandler.GrowSlideLayoutParts (cognitive 26) REDACTED:503 — PowerPointHandler.GrowSlideLayoutParts has cognitive complexity 26 (threshold 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 · PowerPointHandler.GetActiveXOnSlide (cognitive 26) · ×1
  • PowerPointHandler.GetActiveXOnSlide (cognitive 26) REDACTED:3347 — PowerPointHandler.GetActiveXOnSlide has cognitive complexity 26 (threshold 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 · PowerPointHandler.GetShapeParagraphFieldXmls (cognitive 26) · ×1
  • PowerPointHandler.GetShapeParagraphFieldXmls (cognitive 26) REDACTED:4937 — PowerPointHandler.GetShapeParagraphFieldXmls has cognitive complexity 26 (threshold 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 · WordBatchEmitter.TryEmitFormFieldRun (cognitive 26) · ×1
  • WordBatchEmitter.TryEmitFormFieldRun (cognitive 26) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:2127 — WordBatchEmitter.TryEmitFormFieldRun has cognitive complexity 26 (threshold 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 · WordBatchEmitter.StripDanglingNoteSeparatorRefs (cognitive 26) · ×1
  • WordBatchEmitter.StripDanglingNoteSeparatorRefs (cognitive 26) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:157 — WordBatchEmitter.StripDanglingNoteSeparatorRefs has cognitive complexity 26 (threshold 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 · WordHandler.AddCore (cognitive 26) · ×1
  • WordHandler.AddCore (cognitive 26) src/officecli/Handlers/Word/WordHandler.Add.cs:21 — WordHandler.AddCore has cognitive complexity 26 (threshold 15). 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 · WordHandler.RemoveWithTrackChange (cognitive 26) · ×1
  • WordHandler.RemoveWithTrackChange (cognitive 26) src/officecli/Handlers/Word/WordHandler.Mutations.cs:908 — WordHandler.RemoveWithTrackChange has cognitive 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WordHandler.RejectRevision (cognitive 26) · ×1
  • WordHandler.RejectRevision (cognitive 26) src/officecli/Handlers/Word/WordHandler.Set.Revision.cs:1320 — WordHandler.RejectRevision has cognitive complexity 26 (threshold 15). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · CommandBuilder.CheckPositionOverlap (cognitive 25) · ×1
  • CommandBuilder.CheckPositionOverlap (cognitive 25) src/officecli/CommandBuilder.cs:2064 — CommandBuilder.CheckPositionOverlap has cognitive complexity 25 (threshold 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 · AttributeFilter.FilterSelector (cognitive 25) · ×1
  • AttributeFilter.FilterSelector (cognitive 25) src/officecli/Core/AttributeFilter.cs:1100 — AttributeFilter.FilterSelector has cognitive complexity 25 (threshold 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 · BatchCompat.RemapNumberingIds (cognitive 25) · ×1
  • BatchCompat.RemapNumberingIds (cognitive 25) src/officecli/Core/BatchCompat.cs:86 — BatchCompat.RemapNumberingIds has cognitive complexity 25 (threshold 15). Of this number, 19 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChartEmbeddedDataSync.Restore (cognitive 25) · ×1
  • ChartEmbeddedDataSync.Restore (cognitive 25) src/officecli/Core/Chart/ChartEmbeddedDataSync.cs:57 — ChartEmbeddedDataSync.Restore has cognitive complexity 25 (threshold 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 · DelimitedText.ParseGrid (cognitive 25) · ×1
  • DelimitedText.ParseGrid (cognitive 25) src/officecli/Core/DelimitedText.cs:30 — DelimitedText.ParseGrid has cognitive complexity 25 (threshold 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 · FormulaEvaluator.RegressionInputs (cognitive 25) · ×1
  • FormulaEvaluator.RegressionInputs (cognitive 25) src/officecli/Core/Formula/FormulaEvaluator.Regression.cs:81 — FormulaEvaluator.RegressionInputs has cognitive complexity 25 (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.
D2 · Cognitive Complexity · FormulaParser.TrimControlWordDelimiterSpaces (cognitive 25) · ×1
  • FormulaParser.TrimControlWordDelimiterSpaces (cognitive 25) src/officecli/Core/Formula/FormulaParser.cs:284 — FormulaParser.TrimControlWordDelimiterSpaces has cognitive complexity 25 (threshold 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 · ImageSource.TryGetDimensions (cognitive 25) · ×1
  • ImageSource.TryGetDimensions (cognitive 25) src/officecli/Core/ImageSource.cs:247 — ImageSource.TryGetDimensions has cognitive complexity 25 (threshold 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 · NumericText.TryRewriteCommaDecimal (cognitive 25) · ×1
  • NumericText.TryRewriteCommaDecimal (cognitive 25) src/officecli/Core/NumericText.cs:75 — NumericText.TryRewriteCommaDecimal has cognitive complexity 25 (threshold 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 · PivotTableHelper.SanitizeXmlText (cognitive 25) · ×1
  • PivotTableHelper.SanitizeXmlText (cognitive 25) src/officecli/Core/PivotTableHelper.cs:38 — PivotTableHelper.SanitizeXmlText has cognitive complexity 25 (threshold 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 · RawXmlHelper.Execute (cognitive 25) · ×1
  • RawXmlHelper.Execute (cognitive 25) src/officecli/Core/RawXmlHelper.cs:37 — RawXmlHelper.Execute has cognitive complexity 25 (threshold 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 · WatchServer.FindDataPathInHtmlExact (cognitive 25) · ×1
  • WatchServer.FindDataPathInHtmlExact (cognitive 25) src/officecli/Core/Watch/WatchServer.cs:1090 — WatchServer.FindDataPathInHtmlExact has cognitive complexity 25 (threshold 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 · WatchServer.HandlePostSendAsync (cognitive 25) · ×1
  • WatchServer.HandlePostSendAsync (cognitive 25) src/officecli/Core/Watch/WatchServer.cs:2311 — WatchServer.HandlePostSendAsync has cognitive complexity 25 (threshold 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 · WordNumFmtRenderer.BuildCjkGrouped (cognitive 25) · ×1
  • WordNumFmtRenderer.BuildCjkGrouped (cognitive 25) src/officecli/Core/WordNumFmtRenderer.cs:320 — WordNumFmtRenderer.BuildCjkGrouped has cognitive complexity 25 (threshold 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 · WorksheetBloatFilter.ProcessRow (cognitive 25) · ×1
  • WorksheetBloatFilter.ProcessRow (cognitive 25) src/officecli/Core/WorksheetBloatFilter.cs:282 — WorksheetBloatFilter.ProcessRow has cognitive complexity 25 (threshold 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 · ExcelHandler.BuildSparklineMap (cognitive 25) · ×1
  • ExcelHandler.BuildSparklineMap (cognitive 25) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:1578 — ExcelHandler.BuildSparklineMap has cognitive complexity 25 (threshold 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 · ExcelHandler.BuildTableStyleMap (cognitive 25) · ×1
  • ExcelHandler.BuildTableStyleMap (cognitive 25) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:2032 — ExcelHandler.BuildTableStyleMap has cognitive complexity 25 (threshold 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 · ExcelHandler.BuildAlignmentCss (cognitive 25) · ×1
  • ExcelHandler.BuildAlignmentCss (cognitive 25) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:2614 — ExcelHandler.BuildAlignmentCss has cognitive complexity 25 (threshold 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 · PowerPointHandler.AddDiagramNative (cognitive 25) · ×1
  • PowerPointHandler.AddDiagramNative (cognitive 25) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Diagram.cs:64 — PowerPointHandler.AddDiagramNative has cognitive complexity 25 (threshold 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 · PowerPointHandler.ParseOutline (cognitive 25) · ×1
  • PowerPointHandler.ParseOutline (cognitive 25) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:754 — PowerPointHandler.ParseOutline has cognitive complexity 25 (threshold 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 · PptxBatchEmitter.EmitPresentationProps (cognitive 25) · ×1
  • PptxBatchEmitter.EmitPresentationProps (cognitive 25) src/officecli/Handlers/Pptx/PptxBatchEmitter.cs:295 — PptxBatchEmitter.EmitPresentationProps has cognitive complexity 25 (threshold 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 · PptxBatchEmitter.EmitPicture (cognitive 25) · ×1
  • PptxBatchEmitter.EmitPicture (cognitive 25) src/officecli/Handlers/Pptx/PptxBatchEmitter.Media.cs:14 — PptxBatchEmitter.EmitPicture has cognitive complexity 25 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · WordHandler.ApplyInlineSpans (cognitive 25) · ×1
  • WordHandler.ApplyInlineSpans (cognitive 25) src/officecli/Handlers/Word/WordHandler.Add.Markdown.cs:485 — WordHandler.ApplyInlineSpans has cognitive complexity 25 (threshold 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 · WordHandler.ResolveSpacingFromStyle (cognitive 25) · ×1
  • WordHandler.ResolveSpacingFromStyle (cognitive 25) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:1117 — WordHandler.ResolveSpacingFromStyle has cognitive 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, 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 · WordHandler.ReadSdtExtraProps (cognitive 25) · ×1
  • WordHandler.ReadSdtExtraProps (cognitive 25) src/officecli/Handlers/Word/WordHandler.Navigation.cs:3800 — WordHandler.ReadSdtExtraProps has cognitive 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WordHandler.SetTocPath (cognitive 25) · ×1
  • WordHandler.SetTocPath (cognitive 25) src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs:425 — WordHandler.SetTocPath has cognitive complexity 25 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · WordHandler.TrySetDocDefaults (cognitive 25) · ×1
  • WordHandler.TrySetDocDefaults (cognitive 25) src/officecli/Handlers/Word/WordHandler.Set.DocDefaults.cs:15 — WordHandler.TrySetDocDefaults has cognitive complexity 25 (threshold 15). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · WordHandler.AcceptRevision (cognitive 25) · ×1
  • WordHandler.AcceptRevision (cognitive 25) src/officecli/Handlers/Word/WordHandler.Set.Revision.cs:1215 — WordHandler.AcceptRevision has cognitive complexity 25 (threshold 15). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · WordHandler.EnsureUniqueMoveRunIds (cognitive 25) · ×1
  • WordHandler.EnsureUniqueMoveRunIds (cognitive 25) src/officecli/Handlers/WordHandler.cs:2342 — WordHandler.EnsureUniqueMoveRunIds has cognitive complexity 25 (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.
D2 · Cognitive Complexity · ResidentServer.ExecuteQuery (cognitive 25) · ×1
  • ResidentServer.ExecuteQuery (cognitive 25) src/officecli/ResidentServer.cs:2108 — ResidentServer.ExecuteQuery has cognitive 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · watch-overlay.document.addEventListener("click") (cognitive 25) · ×1
  • watch-overlay.document.addEventListener("click") (cognitive 25) src/officecli/Resources/watch-overlay.js:547 — watch-overlay.document.addEventListener("click") has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 6 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · (anonymous) (cognitive 25) · ×1
  • (anonymous) (cognitive 25) src/officecli/Resources/watch-overlay.js:547 — (anonymous) has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 6 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CommandBuilder.BuildWatchCommand (cognitive 24) · ×1
  • CommandBuilder.BuildWatchCommand (cognitive 24) src/officecli/CommandBuilder.Watch.cs:12 — CommandBuilder.BuildWatchCommand has cognitive complexity 24 (threshold 15). None of this is in the body itself: all 24 points belong to one function literal inside it that branches (line 32). 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 · AttributeFilter.ExtractBracketBlocks (cognitive 24) · ×1
  • AttributeFilter.ExtractBracketBlocks (cognitive 24) src/officecli/Core/AttributeFilter.cs:63 — AttributeFilter.ExtractBracketBlocks has cognitive complexity 24 (threshold 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 · ChartSvgRenderer.StackSeries (cognitive 24) · ×1
  • ChartSvgRenderer.StackSeries (cognitive 24) src/officecli/Core/Chart/ChartSvgRenderer.cs:1299 — ChartSvgRenderer.StackSeries has cognitive complexity 24 (threshold 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 · ExtendedPropertiesHandler.PopulateExtendedProperties (cognitive 24) · ×1
  • ExtendedPropertiesHandler.PopulateExtendedProperties (cognitive 24) src/officecli/Core/ExtendedPropertiesHandler.cs:17 — ExtendedPropertiesHandler.PopulateExtendedProperties has cognitive complexity 24 (threshold 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 · FontMetricsReader.ReadFamilyNames (cognitive 24) · ×1
  • FontMetricsReader.ReadFamilyNames (cognitive 24) src/officecli/Core/FontMetricsReader.cs:289 — FontMetricsReader.ReadFamilyNames has cognitive complexity 24 (threshold 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 · FormulaEvaluator.EvalOffset (cognitive 24) · ×1
  • FormulaEvaluator.EvalOffset (cognitive 24) src/officecli/Core/Formula/FormulaEvaluator.References.cs:166 — FormulaEvaluator.EvalOffset has cognitive complexity 24 (threshold 15). 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 · FormulaEvaluator.EvalUnique (cognitive 24) · ×1
  • FormulaEvaluator.EvalUnique (cognitive 24) src/officecli/Core/Formula/FormulaEvaluator.Spill.cs:168 — FormulaEvaluator.EvalUnique has cognitive complexity 24 (threshold 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 · FormulaEvaluator.EvalToColRow (cognitive 24) · ×1
  • FormulaEvaluator.EvalToColRow (cognitive 24) src/officecli/Core/Formula/FormulaEvaluator.Spill.cs:286 — FormulaEvaluator.EvalToColRow has cognitive complexity 24 (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.
D2 · Cognitive Complexity · MarkdownParser.TryMatchLinkSyntax (cognitive 24) · ×1
  • MarkdownParser.TryMatchLinkSyntax (cognitive 24) src/officecli/Core/Markdown/MarkdownParser.cs:470 — MarkdownParser.TryMatchLinkSyntax has cognitive complexity 24 (threshold 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 · PivotTableHelper.BuildCacheDefinition (cognitive 24) · ×1
  • PivotTableHelper.BuildCacheDefinition (cognitive 24) src/officecli/Core/PivotTableHelper.Cache.cs:406 — PivotTableHelper.BuildCacheDefinition has cognitive complexity 24 (threshold 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 · WordTocBuilder.ReplaceTocFieldContent (cognitive 24) · ×1
  • WordTocBuilder.ReplaceTocFieldContent (cognitive 24) src/officecli/Core/WordTocBuilder.cs:213 — WordTocBuilder.ReplaceTocFieldContent has cognitive complexity 24 (threshold 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 · DocumentHandlerFactory.TryOpenViaPlugin (cognitive 24) · ×1
  • DocumentHandlerFactory.TryOpenViaPlugin (cognitive 24) REDACTED:315 — DocumentHandlerFactory.TryOpenViaPlugin has cognitive complexity 24 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ExcelHandler.RemapChartExFormulasToHostRange (cognitive 24) · ×1
  • ExcelHandler.RemapChartExFormulasToHostRange (cognitive 24) src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:529 — ExcelHandler.RemapChartExFormulasToHostRange has cognitive complexity 24 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ExcelHandler.AddOle (cognitive 24) · ×1
  • ExcelHandler.AddOle (cognitive 24) src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:51 — ExcelHandler.AddOle has cognitive complexity 24 (threshold 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 · ExcelHandler.BuildCommentRunProperties (cognitive 24) · ×1
  • ExcelHandler.BuildCommentRunProperties (cognitive 24) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Node.cs:868 — ExcelHandler.BuildCommentRunProperties has cognitive complexity 24 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ExcelHandler.CfRangeExtents (cognitive 24) · ×1
  • ExcelHandler.CfRangeExtents (cognitive 24) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:2149 — ExcelHandler.CfRangeExtents has cognitive complexity 24 (threshold 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 · ExcelHandler.SyncTableColumnsAfterColInsert (cognitive 24) · ×1
  • ExcelHandler.SyncTableColumnsAfterColInsert (cognitive 24) src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:1556 — ExcelHandler.SyncTableColumnsAfterColInsert has cognitive complexity 24 (threshold 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 · ExcelHandler.ParseCellSelector (cognitive 24) · ×1
  • ExcelHandler.ParseCellSelector (cognitive 24) src/officecli/Handlers/Excel/ExcelHandler.Selector.cs:19 — ExcelHandler.ParseCellSelector has cognitive complexity 24 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · PowerPointHandler.GetPictureBlipPassthroughChildrenXml (cognitive 24) · ×1
  • PowerPointHandler.GetPictureBlipPassthroughChildrenXml (cognitive 24) REDACTED:4443 — PowerPointHandler.GetPictureBlipPassthroughChildrenXml has cognitive complexity 24 (threshold 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 · PowerPointHandler.GetShapeBlipTileXmlWithOrdinal (cognitive 24) · ×1
  • PowerPointHandler.GetShapeBlipTileXmlWithOrdinal (cognitive 24) REDACTED:4870 — PowerPointHandler.GetShapeBlipTileXmlWithOrdinal has cognitive complexity 24 (threshold 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 · PowerPointHandler.AddEmptyGroup (cognitive 24) · ×1
  • PowerPointHandler.AddEmptyGroup (cognitive 24) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1103 — PowerPointHandler.AddEmptyGroup has cognitive complexity 24 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · PowerPointHandler.RenderSlideElements (cognitive 24) · ×1
  • PowerPointHandler.RenderSlideElements (cognitive 24) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.cs:658 — PowerPointHandler.RenderSlideElements has cognitive complexity 24 (threshold 15). Of this number, 19 points are the body's own statements and 5 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 · PowerPointHandler.PathToSvgD (cognitive 24) · ×1
  • PowerPointHandler.PathToSvgD (cognitive 24) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:437 — PowerPointHandler.PathToSvgD has cognitive complexity 24 (threshold 15). Of this number, 20 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PowerPointHandler.FindUnsupportedCombinator (cognitive 24) · ×1
  • PowerPointHandler.FindUnsupportedCombinator (cognitive 24) src/officecli/Handlers/Pptx/PowerPointHandler.Selector.cs:24 — PowerPointHandler.FindUnsupportedCombinator has cognitive complexity 24 (threshold 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 · PowerPointHandler.RenderConnectorSvg (cognitive 24) · ×1
  • PowerPointHandler.RenderConnectorSvg (cognitive 24) src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:1037 — PowerPointHandler.RenderConnectorSvg has cognitive complexity 24 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · PowerPointHandler.CustomGeometryToSvgPath (cognitive 24) · ×1
  • PowerPointHandler.CustomGeometryToSvgPath (cognitive 24) src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:1929 — PowerPointHandler.CustomGeometryToSvgPath has cognitive complexity 24 (threshold 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 · WordBatchEmitter.EmitWordWithWarnings (cognitive 24) · ×1
  • WordBatchEmitter.EmitWordWithWarnings (cognitive 24) src/officecli/Handlers/Word/WordBatchEmitter.cs:182 — WordBatchEmitter.EmitWordWithWarnings has cognitive complexity 24 (threshold 15). Of this number, 18 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 · WordHandler.RenderHeaderFooterBody (cognitive 24) · ×1
  • WordHandler.RenderHeaderFooterBody (cognitive 24) REDACTED:2264 — WordHandler.RenderHeaderFooterBody has cognitive complexity 24 (threshold 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 · WordHandler.AppendW14ReflectionBlock (cognitive 24) · ×1
  • WordHandler.AppendW14ReflectionBlock (cognitive 24) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:2176 — WordHandler.AppendW14ReflectionBlock has cognitive complexity 24 (threshold 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 · WordHandler.RenderWrapNoneOverlayImage (cognitive 24) · ×1
  • WordHandler.RenderWrapNoneOverlayImage (cognitive 24) REDACTED:451 — WordHandler.RenderWrapNoneOverlayImage has cognitive complexity 24 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · WordHandler.ComputeAnchorWrapFloatCss (cognitive 24) · ×1
  • WordHandler.ComputeAnchorWrapFloatCss (cognitive 24) REDACTED:807 — WordHandler.ComputeAnchorWrapFloatCss has cognitive 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WordHandler.RehomeCrossPartRelationships (cognitive 24) · ×1
  • WordHandler.RehomeCrossPartRelationships (cognitive 24) src/officecli/Handlers/Word/WordHandler.Mutations.cs:1676 — WordHandler.RehomeCrossPartRelationships has cognitive complexity 24 (threshold 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 · WordHandler.BodyToNode (cognitive 24) · ×1
  • WordHandler.BodyToNode (cognitive 24) src/officecli/Handlers/Word/WordHandler.Navigation.cs:3909 — WordHandler.BodyToNode has cognitive complexity 24 (threshold 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 · WordHandler.ParseBorderValueDetailed (cognitive 24) · ×1
  • WordHandler.ParseBorderValueDetailed (cognitive 24) src/officecli/Handlers/Word/WordHandler.Set.cs:1046 — WordHandler.ParseBorderValueDetailed has cognitive complexity 24 (threshold 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 · WordHandler.SetElementBookmark (cognitive 24) · ×1
  • WordHandler.SetElementBookmark (cognitive 24) src/officecli/Handlers/Word/WordHandler.Set.Element.cs:31 — WordHandler.SetElementBookmark has cognitive 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WordHandler.TrySetFootnoteEndnoteNumProps (cognitive 24) · ×1
  • WordHandler.TrySetFootnoteEndnoteNumProps (cognitive 24) src/officecli/Handlers/Word/WordHandler.Set.SectionLayout.cs:703 — WordHandler.TrySetFootnoteEndnoteNumProps has cognitive complexity 24 (threshold 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 · WordHandler.GetParagraphTextWithFormFields (cognitive 24) · ×1
  • WordHandler.GetParagraphTextWithFormFields (cognitive 24) src/officecli/Handlers/Word/WordHandler.View.cs:161 — WordHandler.GetParagraphTextWithFormFields has cognitive complexity 24 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · CommandBuilder.BuildAppliedSuffix (cognitive 23) · ×1
  • CommandBuilder.BuildAppliedSuffix (cognitive 23) src/officecli/CommandBuilder.cs:889 — CommandBuilder.BuildAppliedSuffix has cognitive 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, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · CommandBuilder.ParsePropsArray (cognitive 23) · ×1
  • CommandBuilder.ParsePropsArray (cognitive 23) src/officecli/CommandBuilder.cs:1379 — CommandBuilder.ParsePropsArray has cognitive complexity 23 (threshold 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 · ChartHelper.BuildDefaultRunPropertiesFromCompoundSpec (cognitive 23) · ×1
  • ChartHelper.BuildDefaultRunPropertiesFromCompoundSpec (cognitive 23) src/officecli/Core/Chart/ChartHelper.Builder.cs:1793 — ChartHelper.BuildDefaultRunPropertiesFromCompoundSpec has cognitive complexity 23 (threshold 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 · PivotTableHelper.ReadSourceData (cognitive 23) · ×1
  • PivotTableHelper.ReadSourceData (cognitive 23) src/officecli/Core/PivotTableHelper.Cache.cs:255 — PivotTableHelper.ReadSourceData has cognitive complexity 23 (threshold 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 · PivotTableHelper.BuildCacheRecords (cognitive 23) · ×1
  • PivotTableHelper.BuildCacheRecords (cognitive 23) src/officecli/Core/PivotTableHelper.Cache.cs:864 — PivotTableHelper.BuildCacheRecords has cognitive complexity 23 (threshold 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 · TemplateMerger.ScanUnresolvedDocx (cognitive 23) · ×1
  • TemplateMerger.ScanUnresolvedDocx (cognitive 23) src/officecli/Core/TemplateMerger.cs:285 — TemplateMerger.ScanUnresolvedDocx has cognitive complexity 23 (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.
D2 · Cognitive Complexity · ThemeHandler.PopulateTheme (cognitive 23) · ×1
  • ThemeHandler.PopulateTheme (cognitive 23) src/officecli/Core/ThemeHandler.cs:35 — ThemeHandler.PopulateTheme has cognitive complexity 23 (threshold 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 · TypedAttributeFallback.TrySet (cognitive 23) · ×1
  • TypedAttributeFallback.TrySet (cognitive 23) src/officecli/Core/TypedAttributeFallback.cs:84 — TypedAttributeFallback.TrySet has cognitive complexity 23 (threshold 15). 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 · WatchServer.RunAsync (cognitive 23) · ×1
  • WatchServer.RunAsync (cognitive 23) src/officecli/Core/Watch/WatchServer.cs:309 — WatchServer.RunAsync has cognitive 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, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WatchServer.HandleClientAsync (cognitive 23) · ×1
  • WatchServer.HandleClientAsync (cognitive 23) src/officecli/Core/Watch/WatchServer.cs:1883 — WatchServer.HandleClientAsync has cognitive complexity 23 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · WorksheetBloatFilter.FilterCore (cognitive 23) · ×1
  • WorksheetBloatFilter.FilterCore (cognitive 23) src/officecli/Core/WorksheetBloatFilter.cs:185 — WorksheetBloatFilter.FilterCore has cognitive complexity 23 (threshold 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 · XmlTextValidator.FindInvalidChar (cognitive 23) · ×1
  • XmlTextValidator.FindInvalidChar (cognitive 23) src/officecli/Core/XmlTextValidator.cs:36 — XmlTextValidator.FindInvalidChar has cognitive complexity 23 (threshold 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 · ExcelBatchEmitter.EmitSheetSettings (cognitive 23) · ×1
  • ExcelBatchEmitter.EmitSheetSettings (cognitive 23) src/officecli/Handlers/Excel/ExcelBatchEmitter.cs:534 — ExcelBatchEmitter.EmitSheetSettings has cognitive complexity 23 (threshold 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 · ExcelHandler.EvaluateCellOverflow (cognitive 23) · ×1
  • ExcelHandler.EvaluateCellOverflow (cognitive 23) src/officecli/Handlers/Excel/ExcelHandler.CheckOverflow.cs:133 — ExcelHandler.EvaluateCellOverflow has cognitive complexity 23 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ExcelHandler.GetDumpOleSlices (cognitive 23) · ×1
  • ExcelHandler.GetDumpOleSlices (cognitive 23) src/officecli/Handlers/Excel/ExcelHandler.DumpSupport.cs:471 — ExcelHandler.GetDumpOleSlices has cognitive complexity 23 (threshold 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 · ExcelHandler.TrySetShapeEffect (cognitive 23) · ×1
  • ExcelHandler.TrySetShapeEffect (cognitive 23) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:1226 — ExcelHandler.TrySetShapeEffect has cognitive complexity 23 (threshold 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 · ExcelHandler.DescribeRowColumnsHint (cognitive 23) · ×1
  • ExcelHandler.DescribeRowColumnsHint (cognitive 23) src/officecli/Handlers/Excel/ExcelHandler.Query.RowWhere.cs:475 — ExcelHandler.DescribeRowColumnsHint has cognitive 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExcelHandler.TryGetInCellImage (cognitive 23) · ×1
  • ExcelHandler.TryGetInCellImage (cognitive 23) src/officecli/Handlers/Excel/ExcelHandler.RichValueImage.cs:267 — ExcelHandler.TryGetInCellImage has cognitive 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: 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 · PowerPointHandler.Raw (cognitive 23) · ×1
  • PowerPointHandler.Raw (cognitive 23) REDACTED:201 — PowerPointHandler.Raw has cognitive complexity 23 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · PowerPointHandler.ReHomeCollidingRel (cognitive 23) · ×1
  • PowerPointHandler.ReHomeCollidingRel (cognitive 23) REDACTED:2218 — PowerPointHandler.ReHomeCollidingRel has cognitive complexity 23 (threshold 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 · PowerPointHandler.GetTimingAudioRels (cognitive 23) · ×1
  • PowerPointHandler.GetTimingAudioRels (cognitive 23) REDACTED:3277 — PowerPointHandler.GetTimingAudioRels has cognitive complexity 23 (threshold 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 · PowerPointHandler.AutoUnprefixMorphNames (cognitive 23) · ×1
  • PowerPointHandler.AutoUnprefixMorphNames (cognitive 23) src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:3093 — PowerPointHandler.AutoUnprefixMorphNames has cognitive 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PowerPointHandler.ApplyBevel (cognitive 23) · ×1
  • PowerPointHandler.ApplyBevel (cognitive 23) src/officecli/Handlers/Pptx/PowerPointHandler.Effects.cs:505 — PowerPointHandler.ApplyBevel has cognitive complexity 23 (threshold 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 · PowerPointHandler.ApplyAdjustHandles (cognitive 23) · ×1
  • PowerPointHandler.ApplyAdjustHandles (cognitive 23) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Geometry.cs:287 — PowerPointHandler.ApplyAdjustHandles has cognitive complexity 23 (threshold 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 · PowerPointHandler.RenderSmartArt (cognitive 23) · ×1
  • PowerPointHandler.RenderSmartArt (cognitive 23) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2965 — PowerPointHandler.RenderSmartArt has cognitive complexity 23 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.ReconstructCustomGeometryPath (cognitive 23) · ×1
  • PowerPointHandler.ReconstructCustomGeometryPath (cognitive 23) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:3477 — PowerPointHandler.ReconstructCustomGeometryPath has cognitive complexity 23 (threshold 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 · PowerPointHandler.RenderInheritedShapesSvg (cognitive 23) · ×1
  • PowerPointHandler.RenderInheritedShapesSvg (cognitive 23) src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:223 — PowerPointHandler.RenderInheritedShapesSvg has cognitive complexity 23 (threshold 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 · PptxBatchEmitter.EmitConnector (cognitive 23) · ×1
  • PptxBatchEmitter.EmitConnector (cognitive 23) src/officecli/Handlers/Pptx/PptxBatchEmitter.Shape.cs:527 — PptxBatchEmitter.EmitConnector has cognitive 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, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. 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 · WordBatchEmitter.TryEmitElementAdd (cognitive 23) · ×1
  • WordBatchEmitter.TryEmitElementAdd (cognitive 23) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:3788 — WordBatchEmitter.TryEmitElementAdd has cognitive complexity 23 (threshold 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 · WordHandler.AddMarkdown (cognitive 23) · ×1
  • WordHandler.AddMarkdown (cognitive 23) src/officecli/Handlers/Word/WordHandler.Add.Markdown.cs:32 — WordHandler.AddMarkdown has cognitive complexity 23 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · WordHandler.RenderHeaderFooterHtml (cognitive 23) · ×1
  • WordHandler.RenderHeaderFooterHtml (cognitive 23) REDACTED:2027 — WordHandler.RenderHeaderFooterHtml has cognitive complexity 23 (threshold 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 · WordHandler.RenderHyperlinkHtml (cognitive 23) · ×1
  • WordHandler.RenderHyperlinkHtml (cognitive 23) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Text.cs:1550 — WordHandler.RenderHyperlinkHtml has cognitive complexity 23 (threshold 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 · WordHandler.ValidateAndNormalizePredicate (cognitive 23) · ×1
  • WordHandler.ValidateAndNormalizePredicate (cognitive 23) src/officecli/Handlers/Word/WordHandler.Navigation.cs:839 — WordHandler.ValidateAndNormalizePredicate has cognitive complexity 23 (threshold 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 · WordHandler.SetElementMPara (cognitive 23) · ×1
  • WordHandler.SetElementMPara (cognitive 23) src/officecli/Handlers/Word/WordHandler.Set.Element.cs:1046 — WordHandler.SetElementMPara has cognitive complexity 23 (threshold 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 · WordHandler.SetElementOMath (cognitive 23) · ×1
  • WordHandler.SetElementOMath (cognitive 23) src/officecli/Handlers/Word/WordHandler.Set.Element.cs:1123 — WordHandler.SetElementOMath has cognitive complexity 23 (threshold 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 · ResidentServer.ExecuteAdd (cognitive 23) · ×1
  • ResidentServer.ExecuteAdd (cognitive 23) src/officecli/ResidentServer.cs:2346 — ResidentServer.ExecuteAdd has cognitive complexity 23 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · watch-sse-core._replaceDocumentBody (cognitive 23) · ×1
  • watch-sse-core._replaceDocumentBody (cognitive 23) src/officecli/Resources/watch-sse-core.js:40 — watch-sse-core._replaceDocumentBody has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 3, loops 1 (nesting depth added 4). None of this is in the body itself: all 23 points belong to 5 function literals inside it that branch (lines 41, 76, 61, …). 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 · (anonymous) (cognitive 23) · ×1
  • (anonymous) (cognitive 23) src/officecli/Resources/watch-overlay.js:774 — (anonymous) has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 4 (12 pts), if/else 7 (9 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BatchItemConverter.Write (cognitive 22) · ×1
  • BatchItemConverter.Write (cognitive 22) src/officecli/BatchTypes.cs:117 — BatchItemConverter.Write has cognitive complexity 22 (threshold 15). 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 · ChartHelper.ReadReferenceLines (cognitive 22) · ×1
  • ChartHelper.ReadReferenceLines (cognitive 22) src/officecli/Core/Chart/ChartHelper.Reader.cs:1881 — ChartHelper.ReadReferenceLines has cognitive complexity 22 (threshold 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 · ChartSvgRenderer.RenderLine3DSvg (cognitive 22) · ×1
  • ChartSvgRenderer.RenderLine3DSvg (cognitive 22) src/officecli/Core/Chart/ChartSvgRenderer.cs:5382 — ChartSvgRenderer.RenderLine3DSvg has cognitive complexity 22 (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.
D2 · Cognitive Complexity · FormulaEvaluator.GetPopulatedColRange (cognitive 22) · ×1
  • FormulaEvaluator.GetPopulatedColRange (cognitive 22) src/officecli/Core/Formula/FormulaEvaluator.cs:1454 — FormulaEvaluator.GetPopulatedColRange has cognitive complexity 22 (threshold 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 · FormulaEvaluator.EvalRowCol (cognitive 22) · ×1
  • FormulaEvaluator.EvalRowCol (cognitive 22) src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:1157 — FormulaEvaluator.EvalRowCol has cognitive complexity 22 (threshold 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 · FormulaEvaluator.DbRowMatches (cognitive 22) · ×1
  • FormulaEvaluator.DbRowMatches (cognitive 22) src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:2262 — FormulaEvaluator.DbRowMatches has cognitive complexity 22 (threshold 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 · FormulaEvaluator.NumsA (cognitive 22) · ×1
  • FormulaEvaluator.NumsA (cognitive 22) src/officecli/Core/Formula/FormulaEvaluator.Helpers.cs:608 — FormulaEvaluator.NumsA has cognitive complexity 22 (threshold 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 · ParseHelpers.SanitizeColorForOoxml (cognitive 22) · ×1
  • ParseHelpers.SanitizeColorForOoxml (cognitive 22) src/officecli/Core/ParseHelpers.cs:755 — ParseHelpers.SanitizeColorForOoxml has cognitive complexity 22 (threshold 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 · PivotTableHelper.BuildDateGroupBaseCacheField (cognitive 22) · ×1
  • PivotTableHelper.BuildDateGroupBaseCacheField (cognitive 22) src/officecli/Core/PivotTableHelper.Cache.cs:632 — PivotTableHelper.BuildDateGroupBaseCacheField has cognitive complexity 22 (threshold 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 · PluginProcess.Run (cognitive 22) · ×1
  • PluginProcess.Run (cognitive 22) src/officecli/Core/Plugins/PluginProcess.cs:60 — PluginProcess.Run has cognitive complexity 22 (threshold 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 · TemplateMerger.ReplacePlaceholdersInDocx (cognitive 22) · ×1
  • TemplateMerger.ReplacePlaceholdersInDocx (cognitive 22) src/officecli/Core/TemplateMerger.cs:210 — TemplateMerger.ReplacePlaceholdersInDocx has cognitive complexity 22 (threshold 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 · WatchServer.ComputeExcelPatches (cognitive 22) · ×1
  • WatchServer.ComputeExcelPatches (cognitive 22) src/officecli/Core/Watch/WatchServer.cs:1724 — WatchServer.ComputeExcelPatches has cognitive complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. 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 · ExcelHandler.TryGetStableNumericDisplay (cognitive 22) · ×1
  • ExcelHandler.TryGetStableNumericDisplay (cognitive 22) src/officecli/Handlers/Excel/ExcelHandler.CheckNumericOverflow.cs:277 — ExcelHandler.TryGetStableNumericDisplay has cognitive complexity 22 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ExcelHandler.GetDumpShapeReplayItems (cognitive 22) · ×1
  • ExcelHandler.GetDumpShapeReplayItems (cognitive 22) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:536 — ExcelHandler.GetDumpShapeReplayItems has cognitive complexity 22 (threshold 15). 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExcelHandler.RunToNode (cognitive 22) · ×1
  • ExcelHandler.RunToNode (cognitive 22) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Node.cs:837 — ExcelHandler.RunToNode has cognitive complexity 22 (threshold 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 · ExcelHandler.ShiftColumnsRight (cognitive 22) · ×1
  • ExcelHandler.ShiftColumnsRight (cognitive 22) src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:1246 — ExcelHandler.ShiftColumnsRight has cognitive complexity 22 (threshold 15). 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 · ExcelHandler.ValidateTableIdentifierUnique (cognitive 22) · ×1
  • ExcelHandler.ValidateTableIdentifierUnique (cognitive 22) src/officecli/Handlers/Excel/ExcelHandler.Set.Tables.cs:638 — ExcelHandler.ValidateTableIdentifierUnique has cognitive complexity 22 (threshold 15). 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 · PowerPointHandler.GetConnectorStyleXmlWithOrdinal (cognitive 22) · ×1
  • PowerPointHandler.GetConnectorStyleXmlWithOrdinal (cognitive 22) REDACTED:4811 — PowerPointHandler.GetConnectorStyleXmlWithOrdinal has cognitive complexity 22 (threshold 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 · PowerPointHandler.EnumerateChartBuildSteps (cognitive 22) · ×1
  • PowerPointHandler.EnumerateChartBuildSteps (cognitive 22) src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:207 — PowerPointHandler.EnumerateChartBuildSteps has cognitive complexity 22 (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.
D2 · Cognitive Complexity · PowerPointHandler.EffectListToGlowCss (cognitive 22) · ×1
  • PowerPointHandler.EffectListToGlowCss (cognitive 22) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1204 — PowerPointHandler.EffectListToGlowCss has cognitive complexity 22 (threshold 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 · PowerPointHandler.EmitEffectiveFromResolved (cognitive 22) · ×1
  • PowerPointHandler.EmitEffectiveFromResolved (cognitive 22) src/officecli/Handlers/Pptx/PowerPointHandler.StyleList.cs:433 — PowerPointHandler.EmitEffectiveFromResolved has cognitive complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · PptxBatchEmitter.EmitAuxiliaryPartsScan (cognitive 22) · ×1
  • PptxBatchEmitter.EmitAuxiliaryPartsScan (cognitive 22) src/officecli/Handlers/Pptx/PptxBatchEmitter.AuxParts.cs:105 — PptxBatchEmitter.EmitAuxiliaryPartsScan has cognitive complexity 22 (threshold 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 · WordBatchEmitter.ReorderLvlChildren (cognitive 22) · ×1
  • WordBatchEmitter.ReorderLvlChildren (cognitive 22) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:1237 — WordBatchEmitter.ReorderLvlChildren has cognitive complexity 22 (threshold 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 · WordBatchEmitter.EmitCellSdt (cognitive 22) · ×1
  • WordBatchEmitter.EmitCellSdt (cognitive 22) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:2822 — WordBatchEmitter.EmitCellSdt has cognitive complexity 22 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.FirstContentHeaderFooterFlags (cognitive 22) · ×1
  • WordHandler.FirstContentHeaderFooterFlags (cognitive 22) REDACTED:2215 — WordHandler.FirstContentHeaderFooterFlags has cognitive complexity 22 (threshold 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 · WordHandler.SetElement (cognitive 22) · ×1
  • WordHandler.SetElement (cognitive 22) src/officecli/Handlers/Word/WordHandler.Set.cs:599 — WordHandler.SetElement has cognitive complexity 22 (threshold 15). 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 · WordHandler.SetElementTabStop (cognitive 22) · ×1
  • WordHandler.SetElementTabStop (cognitive 22) src/officecli/Handlers/Word/WordHandler.Set.Element.cs:1842 — WordHandler.SetElementTabStop has cognitive complexity 22 (threshold 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 · SchemaHelpFlatRenderer.CollectPaths (cognitive 22) · ×1
  • SchemaHelpFlatRenderer.CollectPaths (cognitive 22) src/officecli/Help/SchemaHelpFlatRenderer.cs:231 — SchemaHelpFlatRenderer.CollectPaths has cognitive complexity 22 (threshold 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 · LenientStringDictionaryConverter.Read (cognitive 21) · ×1
  • LenientStringDictionaryConverter.Read (cognitive 21) src/officecli/BatchTypes.cs:11 — LenientStringDictionaryConverter.Read has cognitive complexity 21 (threshold 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 · CommandBuilder.RejectUnknownOptionTokens (cognitive 21) · ×1
  • CommandBuilder.RejectUnknownOptionTokens (cognitive 21) src/officecli/CommandBuilder.cs:1731 — CommandBuilder.RejectUnknownOptionTokens has cognitive complexity 21 (threshold 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 · AttributeFilter.Parse (cognitive 21) · ×1
  • AttributeFilter.Parse (cognitive 21) src/officecli/Core/AttributeFilter.cs:99 — AttributeFilter.Parse has cognitive complexity 21 (threshold 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 · AttributeFilter.IsContentFilterPath (cognitive 21) · ×1
  • AttributeFilter.IsContentFilterPath (cognitive 21) src/officecli/Core/AttributeFilter.cs:1215 — AttributeFilter.IsContentFilterPath has cognitive complexity 21 (threshold 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 · FormulaEvaluator.ParseNumber (cognitive 21) · ×1
  • FormulaEvaluator.ParseNumber (cognitive 21) src/officecli/Core/Formula/FormulaEvaluator.cs:634 — FormulaEvaluator.ParseNumber has cognitive 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.
D2 · Cognitive Complexity · FormulaEvaluator.ActualActualYearFrac (cognitive 21) · ×1
  • FormulaEvaluator.ActualActualYearFrac (cognitive 21) src/officecli/Core/Formula/FormulaEvaluator.Securities.cs:86 — FormulaEvaluator.ActualActualYearFrac has cognitive 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.
D2 · Cognitive Complexity · ParseHelpers.ValidateXmlText (cognitive 21) · ×1
  • ParseHelpers.ValidateXmlText (cognitive 21) src/officecli/Core/ParseHelpers.cs:895 — ParseHelpers.ValidateXmlText has cognitive complexity 21 (threshold 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 · FormatHandlerSession.Dispose (cognitive 21) · ×1
  • FormatHandlerSession.Dispose (cognitive 21) REDACTED:316 — FormatHandlerSession.Dispose has cognitive complexity 21 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordPdfBackend.ParsePages (cognitive 21) · ×1
  • WordPdfBackend.ParsePages (cognitive 21) src/officecli/Core/WordPdfBackend.cs:346 — WordPdfBackend.ParsePages has cognitive complexity 21 (threshold 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 · ExcelHandler.AddPivotTable (cognitive 21) · ×1
  • ExcelHandler.AddPivotTable (cognitive 21) src/officecli/Handlers/Excel/ExcelHandler.Add.Tables.cs:1655 — ExcelHandler.AddPivotTable has cognitive complexity 21 (threshold 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 · ExcelHandler.AnchorToEmuRect (cognitive 21) · ×1
  • ExcelHandler.AnchorToEmuRect (cognitive 21) src/officecli/Handlers/Excel/ExcelHandler.DumpSupport.cs:717 — ExcelHandler.AnchorToEmuRect has cognitive complexity 21 (threshold 15). Of this number, 15 points are the body's own statements and 6 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 · ExcelHandler.FillUnknownDottedProps (cognitive 21) · ×1
  • ExcelHandler.FillUnknownDottedProps (cognitive 21) src/officecli/Handlers/Excel/ExcelHandler.Helpers.cs:365 — ExcelHandler.FillUnknownDottedProps has cognitive complexity 21 (threshold 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 · ExcelHandler.TrySetShapeFlip (cognitive 21) · ×1
  • ExcelHandler.TrySetShapeFlip (cognitive 21) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:1125 — ExcelHandler.TrySetShapeFlip has cognitive complexity 21 (threshold 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 · PowerPointHandler.AddRow (cognitive 21) · ×1
  • PowerPointHandler.AddRow (cognitive 21) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Table.cs:398 — PowerPointHandler.AddRow has cognitive complexity 21 (threshold 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 · PowerPointHandler.MutateBackgroundImageFill (cognitive 21) · ×1
  • PowerPointHandler.MutateBackgroundImageFill (cognitive 21) src/officecli/Handlers/Pptx/PowerPointHandler.Background.cs:366 — PowerPointHandler.MutateBackgroundImageFill has cognitive complexity 21 (threshold 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 · PowerPointHandler.SetAdvanceTime (cognitive 21) · ×1
  • PowerPointHandler.SetAdvanceTime (cognitive 21) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Transition.cs:44 — PowerPointHandler.SetAdvanceTime has cognitive complexity 21 (threshold 15). Of this number, 20 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 · PowerPointHandler.RenderLayoutPlaceholders (cognitive 21) · ×1
  • PowerPointHandler.RenderLayoutPlaceholders (cognitive 21) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.cs:742 — PowerPointHandler.RenderLayoutPlaceholders has cognitive complexity 21 (threshold 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 · PowerPointHandler.GetDefaultPlaceholderPosition (cognitive 21) · ×1
  • PowerPointHandler.GetDefaultPlaceholderPosition (cognitive 21) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:931 — PowerPointHandler.GetDefaultPlaceholderPosition has cognitive complexity 21 (threshold 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 · PowerPointHandler.AggregateTableOuterBorders (cognitive 21) · ×1
  • PowerPointHandler.AggregateTableOuterBorders (cognitive 21) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:3532 — PowerPointHandler.AggregateTableOuterBorders has cognitive complexity 21 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · PowerPointHandler.ResolveInheritedDirection (cognitive 21) · ×1
  • PowerPointHandler.ResolveInheritedDirection (cognitive 21) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:3624 — PowerPointHandler.ResolveInheritedDirection has cognitive complexity 21 (threshold 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 · PowerPointHandler.RenderPictureSvg (cognitive 21) · ×1
  • PowerPointHandler.RenderPictureSvg (cognitive 21) src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:898 — PowerPointHandler.RenderPictureSvg has cognitive complexity 21 (threshold 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 · PptxBatchEmitter.EmitPlaceholder (cognitive 21) · ×1
  • PptxBatchEmitter.EmitPlaceholder (cognitive 21) src/officecli/Handlers/Pptx/PptxBatchEmitter.Shape.cs:392 — PptxBatchEmitter.EmitPlaceholder has cognitive complexity 21 (threshold 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 · PptxBatchEmitter.EmitGroup (cognitive 21) · ×1
  • PptxBatchEmitter.EmitGroup (cognitive 21) src/officecli/Handlers/Pptx/PptxBatchEmitter.Shape.cs:739 — PptxBatchEmitter.EmitGroup has cognitive complexity 21 (threshold 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 · WordHandler.AddFlowTable (cognitive 21) · ×1
  • WordHandler.AddFlowTable (cognitive 21) src/officecli/Handlers/Word/WordHandler.Add.Markdown.cs:417 — WordHandler.AddFlowTable has cognitive complexity 21 (threshold 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 · WordHandler.HeaderFooterHasContent (cognitive 21) · ×1
  • WordHandler.HeaderFooterHasContent (cognitive 21) REDACTED:2238 — WordHandler.HeaderFooterHasContent has cognitive complexity 21 (threshold 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 · WordHandler.ResolveTabStopsFromStyle (cognitive 21) · ×1
  • WordHandler.ResolveTabStopsFromStyle (cognitive 21) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:988 — WordHandler.ResolveTabStopsFromStyle has cognitive complexity 21 (threshold 15). Of this number, 20 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 · WordHandler.GetCjkFontFallback (cognitive 21) · ×1
  • WordHandler.GetCjkFontFallback (cognitive 21) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:3357 — WordHandler.GetCjkFontFallback has cognitive complexity 21 (threshold 15). 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 · WordHandler.BuildListMarkerCss (cognitive 21) · ×1
  • WordHandler.BuildListMarkerCss (cognitive 21) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Markers.cs:23 — WordHandler.BuildListMarkerCss has cognitive complexity 21 (threshold 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 · WordHandler.ParseTableLook (cognitive 21) · ×1
  • WordHandler.ParseTableLook (cognitive 21) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Tables.cs:838 — WordHandler.ParseTableLook has cognitive complexity 21 (threshold 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 · WordHandler.BookmarkStartToNode (cognitive 21) · ×1
  • WordHandler.BookmarkStartToNode (cognitive 21) src/officecli/Handlers/Word/WordHandler.Navigation.cs:1930 — WordHandler.BookmarkStartToNode has cognitive complexity 21 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.ParseSingleSelector (cognitive 21) · ×1
  • WordHandler.ParseSingleSelector (cognitive 21) src/officecli/Handlers/Word/WordHandler.Selector.cs:56 — WordHandler.ParseSingleSelector has cognitive complexity 21 (threshold 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 · WordHandler.SetRevisionsBySelector (cognitive 21) · ×1
  • WordHandler.SetRevisionsBySelector (cognitive 21) src/officecli/Handlers/Word/WordHandler.Set.Revision.cs:836 — WordHandler.SetRevisionsBySelector has cognitive complexity 21 (threshold 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 · WordHandler.MatchesFilter (cognitive 21) · ×1
  • WordHandler.MatchesFilter (cognitive 21) src/officecli/Handlers/Word/WordHandler.Set.Revision.cs:1120 — WordHandler.MatchesFilter has cognitive complexity 21 (threshold 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 · install-binary.detectAsset (cognitive 21) · ×1
  • install-binary.detectAsset (cognitive 21) npm/lib/install-binary.js:63 — install-binary.detectAsset has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (15 pts), ternaries 2 (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 · index.ensureCliBinary (cognitive 21) · ×1
  • index.ensureCliBinary (cognitive 21) sdk/node/index.js:346 — index.ensureCliBinary has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (13 pts), error handling 2 (4 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 · BatchItemConverter.Read (cognitive 20) · ×1
  • BatchItemConverter.Read (cognitive 20) src/officecli/BatchTypes.cs:71 — BatchItemConverter.Read has cognitive complexity 20 (threshold 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 · BatchItem.ToResidentRequest (cognitive 20) · ×1
  • BatchItem.ToResidentRequest (cognitive 20) src/officecli/BatchTypes.cs:204 — BatchItem.ToResidentRequest has cognitive complexity 20 (threshold 15). 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 · CommandBuilder.TryStartResidentProcess (cognitive 20) · ×1
  • CommandBuilder.TryStartResidentProcess (cognitive 20) src/officecli/CommandBuilder.cs:233 — CommandBuilder.TryStartResidentProcess has cognitive complexity 20 (threshold 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 · CommandBuilder.DetectUnmatchedKeyValues (cognitive 20) · ×1
  • CommandBuilder.DetectUnmatchedKeyValues (cognitive 20) src/officecli/CommandBuilder.cs:1661 — CommandBuilder.DetectUnmatchedKeyValues has cognitive complexity 20 (threshold 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 · CommandBuilder.SuggestPropertyWithDistance (cognitive 20) · ×1
  • CommandBuilder.SuggestPropertyWithDistance (cognitive 20) src/officecli/CommandBuilder.cs:1895 — CommandBuilder.SuggestPropertyWithDistance has cognitive complexity 20 (threshold 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 · CommandBuilder.GetSelectedAction (cognitive 20) · ×1
  • CommandBuilder.GetSelectedAction (cognitive 20) src/officecli/CommandBuilder.GetQuery.cs:112 — CommandBuilder.GetSelectedAction has cognitive complexity 20 (threshold 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 · CommandBuilder.BuildImportCommand (cognitive 20) · ×1
  • CommandBuilder.BuildImportCommand (cognitive 20) src/officecli/CommandBuilder.Import.cs:12 — CommandBuilder.BuildImportCommand has cognitive complexity 20 (threshold 15). None of this is in the body itself: all 20 points belong to one function literal inside it that branches (line 40). 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 · ChartHelper.BuildFillElement (cognitive 20) · ×1
  • ChartHelper.BuildFillElement (cognitive 20) src/officecli/Core/Chart/ChartHelper.Builder.cs:1610 — ChartHelper.BuildFillElement has cognitive complexity 20 (threshold 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 · FormulaEvaluator.ExcludeNestedSubtotalCells (cognitive 20) · ×1
  • FormulaEvaluator.ExcludeNestedSubtotalCells (cognitive 20) src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:542 — FormulaEvaluator.ExcludeNestedSubtotalCells has cognitive complexity 20 (threshold 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 · FormulaEvaluator.EvalTextBeforeAfter (cognitive 20) · ×1
  • FormulaEvaluator.EvalTextBeforeAfter (cognitive 20) src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:737 — FormulaEvaluator.EvalTextBeforeAfter has cognitive complexity 20 (threshold 15). 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 · FormulaEvaluator.ApproximateMatchVector (cognitive 20) · ×1
  • FormulaEvaluator.ApproximateMatchVector (cognitive 20) src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:1285 — FormulaEvaluator.ApproximateMatchVector has cognitive complexity 20 (threshold 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 · FormulaEvaluator.EvalDatabase (cognitive 20) · ×1
  • FormulaEvaluator.EvalDatabase (cognitive 20) src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:2200 — FormulaEvaluator.EvalDatabase has cognitive 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FormulaEvaluator.EvalMdeterm (cognitive 20) · ×1
  • FormulaEvaluator.EvalMdeterm (cognitive 20) src/officecli/Core/Formula/FormulaEvaluator.Helpers.cs:488 — FormulaEvaluator.EvalMdeterm has cognitive complexity 20 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · GenericXmlQuery.ElementToNode (cognitive 20) · ×1
  • GenericXmlQuery.ElementToNode (cognitive 20) REDACTED:172 — GenericXmlQuery.ElementToNode has cognitive complexity 20 (threshold 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 · PivotTableHelper.ReadFieldValueIndexFromCache (cognitive 20) · ×1
  • PivotTableHelper.ReadFieldValueIndexFromCache (cognitive 20) src/officecli/Core/PivotTableHelper.Cache.cs:367 — PivotTableHelper.ReadFieldValueIndexFromCache has cognitive complexity 20 (threshold 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 · PivotTableHelper.BuildCacheField (cognitive 20) · ×1
  • PivotTableHelper.BuildCacheField (cognitive 20) src/officecli/Core/PivotTableHelper.Cache.cs:532 — PivotTableHelper.BuildCacheField has cognitive complexity 20 (threshold 15). Of this number, 16 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 · PivotTableHelper.ReadColumnDataFromCache (cognitive 20) · ×1
  • PivotTableHelper.ReadColumnDataFromCache (cognitive 20) src/officecli/Core/PivotTableHelper.cs:1921 — PivotTableHelper.ReadColumnDataFromCache has cognitive complexity 20 (threshold 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 · SelectorCommaSplit.TopLevelIndexOf (cognitive 20) · ×1
  • SelectorCommaSplit.TopLevelIndexOf (cognitive 20) src/officecli/Core/SelectorCommaSplit.cs:31 — SelectorCommaSplit.TopLevelIndexOf has cognitive complexity 20 (threshold 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. This shape REPEATS in the file: one other method here (SelectorCommaSplit.SplitTopLevelCommas) 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 · SelectorCommaSplit.SplitTopLevelCommas (cognitive 20) · ×1
  • SelectorCommaSplit.SplitTopLevelCommas (cognitive 20) src/officecli/Core/SelectorCommaSplit.cs:54 — SelectorCommaSplit.SplitTopLevelCommas has cognitive complexity 20 (threshold 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. This shape REPEATS in the file: one other method here (SelectorCommaSplit.TopLevelIndexOf) 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 · SvgImageHelper.TryGetSvgDimensions (cognitive 20) · ×1
  • SvgImageHelper.TryGetSvgDimensions (cognitive 20) src/officecli/Core/SvgImageHelper.cs:109 — SvgImageHelper.TryGetSvgDimensions has cognitive complexity 20 (threshold 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 · ExcelBatchEmitter.EmitValueBaseline (cognitive 20) · ×1
  • ExcelBatchEmitter.EmitValueBaseline (cognitive 20) src/officecli/Handlers/Excel/ExcelBatchEmitter.cs:631 — ExcelBatchEmitter.EmitValueBaseline has cognitive complexity 20 (threshold 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 · ExcelBatchEmitter.EmitConditionalFormats (cognitive 20) · ×1
  • ExcelBatchEmitter.EmitConditionalFormats (cognitive 20) src/officecli/Handlers/Excel/ExcelBatchEmitter.Elements.cs:147 — ExcelBatchEmitter.EmitConditionalFormats has cognitive complexity 20 (threshold 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 · ExcelHandler.CommentToNode (cognitive 20) · ×1
  • ExcelHandler.CommentToNode (cognitive 20) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Node.cs:1095 — ExcelHandler.CommentToNode has cognitive complexity 20 (threshold 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 · ExcelHandler.ResolveChartDataFromCells (cognitive 20) · ×1
  • ExcelHandler.ResolveChartDataFromCells (cognitive 20) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.Charts.cs:314 — ExcelHandler.ResolveChartDataFromCells has cognitive complexity 20 (threshold 15). 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 · ExcelHandler.RowKeyCollidesWithColumn (cognitive 20) · ×1
  • ExcelHandler.RowKeyCollidesWithColumn (cognitive 20) src/officecli/Handlers/Excel/ExcelHandler.Query.RowWhere.cs:544 — ExcelHandler.RowKeyCollidesWithColumn has cognitive complexity 20 (threshold 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 · ExcelHandler.AddSlicerDrawingAnchor (cognitive 20) · ×1
  • ExcelHandler.AddSlicerDrawingAnchor (cognitive 20) src/officecli/Handlers/Excel/ExcelHandler.Slicer.cs:628 — ExcelHandler.AddSlicerDrawingAnchor has cognitive complexity 20 (threshold 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 · ExcelHandler.ResolveChartFormulaValues (cognitive 20) · ×1
  • ExcelHandler.ResolveChartFormulaValues (cognitive 20) src/officecli/Handlers/Excel/ExcelHandler.View.cs:1044 — ExcelHandler.ResolveChartFormulaValues has cognitive complexity 20 (threshold 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 · PowerPointHandler.AddDiagramAsImage (cognitive 20) · ×1
  • PowerPointHandler.AddDiagramAsImage (cognitive 20) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Diagram.cs:192 — PowerPointHandler.AddDiagramAsImage has cognitive complexity 20 (threshold 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 · PowerPointHandler.FitAddedTextShapeToLayout (cognitive 20) · ×1
  • PowerPointHandler.FitAddedTextShapeToLayout (cognitive 20) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Slide.cs:161 — PowerPointHandler.FitAddedTextShapeToLayout has cognitive complexity 20 (threshold 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 · PowerPointHandler.DistributeShapes (cognitive 20) · ×1
  • PowerPointHandler.DistributeShapes (cognitive 20) src/officecli/Handlers/Pptx/PowerPointHandler.Align.cs:92 — PowerPointHandler.DistributeShapes has cognitive complexity 20 (threshold 15). Of this number, 18 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 · PowerPointHandler.AutoPrefixMorphNames (cognitive 20) · ×1
  • PowerPointHandler.AutoPrefixMorphNames (cognitive 20) src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:3052 — PowerPointHandler.AutoPrefixMorphNames has cognitive complexity 20 (threshold 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 · PowerPointHandler.ReadSlideHeaderFooter (cognitive 20) · ×1
  • PowerPointHandler.ReadSlideHeaderFooter (cognitive 20) src/officecli/Handlers/Pptx/PowerPointHandler.Background.cs:507 — PowerPointHandler.ReadSlideHeaderFooter has cognitive complexity 20 (threshold 15). 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PowerPointHandler.LevelBackgroundCss (cognitive 20) · ×1
  • PowerPointHandler.LevelBackgroundCss (cognitive 20) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.cs:460 — PowerPointHandler.LevelBackgroundCss has cognitive complexity 20 (threshold 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 · PowerPointHandler.CustomGeometryToSvgPaths (cognitive 20) · ×1
  • PowerPointHandler.CustomGeometryToSvgPaths (cognitive 20) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:393 — PowerPointHandler.CustomGeometryToSvgPaths has cognitive complexity 20 (threshold 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 · PowerPointHandler.EffectListToShadowCss (cognitive 20) · ×1
  • PowerPointHandler.EffectListToShadowCss (cognitive 20) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1095 — PowerPointHandler.EffectListToShadowCss has cognitive complexity 20 (threshold 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 · PowerPointHandler.ResolveHyperlinkTarget (cognitive 20) · ×1
  • PowerPointHandler.ResolveHyperlinkTarget (cognitive 20) src/officecli/Handlers/Pptx/PowerPointHandler.Hyperlinks.cs:33 — PowerPointHandler.ResolveHyperlinkTarget has cognitive complexity 20 (threshold 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 · PowerPointHandler.CopyFromCore (cognitive 20) · ×1
  • PowerPointHandler.CopyFromCore (cognitive 20) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1196 — PowerPointHandler.CopyFromCore has cognitive complexity 20 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.MoveTableRow (cognitive 20) · ×1
  • PowerPointHandler.MoveTableRow (cognitive 20) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1290 — PowerPointHandler.MoveTableRow has cognitive complexity 20 (threshold 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 · PowerPointHandler.EnumerateShapeAnimationCTns (cognitive 20) · ×1
  • PowerPointHandler.EnumerateShapeAnimationCTns (cognitive 20) REDACTED:2382 — PowerPointHandler.EnumerateShapeAnimationCTns has cognitive complexity 20 (threshold 15). Of this number, 15 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 · PowerPointHandler.ResolveChart (cognitive 20) · ×1
  • PowerPointHandler.ResolveChart (cognitive 20) src/officecli/Handlers/Pptx/PowerPointHandler.Resolve.cs:54 — PowerPointHandler.ResolveChart has cognitive complexity 20 (threshold 15). Of this number, 17 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 · PowerPointHandler.ResolveLogicalPath (cognitive 20) · ×1
  • PowerPointHandler.ResolveLogicalPath (cognitive 20) src/officecli/Handlers/Pptx/PowerPointHandler.Resolve.cs:158 — PowerPointHandler.ResolveLogicalPath has cognitive complexity 20 (threshold 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 · PowerPointHandler.ApplyMasterLayoutShapeOrSelfProperties (cognitive 20) · ×1
  • PowerPointHandler.ApplyMasterLayoutShapeOrSelfProperties (cognitive 20) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Slide.cs:126 — PowerPointHandler.ApplyMasterLayoutShapeOrSelfProperties has cognitive complexity 20 (threshold 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 · WordBatchEmitter.GetCellCrossParagraphFieldParaOrdinals (cognitive 20) · ×1
  • WordBatchEmitter.GetCellCrossParagraphFieldParaOrdinals (cognitive 20) src/officecli/Handlers/Word/WordBatchEmitter.Table.cs:1485 — WordBatchEmitter.GetCellCrossParagraphFieldParaOrdinals has cognitive complexity 20 (threshold 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 · WordHandler.BodySectionPageGeometryTwips (cognitive 20) · ×1
  • WordHandler.BodySectionPageGeometryTwips (cognitive 20) src/officecli/Handlers/Word/WordHandler.Add.cs:1077 — WordHandler.BodySectionPageGeometryTwips has cognitive complexity 20 (threshold 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 · WordHandler.CountFlattenedReferences (cognitive 20) · ×1
  • WordHandler.CountFlattenedReferences (cognitive 20) src/officecli/Handlers/Word/WordHandler.Add.Markdown.cs:379 — WordHandler.CountFlattenedReferences has cognitive complexity 20 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · WordHandler.BuildMovePairIdMap (cognitive 20) · ×1
  • WordHandler.BuildMovePairIdMap (cognitive 20) src/officecli/Handlers/Word/WordHandler.Helpers.Field.cs:522 — WordHandler.BuildMovePairIdMap has cognitive complexity 20 (threshold 15). 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 · WordHandler.AddAtFindPosition (cognitive 20) · ×1
  • WordHandler.AddAtFindPosition (cognitive 20) src/officecli/Handlers/Word/WordHandler.Helpers.FindReplace.cs:1027 — WordHandler.AddAtFindPosition has cognitive complexity 20 (threshold 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 · WordHandler.RenderChartExHtml (cognitive 20) · ×1
  • WordHandler.RenderChartExHtml (cognitive 20) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Charts.cs:122 — WordHandler.RenderChartExHtml has cognitive complexity 20 (threshold 15). 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 · WordHandler.ResolveRunLineHeightCss (cognitive 20) · ×1
  • WordHandler.ResolveRunLineHeightCss (cognitive 20) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:1524 — WordHandler.ResolveRunLineHeightCss has cognitive complexity 20 (threshold 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 · WordHandler.ResolveStyleParagraphBorders (cognitive 20) · ×1
  • WordHandler.ResolveStyleParagraphBorders (cognitive 20) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:2958 — WordHandler.ResolveStyleParagraphBorders has cognitive complexity 20 (threshold 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 · WordHandler.RenderDrawingHtml (cognitive 20) · ×1
  • WordHandler.RenderDrawingHtml (cognitive 20) REDACTED:141 — WordHandler.RenderDrawingHtml has cognitive 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, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.GuardColumnSlotAddressable (cognitive 20) · ×1
  • WordHandler.GuardColumnSlotAddressable (cognitive 20) src/officecli/Handlers/Word/WordHandler.Mutations.cs:2589 — WordHandler.GuardColumnSlotAddressable has cognitive complexity 20 (threshold 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 · WordHandler.TokenizeFieldInstruction (cognitive 20) · ×1
  • WordHandler.TokenizeFieldInstruction (cognitive 20) src/officecli/Handlers/Word/WordHandler.SeqEval.cs:123 — WordHandler.TokenizeFieldInstruction has cognitive complexity 20 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · WordHandler.ViewAsOutline (cognitive 20) · ×1
  • WordHandler.ViewAsOutline (cognitive 20) src/officecli/Handlers/Word/WordHandler.View.cs:752 — WordHandler.ViewAsOutline has cognitive 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WordHandler.RawEmbedBinary (cognitive 20) · ×1
  • WordHandler.RawEmbedBinary (cognitive 20) src/officecli/Handlers/WordHandler.cs:2104 — WordHandler.RawEmbedBinary has cognitive complexity 20 (threshold 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 · McpInstaller.InstallJson (cognitive 20) · ×1
  • McpInstaller.InstallJson (cognitive 20) src/officecli/McpInstaller.cs:304 — McpInstaller.InstallJson has cognitive complexity 20 (threshold 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 · morph-helpers.morph_verify_slide (cognitive 20) · ×1
  • morph-helpers.morph_verify_slide (cognitive 20) skills/morph-ppt/reference/morph-helpers.py:211 — morph-helpers.morph_verify_slide has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (10 pts), loops 2 (6 pts), error handling 2 (4 pts) (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · AttributeFilter.ApplyWithWarnings (cognitive 19) · ×1
  • AttributeFilter.ApplyWithWarnings (cognitive 19) src/officecli/Core/AttributeFilter.cs:231 — AttributeFilter.ApplyWithWarnings has cognitive complexity 19 (threshold 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 · GalleryIndex.LoadFromEmbeddedResource (cognitive 19) · ×1
  • GalleryIndex.LoadFromEmbeddedResource (cognitive 19) src/officecli/Core/Chart/ChartExStyleBuilder.cs:286 — GalleryIndex.LoadFromEmbeddedResource has cognitive complexity 19 (threshold 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 · ChartHelper.ParseSeriesData (cognitive 19) · ×1
  • ChartHelper.ParseSeriesData (cognitive 19) src/officecli/Core/Chart/ChartHelper.cs:215 — ChartHelper.ParseSeriesData has cognitive 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChartHelper.ParseSeriesColors (cognitive 19) · ×1
  • ChartHelper.ParseSeriesColors (cognitive 19) src/officecli/Core/Chart/ChartHelper.cs:571 — ChartHelper.ParseSeriesColors has cognitive complexity 19 (threshold 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 · FontMetricsReader.BuildFamilyIndex (cognitive 19) · ×1
  • FontMetricsReader.BuildFamilyIndex (cognitive 19) src/officecli/Core/FontMetricsReader.cs:213 — FontMetricsReader.BuildFamilyIndex has cognitive complexity 19 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · FormulaParser.ParseGroup (cognitive 19) · ×1
  • FormulaParser.ParseGroup (cognitive 19) src/officecli/Core/Formula/FormulaParser.cs:1097 — FormulaParser.ParseGroup has cognitive complexity 19 (threshold 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 · GenericXmlQuery.ParsePathSegments (cognitive 19) · ×1
  • GenericXmlQuery.ParsePathSegments (cognitive 19) REDACTED:237 — GenericXmlQuery.ParsePathSegments has cognitive complexity 19 (threshold 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 · Installer.MaybeAutoInstall (cognitive 19) · ×1
  • Installer.MaybeAutoInstall (cognitive 19) src/officecli/Core/Installer.cs:254 — Installer.MaybeAutoInstall has cognitive complexity 19 (threshold 15). 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 · ParseHelpers.IsCjkOrFullWidth (cognitive 19) · ×1
  • ParseHelpers.IsCjkOrFullWidth (cognitive 19) src/officecli/Core/ParseHelpers.cs:846 — ParseHelpers.IsCjkOrFullWidth has cognitive complexity 19 (threshold 15). 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 · PivotTableHelper.NormalizeRenderedSheetData (cognitive 19) · ×1
  • PivotTableHelper.NormalizeRenderedSheetData (cognitive 19) src/officecli/Core/PivotTableHelper.Render.cs:54 — PivotTableHelper.NormalizeRenderedSheetData has cognitive complexity 19 (threshold 15). Of this number, 15 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · DumpReaderInvoker.Run (cognitive 19) · ×1
  • DumpReaderInvoker.Run (cognitive 19) src/officecli/Core/Plugins/DumpReaderInvoker.cs:35 — DumpReaderInvoker.Run has cognitive complexity 19 (threshold 15). 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 · RawXmlHelper.EnsureMcIgnorableForChoiceRequires (cognitive 19) · ×1
  • RawXmlHelper.EnsureMcIgnorableForChoiceRequires (cognitive 19) src/officecli/Core/RawXmlHelper.cs:368 — RawXmlHelper.EnsureMcIgnorableForChoiceRequires has cognitive 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WatchServer.ResolveMark (cognitive 19) · ×1
  • WatchServer.ResolveMark (cognitive 19) src/officecli/Core/Watch/WatchServer.cs:1217 — WatchServer.ResolveMark has cognitive complexity 19 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ExcelBatchEmitter.EmitPictures (cognitive 19) · ×1
  • ExcelBatchEmitter.EmitPictures (cognitive 19) src/officecli/Handlers/Excel/ExcelBatchEmitter.Elements.cs:531 — ExcelBatchEmitter.EmitPictures has cognitive complexity 19 (threshold 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 · ExcelHandler.PopulateChartPositionFormat (cognitive 19) · ×1
  • ExcelHandler.PopulateChartPositionFormat (cognitive 19) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Chart.cs:67 — ExcelHandler.PopulateChartPositionFormat has cognitive 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, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. 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 · ExcelHandler.ApplyTransform2DRotationFlip (cognitive 19) · ×1
  • ExcelHandler.ApplyTransform2DRotationFlip (cognitive 19) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:245 — ExcelHandler.ApplyTransform2DRotationFlip has cognitive complexity 19 (threshold 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 · ExcelHandler.BuildMergeMap (cognitive 19) · ×1
  • ExcelHandler.BuildMergeMap (cognitive 19) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:1110 — ExcelHandler.BuildMergeMap has cognitive complexity 19 (threshold 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 · ExcelHandler.InvalidateFormulaCacheReferencingSheet (cognitive 19) · ×1
  • ExcelHandler.InvalidateFormulaCacheReferencingSheet (cognitive 19) src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:1829 — ExcelHandler.InvalidateFormulaCacheReferencingSheet has cognitive complexity 19 (threshold 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 · PowerPointHandler.AddModel3D (cognitive 19) · ×1
  • PowerPointHandler.AddModel3D (cognitive 19) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Model3D.cs:20 — PowerPointHandler.AddModel3D has cognitive complexity 19 (threshold 15). 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 · PowerPointHandler.GetShapeText (cognitive 19) · ×1
  • PowerPointHandler.GetShapeText (cognitive 19) REDACTED:109 — PowerPointHandler.GetShapeText has cognitive complexity 19 (threshold 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 · PowerPointHandler.RenderInheritedShape (cognitive 19) · ×1
  • PowerPointHandler.RenderInheritedShape (cognitive 19) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.cs:857 — PowerPointHandler.RenderInheritedShape has cognitive complexity 19 (threshold 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 · PowerPointHandler.ReadHyperlinkOnClickUrl (cognitive 19) · ×1
  • PowerPointHandler.ReadHyperlinkOnClickUrl (cognitive 19) src/officecli/Handlers/Pptx/PowerPointHandler.Hyperlinks.cs:327 — PowerPointHandler.ReadHyperlinkOnClickUrl has cognitive complexity 19 (threshold 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 · WordBatchEmitter.TryEmitBookmarkRun (cognitive 19) · ×1
  • WordBatchEmitter.TryEmitBookmarkRun (cognitive 19) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:1383 — WordBatchEmitter.TryEmitBookmarkRun has cognitive complexity 19 (threshold 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 · WordBatchEmitter.TryEmitBreakRun (cognitive 19) · ×1
  • WordBatchEmitter.TryEmitBreakRun (cognitive 19) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:1507 — WordBatchEmitter.TryEmitBreakRun has cognitive complexity 19 (threshold 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 · WordBatchEmitter.EnumerateSdtContentDirectChildren (cognitive 19) · ×1
  • WordBatchEmitter.EnumerateSdtContentDirectChildren (cognitive 19) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:2524 — WordBatchEmitter.EnumerateSdtContentDirectChildren has cognitive complexity 19 (threshold 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 · WordHandler.AttachChartSidecars (cognitive 19) · ×1
  • WordHandler.AttachChartSidecars (cognitive 19) src/officecli/Handlers/Word/WordHandler.Add.Media.cs:198 — WordHandler.AttachChartSidecars has cognitive complexity 19 (threshold 15). Of this number, 15 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 · WordHandler.AddInlinedPartsRun (cognitive 19) · ×1
  • WordHandler.AddInlinedPartsRun (cognitive 19) src/officecli/Handlers/Word/WordHandler.Add.Media.cs:896 — WordHandler.AddInlinedPartsRun has cognitive complexity 19 (threshold 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 · WordHandler.BuildShadowXml (cognitive 19) · ×1
  • WordHandler.BuildShadowXml (cognitive 19) src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:3543 — WordHandler.BuildShadowXml has cognitive complexity 19 (threshold 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 · WordHandler.ApplyNoteSeedRevision (cognitive 19) · ×1
  • WordHandler.ApplyNoteSeedRevision (cognitive 19) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:675 — WordHandler.ApplyNoteSeedRevision has cognitive complexity 19 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · WordHandler.AddTab (cognitive 19) · ×1
  • WordHandler.AddTab (cognitive 19) src/officecli/Handlers/Word/WordHandler.Add.Text.cs:3276 — WordHandler.AddTab has cognitive complexity 19 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · WordHandler.ApplyWordChartPositionSet (cognitive 19) · ×1
  • WordHandler.ApplyWordChartPositionSet (cognitive 19) src/officecli/Handlers/Word/WordHandler.Helpers.Chart.cs:141 — WordHandler.ApplyWordChartPositionSet has cognitive complexity 19 (threshold 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 · WordHandler.AddInlineAtSplitPoint (cognitive 19) · ×1
  • WordHandler.AddInlineAtSplitPoint (cognitive 19) src/officecli/Handlers/Word/WordHandler.Helpers.FindReplace.cs:1161 — WordHandler.AddInlineAtSplitPoint has cognitive complexity 19 (threshold 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 · WordHandler.ApplyTabsShorthand (cognitive 19) · ×1
  • WordHandler.ApplyTabsShorthand (cognitive 19) src/officecli/Handlers/Word/WordHandler.Helpers.RunFormat.cs:129 — WordHandler.ApplyTabsShorthand has cognitive complexity 19 (threshold 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 · WordHandler.RenderGroupHtml (cognitive 19) · ×1
  • WordHandler.RenderGroupHtml (cognitive 19) REDACTED:739 — WordHandler.RenderGroupHtml has cognitive complexity 19 (threshold 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 · WordHandler.ResolveTableStyleCellMargin (cognitive 19) · ×1
  • WordHandler.ResolveTableStyleCellMargin (cognitive 19) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Tables.cs:736 — WordHandler.ResolveTableStyleCellMargin has cognitive complexity 19 (threshold 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 · WordHandler.CopyTableColumn (cognitive 19) · ×1
  • WordHandler.CopyTableColumn (cognitive 19) src/officecli/Handlers/Word/WordHandler.Mutations.cs:2729 — WordHandler.CopyTableColumn has cognitive complexity 19 (threshold 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 · WordHandler.CollectFieldsFrom (cognitive 19) · ×1
  • WordHandler.CollectFieldsFrom (cognitive 19) src/officecli/Handlers/Word/WordHandler.Query.cs:1382 — WordHandler.CollectFieldsFrom has cognitive complexity 19 (threshold 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 · WordHandler.ResolveNumPrFromStyle (cognitive 19) · ×1
  • WordHandler.ResolveNumPrFromStyle (cognitive 19) src/officecli/Handlers/Word/WordHandler.StyleList.cs:799 — WordHandler.ResolveNumPrFromStyle has cognitive complexity 19 (threshold 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 · ResidentServer.HandlePingRequestAsync (cognitive 19) · ×1
  • ResidentServer.HandlePingRequestAsync (cognitive 19) src/officecli/ResidentServer.cs:609 — ResidentServer.HandlePingRequestAsync has cognitive complexity 19 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · CommandBuilder.BuildValidateCommand (cognitive 18) · ×1
  • CommandBuilder.BuildValidateCommand (cognitive 18) src/officecli/CommandBuilder.Check.cs:12 — CommandBuilder.BuildValidateCommand has cognitive complexity 18 (threshold 15). None of this is in the body itself: all 18 points belong to one function literal inside it that branches (line 18). 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 · CommandBuilder.BuildGetCommand (cognitive 18) · ×1
  • CommandBuilder.BuildGetCommand (cognitive 18) src/officecli/CommandBuilder.GetQuery.cs:12 — CommandBuilder.BuildGetCommand has cognitive complexity 18 (threshold 15). None of this is in the body itself: all 18 points belong to 2 function literals inside it that branch (lines 28, 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 · CommandBuilder.BuildGotoCommand (cognitive 18) · ×1
  • CommandBuilder.BuildGotoCommand (cognitive 18) src/officecli/CommandBuilder.Goto.cs:23 — CommandBuilder.BuildGotoCommand has cognitive complexity 18 (threshold 15). None of this is in the body itself: all 18 points belong to one function literal inside it that branches (line 34). 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 · ExprParser.ParsePredicate (cognitive 18) · ×1
  • ExprParser.ParsePredicate (cognitive 18) src/officecli/Core/AttributeFilter.cs:1354 — ExprParser.ParsePredicate has cognitive complexity 18 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ChartHelper.SeriesWithNoCapturedFill (cognitive 18) · ×1
  • ChartHelper.SeriesWithNoCapturedFill (cognitive 18) src/officecli/Core/Chart/ChartHelper.cs:532 — ChartHelper.SeriesWithNoCapturedFill has cognitive complexity 18 (threshold 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 · ChartHelper.AddSeries (cognitive 18) · ×1
  • ChartHelper.AddSeries (cognitive 18) src/officecli/Core/Chart/ChartHelper.Setter.cs:22 — ChartHelper.AddSeries has cognitive complexity 18 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ChartSvgRenderer.ExtractDeletedLabels (cognitive 18) · ×1
  • ChartSvgRenderer.ExtractDeletedLabels (cognitive 18) src/officecli/Core/Chart/ChartSvgRenderer.cs:4273 — ChartSvgRenderer.ExtractDeletedLabels has cognitive complexity 18 (threshold 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 · MermaidImageRenderer.ComposeSource (cognitive 18) · ×1
  • MermaidImageRenderer.ComposeSource (cognitive 18) src/officecli/Core/Diagram/MermaidImageRenderer.cs:124 — MermaidImageRenderer.ComposeSource has cognitive complexity 18 (threshold 15). 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 · ExcelStyleManager.GetOrCreatePatternFill (cognitive 18) · ×1
  • ExcelStyleManager.GetOrCreatePatternFill (cognitive 18) src/officecli/Core/ExcelStyleManager.cs:1354 — ExcelStyleManager.GetOrCreatePatternFill has cognitive complexity 18 (threshold 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 · FormulaEvaluator.ParseUnary (cognitive 18) · ×1
  • FormulaEvaluator.ParseUnary (cognitive 18) src/officecli/Core/Formula/FormulaEvaluator.cs:970 — FormulaEvaluator.ParseUnary has cognitive complexity 18 (threshold 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 · FormulaEvaluator.EvalIf (cognitive 18) · ×1
  • FormulaEvaluator.EvalIf (cognitive 18) src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:632 — FormulaEvaluator.EvalIf has cognitive complexity 18 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · FormulaEvaluator.MatchesCriteria (cognitive 18) · ×1
  • FormulaEvaluator.MatchesCriteria (cognitive 18) src/officecli/Core/Formula/FormulaEvaluator.Helpers.cs:99 — FormulaEvaluator.MatchesCriteria has cognitive complexity 18 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · FormulaEvaluator.BuildRefFromRange (cognitive 18) · ×1
  • FormulaEvaluator.BuildRefFromRange (cognitive 18) src/officecli/Core/Formula/FormulaEvaluator.References.cs:22 — FormulaEvaluator.BuildRefFromRange has cognitive complexity 18 (threshold 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 · PivotTableHelper.BuildAxisTree (cognitive 18) · ×1
  • PivotTableHelper.BuildAxisTree (cognitive 18) src/officecli/Core/PivotTableHelper.cs:1512 — PivotTableHelper.BuildAxisTree has cognitive complexity 18 (threshold 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 · PivotTableHelper.ReadExistingStringAtOrDefault (cognitive 18) · ×1
  • PivotTableHelper.ReadExistingStringAtOrDefault (cognitive 18) src/officecli/Core/PivotTableHelper.Render.cs:2603 — PivotTableHelper.ReadExistingStringAtOrDefault has cognitive complexity 18 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · SvgImageHelper.GetSvgRelId (cognitive 18) · ×1
  • SvgImageHelper.GetSvgRelId (cognitive 18) src/officecli/Core/SvgImageHelper.cs:79 — SvgImageHelper.GetSvgRelId has cognitive complexity 18 (threshold 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 · TemplateMerger.MergeXlsx (cognitive 18) · ×1
  • TemplateMerger.MergeXlsx (cognitive 18) src/officecli/Core/TemplateMerger.cs:328 — TemplateMerger.MergeXlsx has cognitive complexity 18 (threshold 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 · DocumentHandlerFactory.Open (cognitive 18) · ×1
  • DocumentHandlerFactory.Open (cognitive 18) REDACTED:14 — DocumentHandlerFactory.Open has cognitive complexity 18 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ExcelHandler.CheckAllCellOverflow (cognitive 18) · ×1
  • ExcelHandler.CheckAllCellOverflow (cognitive 18) src/officecli/Handlers/Excel/ExcelHandler.CheckOverflow.cs:22 — ExcelHandler.CheckAllCellOverflow has cognitive complexity 18 (threshold 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 · ExcelHandler.InsertMergeCellCheckedCore (cognitive 18) · ×1
  • ExcelHandler.InsertMergeCellCheckedCore (cognitive 18) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Cell.cs:291 — ExcelHandler.InsertMergeCellCheckedCore has cognitive complexity 18 (threshold 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 · ExcelHandler.ReadCellRangeAsDoubles (cognitive 18) · ×1
  • ExcelHandler.ReadCellRangeAsDoubles (cognitive 18) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.Charts.cs:381 — ExcelHandler.ReadCellRangeAsDoubles has cognitive complexity 18 (threshold 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 · ExcelHandler.TrimOptionalDecimals (cognitive 18) · ×1
  • ExcelHandler.TrimOptionalDecimals (cognitive 18) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:3852 — ExcelHandler.TrimOptionalDecimals has cognitive complexity 18 (threshold 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 · ExcelHandler.MatchesFormatAttributes (cognitive 18) · ×1
  • ExcelHandler.MatchesFormatAttributes (cognitive 18) src/officecli/Handlers/Excel/ExcelHandler.Selector.cs:240 — ExcelHandler.MatchesFormatAttributes has cognitive complexity 18 (threshold 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 · ExcelHandler.CalculateAutoFitWidth (cognitive 18) · ×1
  • ExcelHandler.CalculateAutoFitWidth (cognitive 18) src/officecli/Handlers/Excel/ExcelHandler.Set.RowsCols.cs:153 — ExcelHandler.CalculateAutoFitWidth has cognitive complexity 18 (threshold 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 · ExcelHandler.AutoFitAllColumns (cognitive 18) · ×1
  • ExcelHandler.AutoFitAllColumns (cognitive 18) src/officecli/Handlers/Excel/ExcelHandler.Set.RowsCols.cs:183 — ExcelHandler.AutoFitAllColumns has cognitive 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExcelHandler.ResolveX14DataBar (cognitive 18) · ×1
  • ExcelHandler.ResolveX14DataBar (cognitive 18) src/officecli/Handlers/Excel/ExcelHandler.Set.Tables.cs:1105 — ExcelHandler.ResolveX14DataBar has cognitive complexity 18 (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.
D2 · Cognitive Complexity · ExcelHandler.RawSheetWithFilter (cognitive 18) · ×1
  • ExcelHandler.RawSheetWithFilter (cognitive 18) src/officecli/Handlers/ExcelHandler.cs:329 — ExcelHandler.RawSheetWithFilter has cognitive complexity 18 (threshold 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 · PowerPointHandler.ResolveShapeId (cognitive 18) · ×1
  • PowerPointHandler.ResolveShapeId (cognitive 18) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:697 — PowerPointHandler.ResolveShapeId has cognitive complexity 18 (threshold 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 · PowerPointHandler.AddSlideComment (cognitive 18) · ×1
  • PowerPointHandler.AddSlideComment (cognitive 18) src/officecli/Handlers/Pptx/PowerPointHandler.Comments.cs:67 — PowerPointHandler.AddSlideComment has cognitive complexity 18 (threshold 15). 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 · PowerPointHandler.IsPlainReflectionPreset (cognitive 18) · ×1
  • PowerPointHandler.IsPlainReflectionPreset (cognitive 18) src/officecli/Handlers/Pptx/PowerPointHandler.Effects.cs:152 — PowerPointHandler.IsPlainReflectionPreset has cognitive complexity 18 (threshold 15). 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 · PowerPointHandler.ResolveLastPredicates (cognitive 18) · ×1
  • PowerPointHandler.ResolveLastPredicates (cognitive 18) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Path.cs:380 — PowerPointHandler.ResolveLastPredicates has cognitive complexity 18 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.AcquireShapeId (cognitive 18) · ×1
  • PowerPointHandler.AcquireShapeId (cognitive 18) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.ShapeId.cs:125 — PowerPointHandler.AcquireShapeId has cognitive complexity 18 (threshold 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 · PowerPointHandler.GetTextDefaults (cognitive 18) · ×1
  • PowerPointHandler.GetTextDefaults (cognitive 18) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.cs:585 — PowerPointHandler.GetTextDefaults has cognitive complexity 18 (threshold 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 · PowerPointHandler.RenderAlternateContent (cognitive 18) · ×1
  • PowerPointHandler.RenderAlternateContent (cognitive 18) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2584 — PowerPointHandler.RenderAlternateContent has cognitive 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, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.CopyTableCell (cognitive 18) · ×1
  • PowerPointHandler.CopyTableCell (cognitive 18) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1419 — PowerPointHandler.CopyTableCell has cognitive complexity 18 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · PowerPointHandler.MoveTableColumn (cognitive 18) · ×1
  • PowerPointHandler.MoveTableColumn (cognitive 18) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1512 — PowerPointHandler.MoveTableColumn has cognitive complexity 18 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · PowerPointHandler.BuildGroupNode (cognitive 18) · ×1
  • PowerPointHandler.BuildGroupNode (cognitive 18) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:255 — PowerPointHandler.BuildGroupNode has cognitive complexity 18 (threshold 15). 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 · PowerPointHandler.RenderAltContentSvg (cognitive 18) · ×1
  • PowerPointHandler.RenderAltContentSvg (cognitive 18) src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:146 — PowerPointHandler.RenderAltContentSvg has cognitive complexity 18 (threshold 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 · PowerPointHandler.RenderGroupSvg (cognitive 18) · ×1
  • PowerPointHandler.RenderGroupSvg (cognitive 18) src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:980 — PowerPointHandler.RenderGroupSvg has cognitive complexity 18 (threshold 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 · PptxBatchEmitter.EmitComments (cognitive 18) · ×1
  • PptxBatchEmitter.EmitComments (cognitive 18) src/officecli/Handlers/Pptx/PptxBatchEmitter.Notes.cs:174 — PptxBatchEmitter.EmitComments has cognitive complexity 18 (threshold 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 · WordBatchEmitter.BuildTabsShorthand (cognitive 18) · ×1
  • WordBatchEmitter.BuildTabsShorthand (cognitive 18) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:3429 — WordBatchEmitter.BuildTabsShorthand has cognitive complexity 18 (threshold 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 · WordHandler.AddPerm (cognitive 18) · ×1
  • WordHandler.AddPerm (cognitive 18) src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:796 — WordHandler.AddPerm has cognitive complexity 18 (threshold 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 · WordHandler.AddFootnote (cognitive 18) · ×1
  • WordHandler.AddFootnote (cognitive 18) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:704 — WordHandler.AddFootnote has cognitive complexity 18 (threshold 15). 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. This shape REPEATS in the file: one other method here (WordHandler.AddEndnote) 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 · WordHandler.AddEndnote (cognitive 18) · ×1
  • WordHandler.AddEndnote (cognitive 18) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:841 — WordHandler.AddEndnote has cognitive complexity 18 (threshold 15). 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. This shape REPEATS in the file: one other method here (WordHandler.AddFootnote) 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 · WordHandler.IsFieldCachedRun (cognitive 18) · ×1
  • WordHandler.IsFieldCachedRun (cognitive 18) src/officecli/Handlers/Word/WordHandler.Helpers.Field.cs:163 — WordHandler.IsFieldCachedRun has cognitive complexity 18 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.FindWatermark (cognitive 18) · ×1
  • WordHandler.FindWatermark (cognitive 18) src/officecli/Handlers/Word/WordHandler.Helpers.HeaderFooter.cs:19 — WordHandler.FindWatermark has cognitive complexity 18 (threshold 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 · WordHandler.GetParagraphTextWithMath (cognitive 18) · ×1
  • WordHandler.GetParagraphTextWithMath (cognitive 18) src/officecli/Handlers/Word/WordHandler.Helpers.Text.cs:186 — WordHandler.GetParagraphTextWithMath has cognitive complexity 18 (threshold 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 · WordHandler.IsContentSpanBookmark (cognitive 18) · ×1
  • WordHandler.IsContentSpanBookmark (cognitive 18) src/officecli/Handlers/Word/WordHandler.Helpers.Text.cs:511 — WordHandler.IsContentSpanBookmark has cognitive 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WordHandler.ResolveThemeCjkFont (cognitive 18) · ×1
  • WordHandler.ResolveThemeCjkFont (cognitive 18) REDACTED:1833 — WordHandler.ResolveThemeCjkFont has cognitive complexity 18 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.MoveTableColumn (cognitive 18) · ×1
  • WordHandler.MoveTableColumn (cognitive 18) src/officecli/Handlers/Word/WordHandler.Mutations.cs:2665 — WordHandler.MoveTableColumn has cognitive complexity 18 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · WordHandler.TableRowToNode (cognitive 18) · ×1
  • WordHandler.TableRowToNode (cognitive 18) src/officecli/Handlers/Word/WordHandler.Navigation.cs:3634 — WordHandler.TableRowToNode has cognitive 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WordHandler.SetFootnotePath (cognitive 18) · ×1
  • WordHandler.SetFootnotePath (cognitive 18) src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs:523 — WordHandler.SetFootnotePath has cognitive complexity 18 (threshold 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. This shape REPEATS in the file: one other method here (WordHandler.SetEndnotePath) 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 · WordHandler.SetEndnotePath (cognitive 18) · ×1
  • WordHandler.SetEndnotePath (cognitive 18) src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs:756 — WordHandler.SetEndnotePath has cognitive complexity 18 (threshold 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. This shape REPEATS in the file: one other method here (WordHandler.SetFootnotePath) 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 · WordHandler.GetParagraphListStyle (cognitive 18) · ×1
  • WordHandler.GetParagraphListStyle (cognitive 18) src/officecli/Handlers/Word/WordHandler.StyleList.cs:854 — WordHandler.GetParagraphListStyle has cognitive complexity 18 (threshold 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 · WordHandler.TryRawSetWithinTableFast (cognitive 18) · ×1
  • WordHandler.TryRawSetWithinTableFast (cognitive 18) src/officecli/Handlers/WordHandler.cs:1997 — WordHandler.TryRawSetWithinTableFast has cognitive complexity 18 (threshold 15). 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 · McpServer.Tokenize (cognitive 18) · ×1
  • McpServer.Tokenize (cognitive 18) src/officecli/McpServer.cs:339 — McpServer.Tokenize has cognitive complexity 18 (threshold 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 · watch-overlay._positionSelOverlay (cognitive 18) · ×1
  • watch-overlay._positionSelOverlay (cognitive 18) src/officecli/Resources/watch-overlay.js:68 — watch-overlay._positionSelOverlay 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 · (anonymous) (cognitive 18) · ×1
  • (anonymous) (cognitive 18) src/officecli/Resources/preview.js:131 — (anonymous) has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (7 pts), ternaries 3 (6 pts), boolean chains 5 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CommandBuilder.BuildPluginsListCommand (cognitive 17) · ×1
  • CommandBuilder.BuildPluginsListCommand (cognitive 17) src/officecli/CommandBuilder.Plugins.cs:24 — CommandBuilder.BuildPluginsListCommand has cognitive complexity 17 (threshold 15). None of this is in the body itself: all 17 points belong to one function literal inside it that branches (line 29). 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 · ChartExBuilder.SetHistogramBinSpec (cognitive 17) · ×1
  • ChartExBuilder.SetHistogramBinSpec (cognitive 17) src/officecli/Core/Chart/ChartExBuilder.Setter.cs:675 — ChartExBuilder.SetHistogramBinSpec has cognitive complexity 17 (threshold 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 · ChartHelper.SetManualLayoutProperty (cognitive 17) · ×1
  • ChartHelper.SetManualLayoutProperty (cognitive 17) src/officecli/Core/Chart/ChartHelper.cs:670 — ChartHelper.SetManualLayoutProperty has cognitive complexity 17 (threshold 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 · ChartHelper.BuildErrorBars (cognitive 17) · ×1
  • ChartHelper.BuildErrorBars (cognitive 17) src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:261 — ChartHelper.BuildErrorBars has cognitive complexity 17 (threshold 15). Of this number, 15 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FontMetricsReader.GetSplitAscDscOverride (cognitive 17) · ×1
  • FontMetricsReader.GetSplitAscDscOverride (cognitive 17) src/officecli/Core/FontMetricsReader.cs:420 — FontMetricsReader.GetSplitAscDscOverride has cognitive complexity 17 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · FormulaEvaluator.ParseComparison (cognitive 17) · ×1
  • FormulaEvaluator.ParseComparison (cognitive 17) src/officecli/Core/Formula/FormulaEvaluator.cs:684 — FormulaEvaluator.ParseComparison has cognitive complexity 17 (threshold 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 · FormulaEvaluator.ParseWeekend (cognitive 17) · ×1
  • FormulaEvaluator.ParseWeekend (cognitive 17) src/officecli/Core/Formula/FormulaEvaluator.Helpers.cs:345 — FormulaEvaluator.ParseWeekend has cognitive 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FormulaEvaluator.BisectFallback (cognitive 17) · ×1
  • FormulaEvaluator.BisectFallback (cognitive 17) src/officecli/Core/Formula/FormulaEvaluator.Solver.cs:58 — FormulaEvaluator.BisectFallback has cognitive complexity 17 (threshold 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 · FormulaEvaluator.InvRegGammaP (cognitive 17) · ×1
  • FormulaEvaluator.InvRegGammaP (cognitive 17) src/officecli/Core/Formula/FormulaEvaluator.SpecialFunctions.cs:98 — FormulaEvaluator.InvRegGammaP has cognitive complexity 17 (threshold 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 · FormulaEvaluator.EvalTTest (cognitive 17) · ×1
  • FormulaEvaluator.EvalTTest (cognitive 17) src/officecli/Core/Formula/FormulaEvaluator.Statistics3.cs:23 — FormulaEvaluator.EvalTTest has cognitive complexity 17 (threshold 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 · MsysPathHint.TryRecoverOriginalPath (cognitive 17) · ×1
  • MsysPathHint.TryRecoverOriginalPath (cognitive 17) src/officecli/Core/MsysPathHint.cs:82 — MsysPathHint.TryRecoverOriginalPath has cognitive complexity 17 (threshold 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 · NumericText.HasValidThousandsGrouping (cognitive 17) · ×1
  • NumericText.HasValidThousandsGrouping (cognitive 17) src/officecli/Core/NumericText.cs:35 — NumericText.HasValidThousandsGrouping has cognitive complexity 17 (threshold 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 · ThemeColorResolver.BuildColorMap (cognitive 17) · ×1
  • ThemeColorResolver.BuildColorMap (cognitive 17) src/officecli/Core/ThemeColorResolver.cs:33 — ThemeColorResolver.BuildColorMap has cognitive complexity 17 (threshold 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 · UpdateChecker.TryApplyPendingUpdate (cognitive 17) · ×1
  • UpdateChecker.TryApplyPendingUpdate (cognitive 17) src/officecli/Core/UpdateChecker.cs:311 — UpdateChecker.TryApplyPendingUpdate has cognitive complexity 17 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · DocumentHandlerFactory.ResolveInternalRelTarget (cognitive 17) · ×1
  • DocumentHandlerFactory.ResolveInternalRelTarget (cognitive 17) REDACTED:451 — DocumentHandlerFactory.ResolveInternalRelTarget has cognitive complexity 17 (threshold 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 · ExcelBatchEmitter.EmitValidations (cognitive 17) · ×1
  • ExcelBatchEmitter.EmitValidations (cognitive 17) src/officecli/Handlers/Excel/ExcelBatchEmitter.Elements.cs:302 — ExcelBatchEmitter.EmitValidations has cognitive complexity 17 (threshold 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 · ExcelHandler.AddCellIs (cognitive 17) · ×1
  • ExcelHandler.AddCellIs (cognitive 17) src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:512 — ExcelHandler.AddCellIs has cognitive complexity 17 (threshold 15). 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 · ExcelHandler.ResolveCellRawText (cognitive 17) · ×1
  • ExcelHandler.ResolveCellRawText (cognitive 17) src/officecli/Handlers/Excel/ExcelHandler.ChartCache.cs:155 — ExcelHandler.ResolveCellRawText has cognitive complexity 17 (threshold 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 · ExcelHandler.GetCellRange (cognitive 17) · ×1
  • ExcelHandler.GetCellRange (cognitive 17) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Cell.cs:358 — ExcelHandler.GetCellRange has cognitive complexity 17 (threshold 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 · ExcelHandler.TrySetAnchorPosition (cognitive 17) · ×1
  • ExcelHandler.TrySetAnchorPosition (cognitive 17) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:989 — ExcelHandler.TrySetAnchorPosition has cognitive complexity 17 (threshold 15). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ExcelHandler.RenderExcelCxChart (cognitive 17) · ×1
  • ExcelHandler.RenderExcelCxChart (cognitive 17) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.Charts.cs:484 — ExcelHandler.RenderExcelCxChart has cognitive complexity 17 (threshold 15). 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 · ExcelHandler.GetIconHtml (cognitive 17) · ×1
  • ExcelHandler.GetIconHtml (cognitive 17) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:1657 — ExcelHandler.GetIconHtml has cognitive complexity 17 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ExcelHandler.CollectCfRangeCells (cognitive 17) · ×1
  • ExcelHandler.CollectCfRangeCells (cognitive 17) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:1919 — ExcelHandler.CollectCfRangeCells has cognitive complexity 17 (threshold 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 · ExcelHandler.BuildFontCss (cognitive 17) · ×1
  • ExcelHandler.BuildFontCss (cognitive 17) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:2332 — ExcelHandler.BuildFontCss has cognitive complexity 17 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ExcelHandler.ApplyTextFormat (cognitive 17) · ×1
  • ExcelHandler.ApplyTextFormat (cognitive 17) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:3238 — ExcelHandler.ApplyTextFormat has cognitive complexity 17 (threshold 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 · ExcelHandler.NormalizeDateFormatCase (cognitive 17) · ×1
  • ExcelHandler.NormalizeDateFormatCase (cognitive 17) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:3926 — ExcelHandler.NormalizeDateFormatCase has cognitive 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.
D2 · Cognitive Complexity · ExcelHandler.FindMatchingX14DataBarRule (cognitive 17) · ×1
  • ExcelHandler.FindMatchingX14DataBarRule (cognitive 17) src/officecli/Handlers/Excel/ExcelHandler.Query.cs:2101 — ExcelHandler.FindMatchingX14DataBarRule has cognitive complexity 17 (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.
D2 · Cognitive Complexity · PowerPointHandler.EnumeratePartUris (cognitive 17) · ×1
  • PowerPointHandler.EnumeratePartUris (cognitive 17) REDACTED:70 — PowerPointHandler.EnumeratePartUris has cognitive complexity 17 (threshold 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 · PowerPointHandler.ReconcileSlideMasterIds (cognitive 17) · ×1
  • PowerPointHandler.ReconcileSlideMasterIds (cognitive 17) REDACTED:706 — PowerPointHandler.ReconcileSlideMasterIds has cognitive complexity 17 (threshold 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 · PowerPointHandler.Dispose (cognitive 17) · ×1
  • PowerPointHandler.Dispose (cognitive 17) REDACTED:2403 — PowerPointHandler.Dispose has cognitive complexity 17 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.BuildModel3DElement (cognitive 17) · ×1
  • PowerPointHandler.BuildModel3DElement (cognitive 17) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Model3D.cs:231 — PowerPointHandler.BuildModel3DElement has cognitive complexity 17 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · PowerPointHandler.AddColumn (cognitive 17) · ×1
  • PowerPointHandler.AddColumn (cognitive 17) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Table.cs:487 — PowerPointHandler.AddColumn has cognitive complexity 17 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · PowerPointHandler.InsertTransitionWithMcWrapper (cognitive 17) · ×1
  • PowerPointHandler.InsertTransitionWithMcWrapper (cognitive 17) src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:589 — PowerPointHandler.InsertTransitionWithMcWrapper has cognitive 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, 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 · PowerPointHandler.NormalizeGradientValue (cognitive 17) · ×1
  • PowerPointHandler.NormalizeGradientValue (cognitive 17) src/officecli/Handlers/Pptx/PowerPointHandler.Background.cs:734 — PowerPointHandler.NormalizeGradientValue has cognitive complexity 17 (threshold 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 · PowerPointHandler.ApplyZOrder (cognitive 17) · ×1
  • PowerPointHandler.ApplyZOrder (cognitive 17) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Geometry.cs:162 — PowerPointHandler.ApplyZOrder has cognitive complexity 17 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · PowerPointHandler.ReconcileAdjustGuides (cognitive 17) · ×1
  • PowerPointHandler.ReconcileAdjustGuides (cognitive 17) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Geometry.cs:434 — PowerPointHandler.ReconcileAdjustGuides has cognitive complexity 17 (threshold 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 · PowerPointHandler.ResolveBulletColor (cognitive 17) · ×1
  • PowerPointHandler.ResolveBulletColor (cognitive 17) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2849 — PowerPointHandler.ResolveBulletColor has cognitive complexity 17 (threshold 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 · PowerPointHandler.SwapXmlElements (cognitive 17) · ×1
  • PowerPointHandler.SwapXmlElements (cognitive 17) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1146 — PowerPointHandler.SwapXmlElements has cognitive complexity 17 (threshold 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 · PowerPointHandler.CopyTableColumn (cognitive 17) · ×1
  • PowerPointHandler.CopyTableColumn (cognitive 17) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1583 — PowerPointHandler.CopyTableColumn has cognitive complexity 17 (threshold 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 · PowerPointHandler.DeepCopySubParts (cognitive 17) · ×1
  • PowerPointHandler.DeepCopySubParts (cognitive 17) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1968 — PowerPointHandler.DeepCopySubParts has cognitive complexity 17 (threshold 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 · PowerPointHandler.BuildChildNodesIntoContainer (cognitive 17) · ×1
  • PowerPointHandler.BuildChildNodesIntoContainer (cognitive 17) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:125 — PowerPointHandler.BuildChildNodesIntoContainer has cognitive complexity 17 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · PowerPointHandler.EnumerateRenderableElements (cognitive 17) · ×1
  • PowerPointHandler.EnumerateRenderableElements (cognitive 17) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:790 — PowerPointHandler.EnumerateRenderableElements has cognitive complexity 17 (threshold 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 · PowerPointHandler.MatchesShapeSelector (cognitive 17) · ×1
  • PowerPointHandler.MatchesShapeSelector (cognitive 17) src/officecli/Handlers/Pptx/PowerPointHandler.Selector.cs:221 — PowerPointHandler.MatchesShapeSelector has cognitive 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PptxBatchEmitter.EmitMasterRawOne (cognitive 17) · ×1
  • PptxBatchEmitter.EmitMasterRawOne (cognitive 17) src/officecli/Handlers/Pptx/PptxBatchEmitter.Resources.cs:183 — PptxBatchEmitter.EmitMasterRawOne has cognitive complexity 17 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.WrapRunsInRevision (cognitive 17) · ×1
  • WordHandler.WrapRunsInRevision (cognitive 17) src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:1864 — WordHandler.WrapRunsInRevision has cognitive complexity 17 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · WordHandler.ApplySectionColumnWidthsSpaces (cognitive 17) · ×1
  • WordHandler.ApplySectionColumnWidthsSpaces (cognitive 17) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:3093 — WordHandler.ApplySectionColumnWidthsSpaces has cognitive complexity 17 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · WordHandler.MarkOwningFieldDirty (cognitive 17) · ×1
  • WordHandler.MarkOwningFieldDirty (cognitive 17) src/officecli/Handlers/Word/WordHandler.Helpers.Field.cs:201 — WordHandler.MarkOwningFieldDirty has cognitive complexity 17 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · WordHandler.RemoveWatermarkHeaders (cognitive 17) · ×1
  • WordHandler.RemoveWatermarkHeaders (cognitive 17) src/officecli/Handlers/Word/WordHandler.Helpers.HeaderFooter.cs:61 — WordHandler.RemoveWatermarkHeaders has cognitive complexity 17 (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.
D2 · Cognitive Complexity · WordHandler.RenderTextBoxContentChildren (cognitive 17) · ×1
  • WordHandler.RenderTextBoxContentChildren (cognitive 17) REDACTED:1400 — WordHandler.RenderTextBoxContentChildren has cognitive complexity 17 (threshold 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 · WordHandler.ResolveTableStyleConditionalFormats (cognitive 17) · ×1
  • WordHandler.ResolveTableStyleConditionalFormats (cognitive 17) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Tables.cs:874 — WordHandler.ResolveTableStyleConditionalFormats has cognitive complexity 17 (threshold 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 · WordHandler.RecalcSeqFields (cognitive 17) · ×1
  • WordHandler.RecalcSeqFields (cognitive 17) src/officecli/Handlers/Word/WordHandler.SeqEval.cs:40 — WordHandler.RecalcSeqFields has cognitive complexity 17 (threshold 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 · WordHandler.TrySetCompatibility (cognitive 17) · ×1
  • WordHandler.TrySetCompatibility (cognitive 17) src/officecli/Handlers/Word/WordHandler.Set.Compatibility.cs:100 — WordHandler.TrySetCompatibility has cognitive complexity 17 (threshold 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 · WordHandler.TryGetRevisionNode (cognitive 17) · ×1
  • WordHandler.TryGetRevisionNode (cognitive 17) src/officecli/Handlers/Word/WordHandler.Set.Revision.cs:975 — WordHandler.TryGetRevisionNode has cognitive complexity 17 (threshold 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 · WordHandler.ViewAsStats (cognitive 17) · ×1
  • WordHandler.ViewAsStats (cognitive 17) src/officecli/Handlers/Word/WordHandler.View.cs:811 — WordHandler.ViewAsStats has cognitive complexity 17 (threshold 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 · WordHandler.EnumeratePartUris (cognitive 17) · ×1
  • WordHandler.EnumeratePartUris (cognitive 17) src/officecli/Handlers/WordHandler.cs:222 — WordHandler.EnumeratePartUris has cognitive complexity 17 (threshold 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 · WordHandler.EnumerateSectionHeaderFooterRefs (cognitive 17) · ×1
  • WordHandler.EnumerateSectionHeaderFooterRefs (cognitive 17) src/officecli/Handlers/WordHandler.cs:305 — WordHandler.EnumerateSectionHeaderFooterRefs has cognitive complexity 17 (threshold 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 · ResidentServer.RunAsync (cognitive 17) · ×1
  • ResidentServer.RunAsync (cognitive 17) src/officecli/ResidentServer.cs:263 — ResidentServer.RunAsync has cognitive complexity 17 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
D2 · Cognitive Complexity · ResidentServer.TryAutosaveAsync (cognitive 17) · ×1
  • ResidentServer.TryAutosaveAsync (cognitive 17) src/officecli/ResidentServer.cs:489 — ResidentServer.TryAutosaveAsync has cognitive complexity 17 (threshold 15). 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 · CommandBuilder.BuildUnmarkMarkCommand (cognitive 16) · ×1
  • CommandBuilder.BuildUnmarkMarkCommand (cognitive 16) src/officecli/CommandBuilder.Mark.cs:247 — CommandBuilder.BuildUnmarkMarkCommand has cognitive complexity 16 (threshold 15). None of this is in the body itself: all 16 points belong to one function literal inside it that branches (line 260). 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 · AttributeFilter.NearestMatch (cognitive 16) · ×1
  • AttributeFilter.NearestMatch (cognitive 16) src/officecli/Core/AttributeFilter.cs:394 — AttributeFilter.NearestMatch has cognitive complexity 16 (threshold 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 · BatchCompat.PrepareForReplay (cognitive 16) · ×1
  • BatchCompat.PrepareForReplay (cognitive 16) src/officecli/Core/BatchCompat.cs:41 — BatchCompat.PrepareForReplay has cognitive complexity 16 (threshold 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 · ChartHelper.ReadCategories (cognitive 16) · ×1
  • ChartHelper.ReadCategories (cognitive 16) src/officecli/Core/Chart/ChartHelper.Reader.cs:1965 — ChartHelper.ReadCategories has cognitive complexity 16 (threshold 15). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExcelStyleManager.EnsureHyperlinkCellStyle (cognitive 16) · ×1
  • ExcelStyleManager.EnsureHyperlinkCellStyle (cognitive 16) src/officecli/Core/ExcelStyleManager.cs:488 — ExcelStyleManager.EnsureHyperlinkCellStyle has cognitive complexity 16 (threshold 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 · ExcelStyleManager.LongTailChildrenMatch (cognitive 16) · ×1
  • ExcelStyleManager.LongTailChildrenMatch (cognitive 16) src/officecli/Core/ExcelStyleManager.cs:1108 — ExcelStyleManager.LongTailChildrenMatch has cognitive complexity 16 (threshold 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 · FormulaEvaluator.ParseCallArgs (cognitive 16) · ×1
  • FormulaEvaluator.ParseCallArgs (cognitive 16) src/officecli/Core/Formula/FormulaEvaluator.cs:1073 — FormulaEvaluator.ParseCallArgs has cognitive complexity 16 (threshold 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 · FormulaEvaluator.EvalChooseRowsCols (cognitive 16) · ×1
  • FormulaEvaluator.EvalChooseRowsCols (cognitive 16) src/officecli/Core/Formula/FormulaEvaluator.Spill.cs:265 — FormulaEvaluator.EvalChooseRowsCols has cognitive complexity 16 (threshold 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 · FormulaEvaluator.EvalWrap (cognitive 16) · ×1
  • FormulaEvaluator.EvalWrap (cognitive 16) src/officecli/Core/Formula/FormulaEvaluator.Spill.cs:372 — FormulaEvaluator.EvalWrap has cognitive complexity 16 (threshold 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 · FormulaParser.ParseOperatorWithLimits (cognitive 16) · ×1
  • FormulaParser.ParseOperatorWithLimits (cognitive 16) src/officecli/Core/Formula/FormulaParser.cs:2334 — FormulaParser.ParseOperatorWithLimits has cognitive complexity 16 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · GenericXmlQuery.GetAttributeValue (cognitive 16) · ×1
  • GenericXmlQuery.GetAttributeValue (cognitive 16) REDACTED:139 — GenericXmlQuery.GetAttributeValue has cognitive complexity 16 (threshold 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. This shape REPEATS in the file: one other method here (GenericXmlQuery.SetGenericAttribute) 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 · GenericXmlQuery.SetGenericAttribute (cognitive 16) · ×1
  • GenericXmlQuery.SetGenericAttribute (cognitive 16) REDACTED:299 — GenericXmlQuery.SetGenericAttribute has cognitive complexity 16 (threshold 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. This shape REPEATS in the file: one other method here (GenericXmlQuery.GetAttributeValue) 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 · OleHelper.AddEmbeddedPart (cognitive 16) · ×1
  • OleHelper.AddEmbeddedPart (cognitive 16) src/officecli/Core/OleHelper.cs:155 — OleHelper.AddEmbeddedPart has cognitive complexity 16 (threshold 15). 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 · OutputFormatter.FormatNodeValue (cognitive 16) · ×1
  • OutputFormatter.FormatNodeValue (cognitive 16) src/officecli/Core/OutputFormatter.cs:826 — OutputFormatter.FormatNodeValue has cognitive complexity 16 (threshold 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 · PivotTableHelper.ResolvePivotSourceSpec (cognitive 16) · ×1
  • PivotTableHelper.ResolvePivotSourceSpec (cognitive 16) src/officecli/Core/PivotTableHelper.Cache.cs:1129 — PivotTableHelper.ResolvePivotSourceSpec has cognitive complexity 16 (threshold 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 · PivotTableHelper.DedupeSheetDataRows (cognitive 16) · ×1
  • PivotTableHelper.DedupeSheetDataRows (cognitive 16) src/officecli/Core/PivotTableHelper.cs:2039 — PivotTableHelper.DedupeSheetDataRows has cognitive complexity 16 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · PluginManifestExtensions.Warnings (cognitive 16) · ×1
  • PluginManifestExtensions.Warnings (cognitive 16) src/officecli/Core/Plugins/PluginManifest.cs:201 — PluginManifestExtensions.Warnings has cognitive complexity 16 (threshold 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 · TemplateMerger.MergePptx (cognitive 16) · ×1
  • TemplateMerger.MergePptx (cognitive 16) src/officecli/Core/TemplateMerger.cs:429 — TemplateMerger.MergePptx has cognitive complexity 16 (threshold 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. This shape REPEATS in the file: one other method here (TemplateMerger.ScanUnresolvedPptx) 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 · TemplateMerger.ScanUnresolvedPptx (cognitive 16) · ×1
  • TemplateMerger.ScanUnresolvedPptx (cognitive 16) src/officecli/Core/TemplateMerger.cs:522 — TemplateMerger.ScanUnresolvedPptx has cognitive complexity 16 (threshold 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. This shape REPEATS in the file: one other method here (TemplateMerger.MergePptx) 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 · TypedAttributeFallback.TrySetNestedExisting (cognitive 16) · ×1
  • TypedAttributeFallback.TrySetNestedExisting (cognitive 16) src/officecli/Core/TypedAttributeFallback.cs:206 — TypedAttributeFallback.TrySetNestedExisting has cognitive complexity 16 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ExcelBatchEmitter.EmitRowCellStyles (cognitive 16) · ×1
  • ExcelBatchEmitter.EmitRowCellStyles (cognitive 16) src/officecli/Handlers/Excel/ExcelBatchEmitter.cs:922 — ExcelBatchEmitter.EmitRowCellStyles has cognitive complexity 16 (threshold 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 · ExcelHandler.AddChartSeries (cognitive 16) · ×1
  • ExcelHandler.AddChartSeries (cognitive 16) src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:374 — ExcelHandler.AddChartSeries has cognitive 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExcelHandler.ContainsNumericPlaceholderOutsideQuotes (cognitive 16) · ×1
  • ExcelHandler.ContainsNumericPlaceholderOutsideQuotes (cognitive 16) src/officecli/Handlers/Excel/ExcelHandler.CheckNumericOverflow.cs:460 — ExcelHandler.ContainsNumericPlaceholderOutsideQuotes has cognitive complexity 16 (threshold 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 · ExcelHandler.ResolveRangeToCellValues (cognitive 16) · ×1
  • ExcelHandler.ResolveRangeToCellValues (cognitive 16) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Chart.cs:762 — ExcelHandler.ResolveRangeToCellValues has cognitive complexity 16 (threshold 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 · ExcelHandler.BuildCellContent (cognitive 16) · ×1
  • ExcelHandler.BuildCellContent (cognitive 16) src/officecli/Handlers/Excel/ExcelHandler.HtmlPreview.cs:4254 — ExcelHandler.BuildCellContent has cognitive complexity 16 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ExcelHandler.ViewAsOutlineJson (cognitive 16) · ×1
  • ExcelHandler.ViewAsOutlineJson (cognitive 16) src/officecli/Handlers/Excel/ExcelHandler.View.cs:381 — ExcelHandler.ViewAsOutlineJson has cognitive complexity 16 (threshold 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 · PowerPointHandler.MastersInOrder (cognitive 16) · ×1
  • PowerPointHandler.MastersInOrder (cognitive 16) REDACTED:2461 — PowerPointHandler.MastersInOrder has cognitive complexity 16 (threshold 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 · PowerPointHandler.GetSlideBulletImageParts (cognitive 16) · ×1
  • PowerPointHandler.GetSlideBulletImageParts (cognitive 16) REDACTED:3107 — PowerPointHandler.GetSlideBulletImageParts has cognitive complexity 16 (threshold 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 · PowerPointHandler.GetShapeCNvPrHyperlinkInfo (cognitive 16) · ×1
  • PowerPointHandler.GetShapeCNvPrHyperlinkInfo (cognitive 16) REDACTED:4582 — PowerPointHandler.GetShapeCNvPrHyperlinkInfo has cognitive complexity 16 (threshold 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 · PowerPointHandler.NormalizeMediaTimeMs (cognitive 16) · ×1
  • PowerPointHandler.NormalizeMediaTimeMs (cognitive 16) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:1186 — PowerPointHandler.NormalizeMediaTimeMs has cognitive complexity 16 (threshold 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 · PowerPointHandler.AddMotionAnimation (cognitive 16) · ×1
  • PowerPointHandler.AddMotionAnimation (cognitive 16) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1861 — PowerPointHandler.AddMotionAnimation has cognitive complexity 16 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · PowerPointHandler.AddCell (cognitive 16) · ×1
  • PowerPointHandler.AddCell (cognitive 16) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Table.cs:562 — PowerPointHandler.AddCell has cognitive 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: 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 · PowerPointHandler.AddEquation (cognitive 16) · ×1
  • PowerPointHandler.AddEquation (cognitive 16) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Text.cs:18 — PowerPointHandler.AddEquation has cognitive complexity 16 (threshold 15). 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 · PowerPointHandler.TryResolveMasterOrLayoutShapeParent (cognitive 16) · ×1
  • PowerPointHandler.TryResolveMasterOrLayoutShapeParent (cognitive 16) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.cs:56 — PowerPointHandler.TryResolveMasterOrLayoutShapeParent has cognitive complexity 16 (threshold 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 · PowerPointHandler.ReadGradientString (cognitive 16) · ×1
  • PowerPointHandler.ReadGradientString (cognitive 16) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.RunFormat.cs:363 — PowerPointHandler.ReadGradientString has cognitive complexity 16 (threshold 15). Of this number, 14 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 · PowerPointHandler.PatternFillToCss (cognitive 16) · ×1
  • PowerPointHandler.PatternFillToCss (cognitive 16) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:143 — PowerPointHandler.PatternFillToCss has cognitive complexity 16 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · PowerPointHandler.ResolveInheritedAnchor (cognitive 16) · ×1
  • PowerPointHandler.ResolveInheritedAnchor (cognitive 16) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:893 — PowerPointHandler.ResolveInheritedAnchor has cognitive complexity 16 (threshold 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 · PowerPointHandler.TryResolveDiagramDrawingPart (cognitive 16) · ×1
  • PowerPointHandler.TryResolveDiagramDrawingPart (cognitive 16) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:3054 — PowerPointHandler.TryResolveDiagramDrawingPart has cognitive complexity 16 (threshold 15). Of this number, 14 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 · PowerPointHandler.CopyTableRow (cognitive 16) · ×1
  • PowerPointHandler.CopyTableRow (cognitive 16) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1357 — PowerPointHandler.CopyTableRow has cognitive complexity 16 (threshold 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 · PowerPointHandler.ReadMediaTimingProperties (cognitive 16) · ×1
  • PowerPointHandler.ReadMediaTimingProperties (cognitive 16) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:3066 — PowerPointHandler.ReadMediaTimingProperties has cognitive complexity 16 (threshold 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 · PowerPointHandler.FormatPlaceholderType (cognitive 16) · ×1
  • PowerPointHandler.FormatPlaceholderType (cognitive 16) src/officecli/Handlers/Pptx/PowerPointHandler.Resolve.cs:255 — PowerPointHandler.FormatPlaceholderType has cognitive complexity 16 (threshold 15). 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 · PowerPointHandler.SetTitleByPath (cognitive 16) · ×1
  • PowerPointHandler.SetTitleByPath (cognitive 16) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:515 — PowerPointHandler.SetTitleByPath has cognitive complexity 16 (threshold 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 · PowerPointHandler.ApplyShapePropsCore (cognitive 16) · ×1
  • PowerPointHandler.ApplyShapePropsCore (cognitive 16) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1874 — PowerPointHandler.ApplyShapePropsCore has cognitive 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: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. 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 · PowerPointHandler.IsValidDrawingRunAttrValue (cognitive 16) · ×1
  • PowerPointHandler.IsValidDrawingRunAttrValue (cognitive 16) src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:97 — PowerPointHandler.IsValidDrawingRunAttrValue has cognitive complexity 16 (threshold 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 · PowerPointHandler.ApplyRprLike (cognitive 16) · ×1
  • PowerPointHandler.ApplyRprLike (cognitive 16) src/officecli/Handlers/Pptx/PowerPointHandler.StyleList.cs:327 — PowerPointHandler.ApplyRprLike has cognitive complexity 16 (threshold 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 · PptxBatchEmitter.SanitizeChartImageFills (cognitive 16) · ×1
  • PptxBatchEmitter.SanitizeChartImageFills (cognitive 16) src/officecli/Handlers/Pptx/PptxBatchEmitter.Charts.cs:527 — PptxBatchEmitter.SanitizeChartImageFills has cognitive 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SlideComposition.ResolveInheritedFrame (cognitive 16) · ×1
  • SlideComposition.ResolveInheritedFrame (cognitive 16) src/officecli/Handlers/Pptx/SlideComposition.cs:208 — SlideComposition.ResolveInheritedFrame has cognitive complexity 16 (threshold 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 · WordBatchEmitter.StripDanglingThemeBlipRefs (cognitive 16) · ×1
  • WordBatchEmitter.StripDanglingThemeBlipRefs (cognitive 16) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:705 — WordBatchEmitter.StripDanglingThemeBlipRefs has cognitive complexity 16 (threshold 15). Of this number, 14 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 · WordHandler.AddTextbox (cognitive 16) · ×1
  • WordHandler.AddTextbox (cognitive 16) src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:3004 — WordHandler.AddTextbox has cognitive complexity 16 (threshold 15). 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 · WordHandler.AddShape (cognitive 16) · ×1
  • WordHandler.AddShape (cognitive 16) src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:3196 — WordHandler.AddShape has cognitive complexity 16 (threshold 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 · WordHandler.FlattenWrappers (cognitive 16) · ×1
  • WordHandler.FlattenWrappers (cognitive 16) src/officecli/Handlers/Word/WordHandler.Helpers.Text.cs:236 — WordHandler.FlattenWrappers has cognitive complexity 16 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · WordHandler.DocCarriesNormalDefaults (cognitive 16) · ×1
  • WordHandler.DocCarriesNormalDefaults (cognitive 16) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:1087 — WordHandler.DocCarriesNormalDefaults has cognitive complexity 16 (threshold 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 · WordHandler.ParagraphHasAlignedTab (cognitive 16) · ×1
  • WordHandler.ParagraphHasAlignedTab (cognitive 16) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Text.cs:61 — WordHandler.ParagraphHasAlignedTab has cognitive complexity 16 (threshold 15). Of this number, 14 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 · WordHandler.ViewAsStatsJson (cognitive 16) · ×1
  • WordHandler.ViewAsStatsJson (cognitive 16) src/officecli/Handlers/Word/WordHandler.View.cs:897 — WordHandler.ViewAsStatsJson has cognitive complexity 16 (threshold 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 · WordHandler.Dispose (cognitive 16) · ×1
  • WordHandler.Dispose (cognitive 16) src/officecli/Handlers/WordHandler.cs:2494 — WordHandler.Dispose has cognitive complexity 16 (threshold 15). 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 · McpInstaller.WriteServersDict (cognitive 16) · ×1
  • McpInstaller.WriteServersDict (cognitive 16) src/officecli/McpInstaller.cs:362 — McpInstaller.WriteServersDict has cognitive complexity 16 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · McpServer.RunScreenshotArgv (cognitive 16) · ×1
  • McpServer.RunScreenshotArgv (cognitive 16) src/officecli/McpServer.cs:395 — McpServer.RunScreenshotArgv has cognitive 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: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. 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 · preview.document.addEventListener("keydown") (cognitive 16) · ×1
  • preview.document.addEventListener("keydown") (cognitive 16) src/officecli/Resources/preview.js:131 — preview.document.addEventListener("keydown") has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 5, ternaries 2 (4 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · watch-overlay._detectRect (cognitive 16) · ×1
  • watch-overlay._detectRect (cognitive 16) src/officecli/Resources/watch-overlay.js:23 — watch-overlay._detectRect has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · (anonymous) (cognitive 16) · ×1
  • (anonymous) (cognitive 16) src/officecli/Resources/watch-overlay.js:642 — (anonymous) has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, boolean chains 6, ternaries 2, error handling 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.
D22 · Internal API Consistency · Python SDK exposes both `create` and `open` as top-level module functions with identical signatures and likely identical implementation logic (instantiating a Document object). Similarly, the Node SDK exposes both `create` and `open` in the index. It is unclear if these represent distinct lifecycle states (e.g., creating a new process vs attaching to an existing one) or if they are redundant aliases. If they are aliases, having two public entry points for the same action is confusing. If they are distinct, the naming convention does not clearly convey the difference (e.g., `connect` vs `spawn`). · ×1
  • Python SDK exposes both `create` and `open` as top-level module functions with identical signatures and likely identical implementation logic (instantiating a Document object). Similarly, the Node SDK exposes both `create` and `open` in the index. It is unclear if these represent distinct lifecycle states (e.g., creating a new process vs attaching to an existing one) or if they are redundant aliases. If they are aliases, having two public entry points for the same action is confusing. If they are distinct, the naming convention does not clearly convey the difference (e.g., `connect` vs `spawn`). — Unify into a single entry point (e.g., `connect` or `create`) if the behavior is identical. If they are distinct, rename to clearly indicate the difference (e.g., `spawnNew` vs `attachExisting`) and ensure the Python SDK mirrors the Node SDK's distinction if it exists, or vice versa. (signatures: sdk.python.officecli.create(path, binary, timeout, auto_install) | sdk.python.officecli.open(path, binary, timeout, auto_install) | sdk.node.index.create(filePath, args?, { binary = 'officecli', timeoutMs = 30000, autoInstall = true }?) | sdk.node.index.open(filePath, { binary = 'officecli', timeoutMs = 30000, autoInstall = true }?))
D22 · Internal API Consistency · Inconsistent naming convention for the same utility function. Python uses snake_case (`pipe_paths`) while Node uses camelCase (`pipePaths`). While this is a standard language convention, the underlying operation name 'pipe_paths' is slightly ambiguous compared to 'pipePaths' (which might imply a single path or a list). More importantly, if this is a core utility, the semantic meaning of 'pipe_paths' (plural) vs 'pipePaths' (plural) is consistent, but the casing inconsistency across the API surface is a minor style violation that affects perceived consistency. · ×1
  • Inconsistent naming convention for the same utility function. Python uses snake_case (`pipe_paths`) while Node uses camelCase (`pipePaths`). While this is a standard language convention, the underlying operation name 'pipe_paths' is slightly ambiguous compared to 'pipePaths' (which might imply a single path or a list). More importantly, if this is a core utility, the semantic meaning of 'pipe_paths' (plural) vs 'pipePaths' (plural) is consistent, but the casing inconsistency across the API surface is a minor style violation that affects perceived consistency. — Ensure strict adherence to language-specific naming conventions (snake_case for Python, camelCase for Node). This is already mostly done, but verify if `pipe_paths` in Python is truly a plural operation or a typo for `pipe_path`. If it handles multiple paths, the name is fine, but the casing is the only inconsistency. (signatures: sdk.python.officecli.pipe_paths(file_path) | sdk.node.index.pipePaths(filePath))
D22 · Internal API Consistency · Inconsistent parameter naming and typing between Python and Node constructors. Python uses `path` and `timeout`, while Node uses `filePath` and `timeoutMs`. While `timeoutMs` is more explicit, `path` vs `filePath` is a minor inconsistency. More critically, the Node constructor has optional parameters (`binary?`, `timeoutMs?`) with defaults, while the Python constructor requires them. This creates a different usage pattern for the same object. · ×1
  • Inconsistent parameter naming and typing between Python and Node constructors. Python uses `path` and `timeout`, while Node uses `filePath` and `timeoutMs`. While `timeoutMs` is more explicit, `path` vs `filePath` is a minor inconsistency. More critically, the Node constructor has optional parameters (`binary?`, `timeoutMs?`) with defaults, while the Python constructor requires them. This creates a different usage pattern for the same object. — Align parameter names (`path` vs `filePath`) and required/optional status. If defaults are available in Node, consider making them optional in Python as well, or vice versa, to provide a consistent developer experience across platforms. (signatures: sdk.python.officecli.Document.__init__(self, path, binary, timeout) | sdk.node.Document.constructor(filePath, binary?, timeoutMs?))
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D3 · God Classes · FunctionTooLong · ×1
  • FunctionTooLong: watch-sse-core.es.addEventListener("update") src/officecli/Resources/watch-sse-core.js:318 — FunctionTooLong — es.addEventListener("update") 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.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Near-duplicate member family (4 members, 12 shared lines) · ×1
  • Near-duplicate member family (4 members, 12 shared lines) REDACTED:4364 — REDACTED:4364-4386 | REDACTED:4399-4430 | REDACTED:4444-4485 | REDACTED:4510-4563 — These 4 members are variants of one another: a block of 12 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member pair (131 shared lines) · ×1
  • Near-duplicate member pair (131 shared lines) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:2699 — src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:2699-2896 | src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:2899-3083 — These two members are variants of one another: 131 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 (124 shared lines) · ×1
  • Near-duplicate member pair (124 shared lines) src/officecli/Handlers/Word/WordHandler.Navigation.cs:119 — src/officecli/Handlers/Word/WordHandler.Navigation.cs:119-478 | src/officecli/Handlers/Word/WordHandler.Query.cs:981-1275 — These two members are variants of one another: 124 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 (117 shared lines) · ×1
  • Near-duplicate member pair (117 shared lines) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1942 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1942-2199 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Model3D.cs:21-225 — These two members are variants of one another: 117 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (53 shared lines) · ×1
  • Near-duplicate member pair (53 shared lines) REDACTED:3967 — REDACTED:3967-4085 | REDACTED:4112-4271 — These two members are variants of one another: 53 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (22 shared lines) · ×1
  • Near-duplicate member pair (22 shared lines) REDACTED:4277 — REDACTED:4277-4319 | REDACTED:5002-5041 — 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 · Near-duplicate member pair (17 shared lines) · ×1
  • Near-duplicate member pair (17 shared lines) src/officecli/Handlers/Excel/ExcelHandler.ChartCache.cs:99 — src/officecli/Handlers/Excel/ExcelHandler.ChartCache.cs:99-146 | src/officecli/Handlers/Excel/ExcelHandler.View.cs:1045-1084 — These two members are variants of one another: 17 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 (47 corresponding lines) · ×1
  • Edited copy of a member (47 corresponding lines) src/officecli/Handlers/Word/WordHandler.Navigation.cs:3685 — src/officecli/Handlers/Word/WordHandler.Navigation.cs:3685-3742 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:3745-3793 — These two members are one piece of code written twice and then edited apart: 47 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (40 corresponding lines) · ×1
  • Edited copy of a member (40 corresponding lines) src/officecli/Handlers/Word/WordHandler.Set.cs:1663 — src/officecli/Handlers/Word/WordHandler.Set.cs:1663-1712 | src/officecli/Handlers/Word/WordHandler.Set.cs:1755-1804 — These two members are one piece of code written twice and then edited apart: 40 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (24 corresponding lines) · ×1
  • Edited copy of a member (24 corresponding lines) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.cs:73 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.cs:73-294 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.cs:301-340 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (32 corresponding lines) · ×1
  • Edited copy of a member (32 corresponding lines) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Diagram.cs:27 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Diagram.cs:27-61 | src/officecli/Handlers/Word/WordHandler.Add.Diagram.cs:31-63 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (14 corresponding lines) · ×1
  • Edited copy of a member (14 corresponding lines) src/officecli/Core/Chart/ChartHelper.Builder.cs:1258 — src/officecli/Core/Chart/ChartHelper.Builder.cs:1258-1361 | src/officecli/Core/Chart/ChartHelper.Builder.cs:2082-2103 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Members sharing a duplicated core (26 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (26 members, 50+ identical tokens) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Path.cs:57 — src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Path.cs:57-85 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:20-714 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:988-1129 | REDACTED:19-1505 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:19-36 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:540-694 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:697-826 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:829-957 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:960-1146 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:19-48 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:86-94 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:102-113 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:132-139 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:584-739 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:816-833 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1544-1563 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1573-1654 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1663-1693 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1801-1825 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1828-1843 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1850-1857 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1864-1872 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Table.cs:17-45 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Table.cs:47-147 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Table.cs:154-200 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Table.cs:203-221 — These 26 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 26 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 26 times.
D4 · Code Duplication · Members sharing a duplicated core (12 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (12 members, 50+ identical tokens) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1879 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1879-1901 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1910-1931 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1939-1960 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1968-1989 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1997-2018 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2025-2047 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2054-2076 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2084-2105 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2113-2130 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2137-2155 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2162-2184 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2192-2202 — These 12 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 12 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 12 times.
D4 · Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (7 members, 50+ identical tokens) src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:85 — src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:85-278 | src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:281-365 | src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:368-427 | src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:430-510 | src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:513-629 | src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:632-966 | src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:958-1138 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication · Duplicated block (150–162 lines × 2) · ×1
  • Duplicated block (150–162 lines × 2) src/officecli/Core/PivotTableHelper.Render.cs:1008 — src/officecli/Core/PivotTableHelper.Render.cs:1008-1169 | src/officecli/Core/PivotTableHelper.Render.cs:1442-1591 — both copies are in the same file, so extract the 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 (148–150 lines × 2) · ×1
  • Duplicated block (148–150 lines × 2) src/officecli/Handlers/Word/WordHandler.Add.Text.cs:984 — src/officecli/Handlers/Word/WordHandler.Add.Text.cs:984-1133 | src/officecli/Handlers/Word/WordHandler.Add.Text.cs:2332-2479 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Add.Text.cs:984` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/officecli/Handlers/Word/WordHandler.Add.Text.cs:1133` calls `TryGetValue`, `IsTruthy`, `ApplyRunFormatting` and `src/officecli/Handlers/Word/WordHandler.Add.Text.cs:2479` 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 (83–86 lines × 2) · ×1
  • Duplicated block (83–86 lines × 2) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:2734 — src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:2734-2819 | src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:2931-3013 — both copies are in the same file, so extract the 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 (81–84 lines × 2) · ×1
  • Duplicated block (81–84 lines × 2) src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:2292 — src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:2292-2375 | src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:2431-2511 — both copies are in the same file, so extract the 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 (53–61 lines × 2) · ×1
  • Duplicated block (53–61 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:73 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:73-125 | src/officecli/Handlers/Word/WordHandler.Set.Element.cs:512-572 — 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 (46–61 lines × 2) · ×1
  • Duplicated block (46–61 lines × 2) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:4721 — src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:4721-4766 | src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:3124-3184 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:4721` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:4718` calls `Contains`, `IsMatch` and `src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:3124` 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 (47–54 lines × 2) · ×1
  • Duplicated block (47–54 lines × 2) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:1316 — src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:1316-1369 | src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:1396-1442 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:1316` it does not close everything it opens, so those 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–46 lines × 2) · ×1
  • Duplicated block (19–46 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1223 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1223-1241 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1562-1607 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1223` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (3–46 lines × 3) · ×1
  • Duplicated block (3–46 lines × 3) src/officecli/Handlers/Word/WordHandler.Navigation.cs:6876 — src/officecli/Handlers/Word/WordHandler.Navigation.cs:6876-6878 | src/officecli/Handlers/Word/WordHandler.Query.cs:1547-1592 | src/officecli/Handlers/Word/WordHandler.Query.cs:1630-1669 — 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 `src/officecli/Handlers/Word/WordHandler.Query.cs:1547` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note 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, `src/officecli/Handlers/Word/WordHandler.Query.cs:1547` calls `FormatHexColor` and `src/officecli/Handlers/Word/WordHandler.Navigation.cs:6876` 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 (36–43 lines × 2) · ×1
  • Duplicated block (36–43 lines × 2) src/officecli/Core/PivotTableHelper.Definition.cs:446 — src/officecli/Core/PivotTableHelper.Definition.cs:446-488 | src/officecli/Core/PivotTableHelper.Set.cs:654-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 `src/officecli/Core/PivotTableHelper.Definition.cs:446` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (25–43 lines × 2) · ×1
  • Duplicated block (25–43 lines × 2) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:755 — src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:755-797 | src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:882-906 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:755` it does not close everything it opens, so those 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) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.FindReplace.cs:128 — src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.FindReplace.cs:128-169 | src/officecli/Handlers/Word/WordHandler.Helpers.FindReplace.cs:462-503 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.FindReplace.cs:128` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/officecli/Handlers/Word/WordHandler.Helpers.FindReplace.cs:503` calls `NormalizeNewlineChars` and `src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.FindReplace.cs: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.
D4 · Code Duplication · Duplicated block (31–41 lines × 2) · ×1
  • Duplicated block (31–41 lines × 2) REDACTED:71 — REDACTED:71-101 | src/officecli/Handlers/WordHandler.cs:223-263 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (37–41 lines × 2) · ×1
  • Duplicated block (37–41 lines × 2) src/officecli/Handlers/Word/WordHandler.View.cs:825 — src/officecli/Handlers/Word/WordHandler.View.cs:825-865 | src/officecli/Handlers/Word/WordHandler.View.cs:911-947 — both copies are in the same file, so extract the 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–40 lines × 5) · ×1
  • Duplicated block (22–40 lines × 5) REDACTED:1408 — REDACTED:1408-1447 | REDACTED:1574-1595 | REDACTED:1647-1668 | REDACTED:1823-1844 | REDACTED:2092-2113 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1408` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (32–40 lines × 2) · ×1
  • Duplicated block (32–40 lines × 2) src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:2855 — src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:2855-2894 | src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:3050-3081 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Add.Structure.cs:2855` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (34–40 lines × 2) · ×1
  • Duplicated block (34–40 lines × 2) src/officecli/Handlers/Word/WordHandler.Query.cs:3332 — src/officecli/Handlers/Word/WordHandler.Query.cs:3332-3371 | src/officecli/Handlers/Word/WordHandler.Query.cs:3420-3453 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Query.cs:3332` it does not close everything it opens, so those 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 (33–39 lines × 4) · ×1
  • Duplicated block (33–39 lines × 4) src/officecli/Core/PivotTableHelper.Render.cs:840 — src/officecli/Core/PivotTableHelper.Render.cs:840-878 | src/officecli/Core/PivotTableHelper.Render.cs:1230-1262 | src/officecli/Core/PivotTableHelper.Render.cs:1694-1726 | src/officecli/Core/PivotTableHelper.Render.cs:2433-2465 — 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 `src/officecli/Core/PivotTableHelper.Render.cs:840` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (30–39 lines × 2) · ×1
  • Duplicated block (30–39 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.View.cs:231 — src/officecli/Handlers/Pptx/PowerPointHandler.View.cs:231-269 | src/officecli/Handlers/Pptx/PowerPointHandler.View.cs:343-372 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.View.cs:231` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/officecli/Handlers/Pptx/PowerPointHandler.View.cs:273` calls `foreach` and `src/officecli/Handlers/Pptx/PowerPointHandler.View.cs:374` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (34–39 lines × 2) · ×1
  • Duplicated block (34–39 lines × 2) src/officecli/Handlers/Word/WordHandler.Navigation.cs:299 — src/officecli/Handlers/Word/WordHandler.Navigation.cs:299-337 | src/officecli/Handlers/Word/WordHandler.Query.cs:1037-1070 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (35–38 lines × 2) · ×1
  • Duplicated block (35–38 lines × 2) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:653 — src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:653-687 | src/officecli/Handlers/Word/WordBatchEmitter.Table.cs:1250-1287 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 (31–37 lines × 2) · ×1
  • Duplicated block (31–37 lines × 2) src/officecli/Core/AttributeFilter.cs:122 — src/officecli/Core/AttributeFilter.cs:122-158 | src/officecli/Core/AttributeFilter.cs:1527-1557 — both copies are in the same file, so extract the 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–37 lines × 2) · ×1
  • Duplicated block (30–37 lines × 2) src/officecli/Handlers/Word/WordHandler.Navigation.cs:2037 — src/officecli/Handlers/Word/WordHandler.Navigation.cs:2037-2073 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:2125-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. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Navigation.cs:2037` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (35–37 lines × 2) · ×1
  • Duplicated block (35–37 lines × 2) src/officecli/Handlers/Word/WordHandler.Navigation.DocSettings.cs:91 — src/officecli/Handlers/Word/WordHandler.Navigation.DocSettings.cs:91-125 | src/officecli/Handlers/Word/WordHandler.Query.cs:1207-1243 — before extracting anything, compare `src/officecli/Handlers/Word/WordHandler.Navigation.DocSettings.cs` and `src/officecli/Handlers/Word/WordHandler.Query.cs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 90 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 `src/officecli/Handlers/Word/WordHandler.Navigation.DocSettings.cs:91` it does not close everything it opens, so those 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 (33–36 lines × 2) · ×1
  • Duplicated block (33–36 lines × 2) src/officecli/Handlers/Word/WordHandler.Add.Table.cs:386 — src/officecli/Handlers/Word/WordHandler.Add.Table.cs:386-421 | src/officecli/Handlers/Word/WordHandler.Set.Element.cs:2862-2894 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Word/WordHandler.Add.Table.cs:386` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (28–35 lines × 2) · ×1
  • Duplicated block (28–35 lines × 2) src/officecli/Core/Chart/ChartHelper.Axis.cs:534 — src/officecli/Core/Chart/ChartHelper.Axis.cs:534-561 | src/officecli/Core/Chart/ChartHelper.Setter.cs:2026-2060 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Core/Chart/ChartHelper.Axis.cs:534` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/officecli/Core/Chart/ChartHelper.Axis.cs:564` calls `Add` and `src/officecli/Core/Chart/ChartHelper.Setter.cs:2061` 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 (24–35 lines × 2) · ×1
  • Duplicated block (24–35 lines × 2) src/officecli/Handlers/Word/WordHandler.Add.Text.cs:884 — src/officecli/Handlers/Word/WordHandler.Add.Text.cs:884-918 | src/officecli/Handlers/Word/WordHandler.Add.Text.cs:2257-2280 — both copies are in the same file, so extract the 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 lines × 2) · ×1
  • Duplicated block (31 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:2136 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:2136-2166 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Model3D.cs:160-190 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 (25–33 lines × 2) · ×1
  • Duplicated block (25–33 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Text.cs:215 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Text.cs:215-239 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Text.cs:663-695 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Add.Text.cs:215` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (23–33 lines × 2) · ×1
  • Duplicated block (23–33 lines × 2) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Markers.cs:159 — src/officecli/Handlers/Word/WordHandler.HtmlPreview.Markers.cs:159-181 | src/officecli/Handlers/Word/WordHandler.HtmlPreview.Markers.cs:210-242 — both copies are in the same file, so extract the 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 (28–33 lines × 2) · ×1
  • Duplicated block (28–33 lines × 2) src/officecli/Handlers/Word/WordHandler.Query.cs:1513 — src/officecli/Handlers/Word/WordHandler.Query.cs:1513-1545 | src/officecli/Handlers/Word/WordHandler.Query.cs:1601-1628 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Query.cs:1513` it does not close everything it opens, so those 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 (32 lines × 2) · ×1
  • Duplicated block (32 lines × 2) src/officecli/Handlers/Word/WordHandler.Add.Text.cs:920 — src/officecli/Handlers/Word/WordHandler.Add.Text.cs:920-951 | src/officecli/Handlers/Word/WordHandler.Add.Text.cs:2282-2313 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Add.Text.cs:920` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (17–32 lines × 2) · ×1
  • Duplicated block (17–32 lines × 2) src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:1129 — src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:1129-1160 | src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:1179-1195 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:1129` it does not close everything it opens, so those 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, `src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:1128` calls `SpacingBetweenLines` and `src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:1179` 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 (28–32 lines × 2) · ×1
  • Duplicated block (28–32 lines × 2) src/officecli/Handlers/Word/WordHandler.Query.cs:245 — src/officecli/Handlers/Word/WordHandler.Query.cs:245-276 | src/officecli/Handlers/Word/WordHandler.Set.cs:437-464 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Word/WordHandler.Query.cs:245` it begins part-way through the construct above it, so those 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 (23–31 lines × 2) · ×1
  • Duplicated block (23–31 lines × 2) src/officecli/Core/Chart/ChartExBuilder.cs:676 — src/officecli/Core/Chart/ChartExBuilder.cs:676-706 | src/officecli/Core/Chart/ChartExBuilder.cs:740-762 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartExBuilder.cs:676` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (15–31 lines × 2) · ×1
  • Duplicated block (15–31 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Set.cs:43 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.cs:43-57 | src/officecli/Handlers/Word/WordHandler.Set.cs:141-171 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Set.cs:43` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (29–31 lines × 2) · ×1
  • Duplicated block (29–31 lines × 2) src/officecli/Handlers/Word/WordHandler.Add.Media.cs:89 — src/officecli/Handlers/Word/WordHandler.Add.Media.cs:89-119 | src/officecli/Handlers/Word/WordHandler.Add.Media.cs:160-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. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Add.Media.cs:89` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (15–30 lines × 2) · ×1
  • Duplicated block (15–30 lines × 2) REDACTED:2434 — REDACTED:2434-2448 | src/officecli/Handlers/WordHandler.cs:2535-2564 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:2434` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (29–30 lines × 2) · ×1
  • Duplicated block (29–30 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2303 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2303-2332 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2509-2537 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2303` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2297` calls `IsNullOrEmpty` and `src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2505` 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 (27–30 lines × 2) · ×1
  • Duplicated block (27–30 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1310 — src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1310-1336 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2304-2333 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1310` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (4–30 lines × 3) · ×1
  • Duplicated block (4–30 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2158 — src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2158-2161 | REDACTED:494-523 | REDACTED:609-630 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (23–30 lines × 2) · ×1
  • Duplicated block (23–30 lines × 2) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:405 — src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:405-427 | src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:3012-3041 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:405` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (24–29 lines × 2) · ×1
  • Duplicated block (24–29 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Fill.cs:70 — src/officecli/Handlers/Pptx/PowerPointHandler.Fill.cs:70-93 | src/officecli/Handlers/Pptx/PowerPointHandler.Fill.cs:197-225 — both copies are in the same file, so extract the 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 (25–29 lines × 2) · ×1
  • Duplicated block (25–29 lines × 2) src/officecli/Handlers/Word/WordHandler.Navigation.cs:3710 — src/officecli/Handlers/Word/WordHandler.Navigation.cs:3710-3738 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:3767-3791 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Navigation.cs:3710` it begins part-way through the construct above it, so those 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 lines × 2) · ×1
  • Duplicated block (26 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Query.cs:1639 — src/officecli/Handlers/Excel/ExcelHandler.Query.cs:1639-1664 | src/officecli/Handlers/Excel/ExcelHandler.Query.cs:1670-1695 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.Query.cs:1639` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (25–28 lines × 2) · ×1
  • Duplicated block (25–28 lines × 2) REDACTED:1875 — REDACTED:1875-1899 | REDACTED:1930-1957 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1875` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (22–28 lines × 2) · ×1
  • Duplicated block (22–28 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2335 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2335-2362 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2540-2561 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:2335` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (2–28 lines × 3) · ×1
  • Duplicated block (2–28 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2108 — src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2108-2109 | REDACTED:463-490 | REDACTED:582-607 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:490` calls `ToString` and `src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2109` does not — after which the two agree again for 5 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–28 lines × 2) · ×1
  • Duplicated block (18–28 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:3381 — src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:3381-3408 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:3423-3440 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:3381` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (23–28 lines × 2) · ×1
  • Duplicated block (23–28 lines × 2) src/officecli/Handlers/Word/WordHandler.Query.cs:2447 — src/officecli/Handlers/Word/WordHandler.Query.cs:2447-2469 | src/officecli/Handlers/Word/WordHandler.Query.cs:2476-2503 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Query.cs:2447` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (22–27 lines × 3) · ×1
  • Duplicated block (22–27 lines × 3) REDACTED:1075 — REDACTED:1075-1101 | REDACTED:1188-1209 | REDACTED:1337-1359 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1075` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (22–27 lines × 2) · ×1
  • Duplicated block (22–27 lines × 2) src/officecli/Core/Chart/ChartHelper.Setter.cs:3188 — src/officecli/Core/Chart/ChartHelper.Setter.cs:3188-3214 | src/officecli/Core/Chart/ChartHelper.Setter.cs:3216-3237 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartHelper.Setter.cs:3188` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (12–27 lines × 2) · ×1
  • Duplicated block (12–27 lines × 2) src/officecli/Core/TypedAttributeFallback.cs:135 — src/officecli/Core/TypedAttributeFallback.cs:135-161 | src/officecli/Core/TypedAttributeFallback.cs:252-263 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/TypedAttributeFallback.cs:135` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (26–27 lines × 2) · ×1
  • Duplicated block (26–27 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1033 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1033-1059 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1134-1159 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1134` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (18–27 lines × 2) · ×1
  • Duplicated block (18–27 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1195 — src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1195-1212 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2111-2137 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1195` it does not close everything it opens, so those 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–27 lines × 2) · ×1
  • Duplicated block (16–27 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1335 — src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1335-1350 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2427-2453 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1335` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (17–27 lines × 2) · ×1
  • Duplicated block (17–27 lines × 2) src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:1711 — src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:1711-1727 | src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:2345-2371 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (19–27 lines × 2) · ×1
  • Duplicated block (19–27 lines × 2) REDACTED:307 — REDACTED:307-333 | REDACTED:852-870 — both copies are in the same file, so extract the 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–26 lines × 3) · ×1
  • Duplicated block (22–26 lines × 3) src/officecli/Handlers/Excel/ExcelHandler.Set.Ranges.cs:661 — src/officecli/Handlers/Excel/ExcelHandler.Set.Ranges.cs:661-686 | src/officecli/Handlers/Excel/ExcelHandler.Set.Ranges.cs:698-719 | src/officecli/Handlers/Excel/ExcelHandler.Set.Ranges.cs:730-751 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (25–26 lines × 2) · ×1
  • Duplicated block (25–26 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:1756 — src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:1756-1780 | src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:1901-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. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:1756` it does not close everything it opens, so those 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 (23–25 lines × 3) · ×1
  • Duplicated block (23–25 lines × 3) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Ole.cs:49 — src/officecli/Handlers/Excel/ExcelHandler.Helpers.Ole.cs:49-73 | src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Ole.cs:41-63 | src/officecli/Handlers/Word/WordHandler.Query.cs:68-91 — 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 `src/officecli/Handlers/Excel/ExcelHandler.Helpers.Ole.cs: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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (20–25 lines × 3) · ×1
  • Duplicated block (20–25 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:1637 — src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:1637-1661 | src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2082-2102 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:2203-2222 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:1637` it does not close everything it opens, so those 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 (21–25 lines × 2) · ×1
  • Duplicated block (21–25 lines × 2) src/officecli/Core/Chart/ChartHelper.Setter.cs:3961 — src/officecli/Core/Chart/ChartHelper.Setter.cs:3961-3985 | src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:536-556 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Core/Chart/ChartHelper.Setter.cs:3961` it does not close everything it opens, so those 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, `src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:558` calls `EnsureDataPoint` and `src/officecli/Core/Chart/ChartHelper.Setter.cs:3991` 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 (22–25 lines × 2) · ×1
  • Duplicated block (22–25 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Set.Drawings.cs:136 — src/officecli/Handlers/Excel/ExcelHandler.Set.Drawings.cs:136-157 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:845-869 — 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 `src/officecli/Handlers/Excel/ExcelHandler.Set.Drawings.cs: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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:844` calls `First` and `src/officecli/Handlers/Excel/ExcelHandler.Set.Drawings.cs:135` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (4–25 lines × 3) · ×1
  • Duplicated block (4–25 lines × 3) src/officecli/Handlers/Word/WordHandler.Add.Text.cs:1136 — src/officecli/Handlers/Word/WordHandler.Add.Text.cs:1136-1160 | src/officecli/Handlers/Word/WordHandler.Add.Text.cs:2496-2520 | src/officecli/Handlers/Word/WordHandler.Helpers.RunFormat.cs:981-984 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (16–25 lines × 2) · ×1
  • Duplicated block (16–25 lines × 2) src/officecli/Handlers/Word/WordHandler.Helpers.Chart.cs:238 — src/officecli/Handlers/Word/WordHandler.Helpers.Chart.cs:238-253 | src/officecli/Handlers/Word/WordHandler.ImageHelpers.cs:840-864 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Word/WordHandler.Helpers.Chart.cs:238` it does not close everything it opens, so those 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 (21–24 lines × 3) · ×1
  • Duplicated block (21–24 lines × 3) REDACTED:986 — REDACTED:986-1006 | REDACTED:1134-1157 | REDACTED:1251-1271 — 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 (14–24 lines × 2) · ×1
  • Duplicated block (14–24 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:115 — src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:115-138 | src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:604-617 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:115` it begins part-way through the construct above it, so those 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 (20–24 lines × 2) · ×1
  • Duplicated block (20–24 lines × 2) REDACTED:3968 — REDACTED:3968-3991 | REDACTED:4113-4132 — both copies are in the same file, so extract the 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–24 lines × 2) · ×1
  • Duplicated block (18–24 lines × 2) src/officecli/Handlers/Word/WordHandler.Add.Media.cs:908 — src/officecli/Handlers/Word/WordHandler.Add.Media.cs:908-925 | src/officecli/Handlers/Word/WordHandler.Add.Media.cs:1239-1262 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Add.Media.cs:908` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (18–23 lines × 6) · ×1
  • Duplicated block (18–23 lines × 6) src/officecli/Handlers/Pptx/PowerPointHandler.Effects.cs:271 — src/officecli/Handlers/Pptx/PowerPointHandler.Effects.cs:271-288 | src/officecli/Handlers/Pptx/PowerPointHandler.Fill.cs:933-950 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:1849-1871 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:1915-1932 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:1981-1998 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:2111-2128 — there are 6 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Effects.cs: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.
D4 · Code Duplication · Duplicated block (17–23 lines × 4) · ×1
  • Duplicated block (17–23 lines × 4) src/officecli/Core/PivotTableHelper.Render.cs:685 — src/officecli/Core/PivotTableHelper.Render.cs:685-707 | src/officecli/Core/PivotTableHelper.Render.cs:1006-1023 | src/officecli/Core/PivotTableHelper.Render.cs:1440-1456 | src/officecli/Core/PivotTableHelper.Render.cs:1954-1971 — 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 (21–23 lines × 2) · ×1
  • Duplicated block (21–23 lines × 2) src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:278 — src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:278-298 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:787-809 — 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 `src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:278` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (11–23 lines × 2) · ×1
  • Duplicated block (11–23 lines × 2) REDACTED:2011 — REDACTED:2011-2021 | REDACTED:2036-2058 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:2022` calls `AddImagePart` and `REDACTED:2059` 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 (18–23 lines × 2) · ×1
  • Duplicated block (18–23 lines × 2) src/officecli/Handlers/Word/WordHandler.Navigation.cs:6670 — src/officecli/Handlers/Word/WordHandler.Navigation.cs:6670-6692 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:6965-6982 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Navigation.cs:6965` it does not close everything it opens, so those 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) src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs:558 — src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs:558-580 | src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs:785-804 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs:558` it begins part-way through the construct above it, so those 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–22 lines × 4) · ×1
  • Duplicated block (19–22 lines × 4) REDACTED:4656 — REDACTED:4656-4677 | REDACTED:4818-4836 | REDACTED:4877-4895 | REDACTED:4944-4962 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:4656` it does not close everything it opens, so those 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 × 3) · ×1
  • Duplicated block (20–22 lines × 3) src/officecli/Handlers/Excel/ExcelHandler.View.cs:962 — src/officecli/Handlers/Excel/ExcelHandler.View.cs:962-983 | src/officecli/Handlers/Pptx/PowerPointHandler.View.cs:1125-1145 | src/officecli/Handlers/Word/WordHandler.View.cs:1493-1512 — 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 `src/officecli/Handlers/Excel/ExcelHandler.View.cs:962` it begins part-way through the construct above it, so those 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–22 lines × 3) · ×1
  • Duplicated block (10–22 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2110 — src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2110-2131 | REDACTED:494-509 | REDACTED:609-618 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2110` it does not close everything it opens, so those 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–21 lines × 6) · ×1
  • Duplicated block (10–21 lines × 6) REDACTED:1405 — REDACTED:1405-1425 | REDACTED:1571-1580 | REDACTED:1644-1653 | REDACTED:1820-1829 | REDACTED:2089-2098 | REDACTED:2144-2153 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1405` it begins part-way through the construct above it, so those 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, `REDACTED:1569` calls `Match` and `REDACTED:1643` 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 (18–21 lines × 5) · ×1
  • Duplicated block (18–21 lines × 5) src/officecli/Handlers/Word/WordHandler.Query.cs:2825 — src/officecli/Handlers/Word/WordHandler.Query.cs:2825-2845 | src/officecli/Handlers/Word/WordHandler.Query.cs:2860-2877 | src/officecli/Handlers/Word/WordHandler.Query.cs:2917-2936 | src/officecli/Handlers/Word/WordHandler.Query.cs:2955-2975 | src/officecli/Handlers/Word/WordHandler.Query.cs:2989-3009 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Query.cs:2825` it begins part-way through the construct above it, so those 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–21 lines × 3) · ×1
  • Duplicated block (20–21 lines × 3) src/officecli/Core/PivotTableHelper.Render.cs:612 — src/officecli/Core/PivotTableHelper.Render.cs:612-631 | src/officecli/Core/PivotTableHelper.Render.cs:935-954 | src/officecli/Core/PivotTableHelper.Render.cs:1327-1347 — 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 `src/officecli/Core/PivotTableHelper.Render.cs:612` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (19–21 lines × 2) · ×1
  • Duplicated block (19–21 lines × 2) src/officecli/Handlers/Word/WordHandler.Query.cs:2020 — src/officecli/Handlers/Word/WordHandler.Query.cs:2020-2040 | src/officecli/Handlers/Word/WordHandler.Query.cs:2248-2266 — both copies are in the same file, so extract the 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 (7–20 lines × 5) · ×1
  • Duplicated block (7–20 lines × 5) src/officecli/Handlers/Word/WordHandler.Mutations.cs:2331 — src/officecli/Handlers/Word/WordHandler.Mutations.cs:2331-2350 | src/officecli/Handlers/Word/WordHandler.Mutations.cs:2361-2380 | src/officecli/Handlers/Word/WordHandler.Mutations.cs:2391-2410 | src/officecli/Handlers/Word/WordHandler.Mutations.cs:2421-2440 | src/officecli/Handlers/Word/WordHandler.Mutations.cs:2451-2457 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Mutations.cs:2331` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (17–20 lines × 3) · ×1
  • Duplicated block (17–20 lines × 3) src/officecli/Handlers/Excel/ExcelHandler.Helpers.Sheet.cs:457 — src/officecli/Handlers/Excel/ExcelHandler.Helpers.Sheet.cs:457-476 | src/officecli/Handlers/Excel/ExcelHandler.Helpers.Sheet.cs:498-515 | src/officecli/Handlers/Excel/ExcelHandler.Helpers.Sheet.cs:579-595 — 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 `src/officecli/Handlers/Excel/ExcelHandler.Helpers.Sheet.cs:457` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (17–20 lines × 2) · ×1
  • Duplicated block (17–20 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:88 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:88-107 | src/officecli/Handlers/Pptx/PowerPointHandler.SvgPreview.cs:267-283 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:88` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `null` to `int? slideNumber =` in one and `(long x, long y, long cx, long cy)? overridePos =` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (16–20 lines × 2) · ×1
  • Duplicated block (16–20 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Chart.cs:84 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Chart.cs:84-103 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1617-1632 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Set.Chart.cs:84` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (12–20 lines × 2) · ×1
  • Duplicated block (12–20 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:575 — src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:575-594 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:3228-3239 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:575` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (8–19 lines × 3) · ×1
  • Duplicated block (8–19 lines × 3) src/officecli/Handlers/Word/WordHandler.Navigation.cs:2330 — src/officecli/Handlers/Word/WordHandler.Navigation.cs:2330-2348 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:2358-2365 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:2369-2376 — 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 `src/officecli/Handlers/Word/WordHandler.Navigation.cs:2330` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (19 lines × 3) · ×1
  • Duplicated block (19 lines × 3) src/officecli/Handlers/Word/WordHandler.Set.cs:1734 — src/officecli/Handlers/Word/WordHandler.Set.cs:1734-1752 | src/officecli/Handlers/Word/WordHandler.Set.cs:1870-1888 | src/officecli/Handlers/Word/WordHandler.Set.cs:2037-2055 — 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 `src/officecli/Handlers/Word/WordHandler.Set.cs:1870` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10–19 lines × 2) · ×1
  • Duplicated block (10–19 lines × 2) src/officecli/CommandBuilder.View.cs:354 — src/officecli/CommandBuilder.View.cs:354-372 | src/officecli/ResidentServer.cs:1697-1706 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/CommandBuilder.View.cs:354` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (8–19 lines × 2) · ×1
  • Duplicated block (8–19 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2667 — src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2667-2674 | src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2716-2734 — both copies are in the same file, so extract the 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–19 lines × 2) · ×1
  • Duplicated block (14–19 lines × 2) REDACTED:2512 — REDACTED:2512-2525 | REDACTED:2605-2623 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (15–18 lines × 3) · ×1
  • Duplicated block (15–18 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:1040 — src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:1040-1057 | src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:1771-1785 | src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:1917-1931 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:1040` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (12–18 lines × 2) · ×1
  • Duplicated block (12–18 lines × 2) src/officecli/Core/PivotTableHelper.Cache.cs:1058 — src/officecli/Core/PivotTableHelper.Cache.cs:1058-1069 | src/officecli/Core/PivotTableHelper.cs:1223-1240 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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–18 lines × 2) · ×1
  • Duplicated block (8–18 lines × 2) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:3502 — src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:3502-3509 | src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:718-735 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:3502` it does not close everything it opens, so those 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–18 lines × 2) · ×1
  • Duplicated block (13–18 lines × 2) src/officecli/Handlers/Word/WordHandler.Navigation.cs:4260 — src/officecli/Handlers/Word/WordHandler.Navigation.cs:4260-4272 | src/officecli/Handlers/Word/WordHandler.Query.cs:912-929 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (12–17 lines × 3) · ×1
  • Duplicated block (12–17 lines × 3) src/officecli/Handlers/Word/WordHandler.Navigation.DocSettings.cs:30 — src/officecli/Handlers/Word/WordHandler.Navigation.DocSettings.cs:30-44 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:4648-4664 | src/officecli/Handlers/Word/WordHandler.Query.cs:1258-1269 — before extracting anything, compare `src/officecli/Handlers/Word/WordHandler.Navigation.DocSettings.cs` and `src/officecli/Handlers/Word/WordHandler.Query.cs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 90 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 `src/officecli/Handlers/Word/WordHandler.Navigation.DocSettings.cs:30` it does not close everything it opens, so those 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–17 lines × 2) · ×1
  • Duplicated block (12–17 lines × 2) src/officecli/Core/Chart/ChartHelper.Builder.cs:185 — src/officecli/Core/Chart/ChartHelper.Builder.cs:185-196 | src/officecli/Core/Chart/ChartHelper.Builder.cs:1072-1088 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (11–17 lines × 2) · ×1
  • Duplicated block (11–17 lines × 2) src/officecli/Core/Chart/ChartHelper.Setter.cs:719 — src/officecli/Core/Chart/ChartHelper.Setter.cs:719-735 | src/officecli/Core/Chart/ChartHelper.Setter.cs:3548-3558 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartHelper.Setter.cs:719` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (14–16 lines × 5) · ×1
  • Duplicated block (14–16 lines × 5) src/officecli/Handlers/Excel/ExcelHandler.Set.Sheet.cs:277 — src/officecli/Handlers/Excel/ExcelHandler.Set.Sheet.cs:277-290 | src/officecli/Handlers/Excel/ExcelHandler.Set.Sheet.cs:423-436 | src/officecli/Handlers/Excel/ExcelHandler.Set.Sheet.cs:444-457 | src/officecli/Handlers/Excel/ExcelHandler.Set.Sheet.cs:461-474 | src/officecli/Handlers/Excel/ExcelHandler.Set.Sheet.cs:478-493 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.Set.Sheet.cs:277` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14–16 lines × 4) · ×1
  • Duplicated block (14–16 lines × 4) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1291 — src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1291-1306 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1358-1371 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1513-1526 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1584-1597 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1291` it does not close everything it opens, so those 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, `src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1528` calls `InvalidOperationException` and `src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1307` 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 lines × 3) · ×1
  • Duplicated block (16 lines × 3) src/officecli/Core/Formula/ModernFunctionQualifier.cs:325 — src/officecli/Core/Formula/ModernFunctionQualifier.cs:325-345 | src/officecli/Core/Formula/ModernFunctionQualifier.cs:422-437 | src/officecli/Core/Formula/ModernFunctionQualifier.cs:443-461 — 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 `src/officecli/Core/Formula/ModernFunctionQualifier.cs:325` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (7–16 lines × 2) · ×1
  • Duplicated block (7–16 lines × 2) src/officecli/Core/Chart/ChartHelper.Reader.cs:360 — src/officecli/Core/Chart/ChartHelper.Reader.cs:360-366 | src/officecli/Core/Chart/ChartHelper.Reader.cs:1486-1501 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartHelper.Reader.cs:360` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9–16 lines × 2) · ×1
  • Duplicated block (9–16 lines × 2) src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:443 — src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:443-458 | src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:475-483 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs:443` it does not close everything it opens, so those 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 (2–16 lines × 4) · ×1
  • Duplicated block (2–16 lines × 4) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1898 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1898-1900 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2029-2044 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2058-2073 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2102-2103 — 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. 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 (4–16 lines × 3) · ×1
  • Duplicated block (4–16 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2161 — src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2161-2164 | REDACTED:527-542 | REDACTED:634-647 — 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 `REDACTED:527` it does not close everything it opens, so those 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, `REDACTED:526` calls `FormatPptSpacing` and `src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2161` 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–15 lines × 6) · ×1
  • Duplicated block (8–15 lines × 6) src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:281 — src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:281-290 | src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:368-377 | src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:430-439 | src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:513-524 | src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:632-639 | src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:958-972 — there are 6 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:281` it does not close everything it opens, so those 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 × 4) · ×1
  • Duplicated block (15 lines × 4) src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:351 — src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:351-365 | src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:413-427 | src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:496-510 | src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:615-629 — 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 `src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:351` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10–15 lines × 4) · ×1
  • Duplicated block (10–15 lines × 4) src/officecli/Handlers/Pptx/PptxBatchEmitter.Notes.cs:42 — src/officecli/Handlers/Pptx/PptxBatchEmitter.Notes.cs:42-52 | src/officecli/Handlers/Pptx/PptxBatchEmitter.Notes.cs:188-202 | src/officecli/Handlers/Pptx/PptxBatchEmitter.Notes.cs:236-245 | src/officecli/Handlers/Pptx/PptxBatchEmitter.Notes.cs:263-272 — 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, `src/officecli/Handlers/Pptx/PptxBatchEmitter.Notes.cs:247` calls `TryGetValue` and `src/officecli/Handlers/Pptx/PptxBatchEmitter.Notes.cs:204` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (3–15 lines × 4) · ×1
  • Duplicated block (3–15 lines × 4) src/officecli/Core/Chart/ChartSvgRenderer.cs:4368 — src/officecli/Core/Chart/ChartSvgRenderer.cs:4368-4381 | src/officecli/Core/Chart/ChartSvgRenderer.cs:4451-4464 | src/officecli/Core/Chart/ChartSvgRenderer.cs:4493-4507 | REDACTED:604-606 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartSvgRenderer.cs:4368` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (14–15 lines × 3) · ×1
  • Duplicated block (14–15 lines × 3) src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:471 — src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:471-485 | src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:585-598 | src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:937-950 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (9–15 lines × 3) · ×1
  • Duplicated block (9–15 lines × 3) src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:653 — src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:653-663 | src/officecli/Handlers/Word/WordBatchEmitter.Table.cs:1250-1264 | src/officecli/Handlers/Word/WordBatchEmitter.cs:863-871 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 `src/officecli/Handlers/Word/WordBatchEmitter.Paragraph.cs:653` it does not close everything it opens, so those 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) src/officecli/Core/Chart/ChartSvgRenderer.CxExtract.cs:217 — src/officecli/Core/Chart/ChartSvgRenderer.CxExtract.cs:217-231 | src/officecli/Core/Chart/ChartSvgRenderer.cs:3818-3825 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/officecli/Core/Chart/ChartSvgRenderer.cs:3817` calls `ExtractFontColor`, `CssHexColor` and `src/officecli/Core/Chart/ChartSvgRenderer.CxExtract.cs:217` 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 (4–15 lines × 3) · ×1
  • Duplicated block (4–15 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:277 — src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:277-280 | REDACTED:1136-1150 | REDACTED:1456-1467 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (11–15 lines × 2) · ×1
  • Duplicated block (11–15 lines × 2) src/officecli/Handlers/WordHandler.cs:855 — src/officecli/Handlers/WordHandler.cs:855-865 | src/officecli/Handlers/WordHandler.cs:891-905 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/WordHandler.cs:855` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (14 lines × 5) · ×1
  • Duplicated block (14 lines × 5) src/officecli/Core/PivotTableHelper.Render.cs:518 — src/officecli/Core/PivotTableHelper.Render.cs:518-531 | src/officecli/Core/PivotTableHelper.Render.cs:858-871 | src/officecli/Core/PivotTableHelper.Render.cs:1242-1255 | src/officecli/Core/PivotTableHelper.Render.cs:1706-1719 | src/officecli/Core/PivotTableHelper.Render.cs:2445-2458 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/PivotTableHelper.Render.cs:518` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (12–14 lines × 4) · ×1
  • Duplicated block (12–14 lines × 4) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:586 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:586-599 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1547-1558 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1578-1589 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1667-1678 — 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, `src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1575` calls `Parse`, `ToLowerInvariant` and `src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:585` 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–14 lines × 3) · ×1
  • Duplicated block (10–14 lines × 3) src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:122 — src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:122-135 | src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:605-614 | src/officecli/Handlers/Excel/ExcelHandler.Slicer.cs:655-668 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 `src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:122` it does not close everything it opens, so those 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 lines × 3) · ×1
  • Duplicated block (14 lines × 3) src/officecli/Handlers/Excel/ExcelHandler.Set.cs:60 — src/officecli/Handlers/Excel/ExcelHandler.Set.cs:60-77 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.cs:44-57 | src/officecli/Handlers/Word/WordHandler.Set.cs:142-171 — 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 `src/officecli/Handlers/Excel/ExcelHandler.Set.cs:60` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (11–14 lines × 3) · ×1
  • Duplicated block (11–14 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1362 — src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1362-1375 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2332-2343 | REDACTED:910-920 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1362` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1379` calls `ReadColorFromHighlight` and `src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2344` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (13–14 lines × 3) · ×1
  • Duplicated block (13–14 lines × 3) src/officecli/Handlers/Pptx/PptxBatchEmitter.Resources.cs:34 — src/officecli/Handlers/Pptx/PptxBatchEmitter.Resources.cs:34-46 | src/officecli/Handlers/Pptx/PptxBatchEmitter.cs:1542-1555 | src/officecli/Handlers/Word/WordBatchEmitter.Resources.cs:77-89 — 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 (9–14 lines × 3) · ×1
  • Duplicated block (9–14 lines × 3) src/officecli/Handlers/Word/WordHandler.Mutations.cs:132 — src/officecli/Handlers/Word/WordHandler.Mutations.cs:132-145 | src/officecli/Handlers/Word/WordHandler.Query.cs:118-126 | src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs:2148-2158 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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.
D4 · Code Duplication · Duplicated block (3–14 lines × 3) · ×1
  • Duplicated block (3–14 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:274 — src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:274-276 | REDACTED:1121-1134 | REDACTED:1440-1454 — 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 (10–14 lines × 2) · ×1
  • Duplicated block (10–14 lines × 2) src/officecli/Handlers/Word/WordHandler.FormFields.cs:182 — src/officecli/Handlers/Word/WordHandler.FormFields.cs:182-195 | src/officecli/Handlers/Word/WordHandler.FormFields.cs:237-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. 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 lines × 4) · ×1
  • Duplicated block (13 lines × 4) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:2027 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:2027-2039 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:2131-2143 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Model3D.cs:101-113 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Model3D.cs:155-167 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (9–13 lines × 3) · ×1
  • Duplicated block (9–13 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2479 — src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2479-2491 | src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2523-2532 | src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2577-2585 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:2479` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10–13 lines × 3) · ×1
  • Duplicated block (10–13 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:61 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:61-73 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:1327-1336 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Text.cs:831-843 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Note first that the copies are not typed on the same thing: the declarations holding them bind `null` to `int? slideNumber =` in one and `string? dataPath =` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (11–13 lines × 3) · ×1
  • Duplicated block (11–13 lines × 3) src/officecli/Handlers/Word/WordHandler.View.cs:86 — src/officecli/Handlers/Word/WordHandler.View.cs:86-98 | src/officecli/Handlers/Word/WordHandler.View.cs:272-282 | src/officecli/Handlers/Word/WordHandler.View.cs:703-715 — 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 `src/officecli/Handlers/Word/WordHandler.View.cs:86` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/officecli/Handlers/Word/WordHandler.View.cs:717` calls `Add` and `src/officecli/Handlers/Word/WordHandler.View.cs:100` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (4–13 lines × 4) · ×1
  • Duplicated block (4–13 lines × 4) src/officecli/Handlers/Excel/ExcelHandler.Query.cs:24 — src/officecli/Handlers/Excel/ExcelHandler.Query.cs:24-36 | REDACTED:84-96 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:225-228 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:232-235 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (9–13 lines × 2) · ×1
  • Duplicated block (9–13 lines × 2) src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.RunFormat.cs:514 — src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.RunFormat.cs:514-526 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:502-510 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 (11–12 lines × 8) · ×1
  • Duplicated block (11–12 lines × 8) src/officecli/Handlers/Pptx/PowerPointHandler.Effects.cs:274 — src/officecli/Handlers/Pptx/PowerPointHandler.Effects.cs:274-284 | src/officecli/Handlers/Pptx/PowerPointHandler.Fill.cs:338-348 | src/officecli/Handlers/Pptx/PowerPointHandler.Fill.cs:936-946 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:1855-1865 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:1918-1928 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:1984-1994 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:2114-2124 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:2184-2195 — there are 8 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 8 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, `src/officecli/Handlers/Pptx/PowerPointHandler.Fill.cs:338` calls `GradientFill` and `src/officecli/Handlers/Pptx/PowerPointHandler.Effects.cs:274` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (10–12 lines × 8) · ×1
  • Duplicated block (10–12 lines × 8) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:20 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:20-30 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:962-973 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:585-595 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:817-827 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1546-1555 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1577-1586 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1666-1675 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Table.cs:204-214 — there are 8 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 8 sites; resolving a subset leaves the remainder to drift apart. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1575` calls `Parse`, `ToLowerInvariant` and `src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:20` 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–12 lines × 5) · ×1
  • Duplicated block (10–12 lines × 5) src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:105 — src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:105-115 | src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:323-332 | src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:650-659 | src/officecli/Handlers/Excel/ExcelHandler.Add.cs:1085-1096 | src/officecli/Handlers/Excel/ExcelHandler.Add.cs:1224-1233 — there are 5 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.Add.cs:1085` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10–12 lines × 4) · ×1
  • Duplicated block (10–12 lines × 4) src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:471 — src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:471-482 | src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:585-595 | src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:937-947 | src/officecli/Handlers/Excel/ExcelHandler.Set.Tables.cs:1065-1074 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/officecli/Handlers/Excel/ExcelHandler.Set.Tables.cs:1075` calls `DifferentialFormat` and `src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:483` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8–12 lines × 2) · ×1
  • Duplicated block (8–12 lines × 2) src/officecli/CommandBuilder.View.cs:579 — src/officecli/CommandBuilder.View.cs:579-590 | src/officecli/ResidentServer.cs:1833-1840 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — 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 `src/officecli/CommandBuilder.View.cs:579` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (9–12 lines × 2) · ×1
  • Duplicated block (9–12 lines × 2) src/officecli/Handlers/Word/WordHandler.Set.Element.cs:1594 — src/officecli/Handlers/Word/WordHandler.Set.Element.cs:1594-1605 | src/officecli/Handlers/Word/WordHandler.Set.Element.cs:1625-1633 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Set.Element.cs:1594` it does not close everything it opens, so those 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–11 lines × 13) · ×1
  • Duplicated block (10–11 lines × 13) src/officecli/Handlers/Word/WordHandler.Query.cs:1897 — src/officecli/Handlers/Word/WordHandler.Query.cs:1897-1906 | src/officecli/Handlers/Word/WordHandler.Query.cs:1978-1987 | src/officecli/Handlers/Word/WordHandler.Query.cs:2004-2013 | src/officecli/Handlers/Word/WordHandler.Query.cs:2057-2067 | src/officecli/Handlers/Word/WordHandler.Query.cs:2083-2092 | src/officecli/Handlers/Word/WordHandler.Query.cs:2424-2433 | src/officecli/Handlers/Word/WordHandler.Query.cs:2568-2577 | src/officecli/Handlers/Word/WordHandler.Query.cs:2615-2624 | src/officecli/Handlers/Word/WordHandler.Query.cs:2654-2663 | src/officecli/Handlers/Word/WordHandler.Query.cs:2676-2685 | src/officecli/Handlers/Word/WordHandler.Query.cs:2774-2783 | src/officecli/Handlers/Word/WordHandler.Query.cs:2942-2951 | src/officecli/Handlers/Word/WordHandler.Query.cs:3264-3273 — all 13 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (7–11 lines × 6) · ×1
  • Duplicated block (7–11 lines × 6) src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:123 — src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:123-131 | src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:283-291 | src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:370-378 | src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:432-440 | src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:517-527 | src/officecli/Handlers/Excel/ExcelHandler.Add.Cf.cs:634-640 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. 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 × 5) · ×1
  • Duplicated block (10–11 lines × 5) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:903 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:903-913 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:1051-1061 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:1172-1181 | src/officecli/Handlers/Pptx/SlideComposition.cs:215-225 | src/officecli/Handlers/Pptx/SlideComposition.cs:279-289 — there are 5 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 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Shapes.cs:903` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (9–11 lines × 4) · ×1
  • Duplicated block (9–11 lines × 4) src/officecli/Handlers/Excel/ExcelHandler.Query.cs:726 — src/officecli/Handlers/Excel/ExcelHandler.Query.cs:726-735 | src/officecli/Handlers/Excel/ExcelHandler.Query.cs:1405-1413 | src/officecli/Handlers/Word/WordHandler.Query.cs:564-574 | src/officecli/Handlers/Word/WordHandler.Query.cs:2280-2289 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Excel/ExcelHandler.Query.cs:726` it does not close everything it opens, so those 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–11 lines × 4) · ×1
  • Duplicated block (6–11 lines × 4) src/officecli/Handlers/Pptx/PptxBatchEmitter.Shape.cs:148 — src/officecli/Handlers/Pptx/PptxBatchEmitter.Shape.cs:148-153 | src/officecli/Handlers/Pptx/PptxBatchEmitter.Shape.cs:348-358 | src/officecli/Handlers/Pptx/PptxBatchEmitter.Shape.cs:469-477 | src/officecli/Handlers/Pptx/PptxBatchEmitter.Shape.cs:668-674 — 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 `src/officecli/Handlers/Pptx/PptxBatchEmitter.Shape.cs:348` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (4–11 lines × 4) · ×1
  • Duplicated block (4–11 lines × 4) src/officecli/Handlers/Excel/ExcelHandler.DumpSupport.cs:81 — src/officecli/Handlers/Excel/ExcelHandler.DumpSupport.cs:81-93 | src/officecli/Handlers/Excel/ExcelHandler.Helpers.Node.cs:163-175 | src/officecli/Handlers/Excel/ExcelHandler.Query.cs:621-631 | src/officecli/Handlers/Excel/ExcelHandler.Query.cs:1830-1833 — 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. The matched lines also transfer control out of the body holding them, 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 (10–11 lines × 3) · ×1
  • Duplicated block (10–11 lines × 3) src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:53 — src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:53-62 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:51-61 | src/officecli/Handlers/Word/WordHandler.Mutations.cs:52-62 — 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 `src/officecli/Handlers/Excel/ExcelHandler.Remove.cs:53` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9–11 lines × 3) · ×1
  • Duplicated block (9–11 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:777 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:777-786 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:824-832 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Table.cs:260-270 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (4–11 lines × 3) · ×1
  • Duplicated block (4–11 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1686 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1686-1696 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1709-1719 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1753-1756 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1686` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1756` calls `Clamp`, `P`, `ToString` and `src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1696` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (10 lines × 6) · ×1
  • Duplicated block (10 lines × 6) src/officecli/CommandBuilder.Add.cs:48 — src/officecli/CommandBuilder.Add.cs:48-57 | src/officecli/CommandBuilder.Add.cs:431-440 | src/officecli/CommandBuilder.Batch.cs:197-206 | src/officecli/CommandBuilder.Import.cs:31-40 | src/officecli/CommandBuilder.Set.cs:23-32 | src/officecli/CommandBuilder.View.cs:48-57 — there are 6 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 6 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/CommandBuilder.Add.cs:48` it does not close everything it opens, so those 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, `src/officecli/CommandBuilder.Add.cs:61` calls `Begin` and `src/officecli/CommandBuilder.Add.cs:442` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (7–10 lines × 4) · ×1
  • Duplicated block (7–10 lines × 4) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:776 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:776-785 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:823-831 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1222-1228 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1560-1569 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs:776` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (10 lines × 4) · ×1
  • Duplicated block (10 lines × 4) src/officecli/Handlers/Word/WordHandler.View.cs:87 — src/officecli/Handlers/Word/WordHandler.View.cs:87-98 | src/officecli/Handlers/Word/WordHandler.View.cs:173-184 | src/officecli/Handlers/Word/WordHandler.View.cs:273-282 | src/officecli/Handlers/Word/WordHandler.View.cs:704-715 — 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 `src/officecli/Handlers/Word/WordHandler.View.cs:87` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/officecli/Handlers/Word/WordHandler.View.cs:717` calls `Add` and `src/officecli/Handlers/Word/WordHandler.View.cs:100` 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–10 lines × 2) · ×1
  • Duplicated block (6–10 lines × 2) src/officecli/Core/Chart/ChartHelper.Builder.cs:1297 — src/officecli/Core/Chart/ChartHelper.Builder.cs:1297-1306 | src/officecli/Core/Chart/ChartHelper.Builder.cs:1307-1312 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (7–10 lines × 2) · ×1
  • Duplicated block (7–10 lines × 2) src/officecli/Core/PivotTableHelper.Cache.cs:1150 — src/officecli/Core/PivotTableHelper.Cache.cs:1150-1159 | src/officecli/Core/PivotTableHelper.Cache.cs:1323-1329 — both copies are in the same file, so extract the 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 (9 lines × 14) · ×1
  • Duplicated block (9 lines × 14) src/officecli/CommandBuilder.Add.cs:50 — src/officecli/CommandBuilder.Add.cs:50-58 | src/officecli/CommandBuilder.Add.cs:353-361 | src/officecli/CommandBuilder.Add.cs:433-441 | src/officecli/CommandBuilder.Batch.cs:199-207 | src/officecli/CommandBuilder.Dump.cs:32-40 | src/officecli/CommandBuilder.GetQuery.cs:21-29 | src/officecli/CommandBuilder.GetQuery.cs:178-186 | src/officecli/CommandBuilder.Import.cs:33-41 | src/officecli/CommandBuilder.Import.cs:276-284 | src/officecli/CommandBuilder.Import.cs:430-438 | src/officecli/CommandBuilder.Raw.cs:24-32 | src/officecli/CommandBuilder.Raw.cs:69-77 | src/officecli/CommandBuilder.Set.cs:25-33 | src/officecli/CommandBuilder.View.cs:50-58 — there are 14 copies across 8 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 14 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/CommandBuilder.Add.cs:50` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/officecli/CommandBuilder.Add.cs:61` calls `Begin` and `src/officecli/CommandBuilder.Add.cs:362` 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 (9 lines × 13) · ×1
  • Duplicated block (9 lines × 13) src/officecli/CommandBuilder.Add.cs:355 — src/officecli/CommandBuilder.Add.cs:355-363 | src/officecli/CommandBuilder.Add.cs:435-443 | src/officecli/CommandBuilder.Add.cs:497-505 | src/officecli/CommandBuilder.Dump.cs:34-42 | src/officecli/CommandBuilder.GetQuery.cs:23-31 | src/officecli/CommandBuilder.GetQuery.cs:180-188 | src/officecli/CommandBuilder.Goto.cs:29-37 | src/officecli/CommandBuilder.Import.cs:35-43 | src/officecli/CommandBuilder.Mark.cs:33-41 | src/officecli/CommandBuilder.Mark.cs:255-263 | src/officecli/CommandBuilder.Raw.cs:26-34 | src/officecli/CommandBuilder.Raw.cs:71-79 | src/officecli/CommandBuilder.View.cs:52-60 — there are 13 copies across 8 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 13 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/CommandBuilder.Add.cs:355` it does not close everything it opens, so those 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, `src/officecli/CommandBuilder.GetQuery.cs:178` calls `Add` and `src/officecli/CommandBuilder.GetQuery.cs:21` 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 × 11) · ×1
  • Duplicated block (9 lines × 11) src/officecli/CommandBuilder.Add.cs:354 — src/officecli/CommandBuilder.Add.cs:354-362 | src/officecli/CommandBuilder.Add.cs:434-442 | src/officecli/CommandBuilder.Add.cs:496-504 | src/officecli/CommandBuilder.Batch.cs:200-208 | src/officecli/CommandBuilder.Dump.cs:33-41 | src/officecli/CommandBuilder.GetQuery.cs:22-30 | src/officecli/CommandBuilder.GetQuery.cs:179-187 | src/officecli/CommandBuilder.Import.cs:34-42 | src/officecli/CommandBuilder.Raw.cs:25-33 | src/officecli/CommandBuilder.Raw.cs:70-78 | src/officecli/CommandBuilder.View.cs:51-59 — there are 11 copies across 7 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 11 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/CommandBuilder.Add.cs:354` it does not close everything it opens, so those 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, `src/officecli/CommandBuilder.Add.cs:363` calls `Restore`, `GetValue` and `src/officecli/CommandBuilder.Batch.cs:209` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (9 lines × 5) · ×1
  • Duplicated block (9 lines × 5) src/officecli/Core/Chart/ChartSvgRenderer.cs:4378 — src/officecli/Core/Chart/ChartSvgRenderer.cs:4378-4386 | src/officecli/Core/Chart/ChartSvgRenderer.cs:4403-4411 | src/officecli/Core/Chart/ChartSvgRenderer.cs:4427-4435 | src/officecli/Core/Chart/ChartSvgRenderer.cs:4461-4469 | src/officecli/Core/Chart/ChartSvgRenderer.cs:4504-4512 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartSvgRenderer.cs:4378` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9 lines × 4) · ×1
  • Duplicated block (9 lines × 4) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:900 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:900-911 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:970-981 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1082-1090 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1115-1126 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:970` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8–9 lines × 3) · ×1
  • Duplicated block (8–9 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Shape.cs:305 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Shape.cs:305-313 | src/officecli/Handlers/Pptx/PowerPointHandler.Notes.cs:150-157 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:2976-2983 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single 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 `src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:2976` it begins part-way through the construct above it, so those 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–9 lines × 4) · ×1
  • Duplicated block (7–9 lines × 4) src/officecli/Core/Chart/ChartHelper.Reader.cs:2364 — src/officecli/Core/Chart/ChartHelper.Reader.cs:2364-2372 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1103-1109 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1117-1123 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1131-1139 — 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (7–9 lines × 3) · ×1
  • Duplicated block (7–9 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1154 — src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1154-1160 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1162-1168 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:3040-3048 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1154` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8 lines × 7) · ×1
  • Duplicated block (8 lines × 7) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:20 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:20-29 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:541-548 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:698-705 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:585-594 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:817-826 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1546-1554 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Table.cs:204-213 — there are 7 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 7 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (5 lines × 6) · ×1
  • Duplicated block (5 lines × 6) src/officecli/Handlers/Pptx/PowerPointHandler.Chart.cs:171 — src/officecli/Handlers/Pptx/PowerPointHandler.Chart.cs:171-175 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:380-384 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:480-484 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:1844-1848 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:2834-2838 | src/officecli/Handlers/Pptx/PowerPointHandler.NodeBuilder.cs:3359-3363 — there are 6 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Chart.cs: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 (8 lines × 5) · ×1
  • Duplicated block (8 lines × 5) src/officecli/Core/Watch/WatchNotifier.cs:69 — src/officecli/Core/Watch/WatchNotifier.cs:69-76 | src/officecli/Core/Watch/WatchNotifier.cs:111-118 | src/officecli/Core/Watch/WatchNotifier.cs:155-162 | src/officecli/Core/Watch/WatchNotifier.cs:195-202 | src/officecli/Core/Watch/WatchNotifier.cs:246-253 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Watch/WatchNotifier.cs:69` it does not close everything it opens, so those 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, `src/officecli/Core/Watch/WatchNotifier.cs:203` calls `Serialize` and `src/officecli/Core/Watch/WatchNotifier.cs:77` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (7–8 lines × 3) · ×1
  • Duplicated block (7–8 lines × 3) src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:1528 — src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:1528-1535 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:1540-1547 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:1552-1558 — 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 `src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:1528` it begins part-way through the construct above it, so those 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 × 14) · ×1
  • Duplicated block (7 lines × 14) src/officecli/Handlers/Word/WordHandler.Query.cs:1898 — src/officecli/Handlers/Word/WordHandler.Query.cs:1898-1904 | src/officecli/Handlers/Word/WordHandler.Query.cs:1979-1985 | src/officecli/Handlers/Word/WordHandler.Query.cs:2005-2011 | src/officecli/Handlers/Word/WordHandler.Query.cs:2058-2064 | src/officecli/Handlers/Word/WordHandler.Query.cs:2084-2090 | src/officecli/Handlers/Word/WordHandler.Query.cs:2327-2333 | src/officecli/Handlers/Word/WordHandler.Query.cs:2425-2431 | src/officecli/Handlers/Word/WordHandler.Query.cs:2569-2575 | src/officecli/Handlers/Word/WordHandler.Query.cs:2616-2622 | src/officecli/Handlers/Word/WordHandler.Query.cs:2655-2661 | src/officecli/Handlers/Word/WordHandler.Query.cs:2677-2683 | src/officecli/Handlers/Word/WordHandler.Query.cs:2775-2781 | src/officecli/Handlers/Word/WordHandler.Query.cs:2943-2949 | src/officecli/Handlers/Word/WordHandler.Query.cs:3265-3271 — all 14 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Query.cs:1898` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (6 lines × 6) · ×1
  • Duplicated block (6 lines × 6) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1911 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1911-1916 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1940-1945 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1969-1974 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1998-2003 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2026-2031 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2055-2060 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (7 lines × 5) · ×1
  • Duplicated block (7 lines × 5) src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1292 — src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1292-1299 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1359-1365 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1422-1428 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1514-1520 | src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1585-1591 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Mutations.cs:1292` it does not close everything it opens, so those 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 (2–7 lines × 5) · ×1
  • Duplicated block (2–7 lines × 5) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1897 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1897-1898 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2067-2073 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2095-2101 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2147-2153 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2175-2181 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (6–7 lines × 4) · ×1
  • Duplicated block (6–7 lines × 4) src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:86 — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:86-92 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1850-1855 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1864-1870 | src/officecli/Handlers/Pptx/PowerPointHandler.Set.Table.cs:17-23 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:86` it does not close everything it opens, so those 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 (4–7 lines × 4) · ×1
  • Duplicated block (4–7 lines × 4) src/officecli/Handlers/Word/WordHandler.Navigation.cs:2026 — src/officecli/Handlers/Word/WordHandler.Navigation.cs:2026-2032 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:2114-2120 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:3157-3160 | src/officecli/Handlers/Word/WordHandler.Navigation.cs:6869-6874 — 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 `src/officecli/Handlers/Word/WordHandler.Navigation.cs:2026` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/officecli/Handlers/Word/WordHandler.Navigation.cs:2033` calls `IsToggleOn` and `src/officecli/Handlers/Word/WordHandler.Navigation.cs:3160` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (4–7 lines × 6) · ×1
  • Duplicated block (4–7 lines × 6) src/officecli/Core/Chart/ChartSvgRenderer.cs:1779 — src/officecli/Core/Chart/ChartSvgRenderer.cs:1779-1782 | src/officecli/Core/Chart/ChartSvgRenderer.cs:1787-1790 | src/officecli/Core/Chart/ChartSvgRenderer.cs:1891-1894 | src/officecli/Core/Chart/ChartSvgRenderer.cs:1983-1989 | src/officecli/Core/Chart/ChartSvgRenderer.cs:2040-2046 | src/officecli/Core/Chart/ChartSvgRenderer.cs:5346-5351 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartSvgRenderer.cs:1983` it does not close everything it opens, so those 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, `src/officecli/Core/Chart/ChartSvgRenderer.cs:1777` calls `Cos`, `Sin` and `src/officecli/Core/Chart/ChartSvgRenderer.cs:1786` 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–7 lines × 2) · ×1
  • Duplicated block (6–7 lines × 2) src/officecli/Core/Chart/ChartSvgRenderer.CxExtract.cs:397 — src/officecli/Core/Chart/ChartSvgRenderer.CxExtract.cs:397-403 | src/officecli/Core/Chart/ChartSvgRenderer.CxExtract.cs:438-443 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Core/Chart/ChartSvgRenderer.CxExtract.cs:397` it does not close everything it opens, so those 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 (5–7 lines × 2) · ×1
  • Duplicated block (5–7 lines × 2) src/officecli/Core/PivotTableHelper.Set.cs:416 — src/officecli/Core/PivotTableHelper.Set.cs:416-420 | src/officecli/Core/PivotTableHelper.cs:2105-2111 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/officecli/Core/PivotTableHelper.Set.cs:415` calls `Select`, `ToArray` and `src/officecli/Core/PivotTableHelper.cs:2105` 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 (6 lines × 14) · ×1
  • Duplicated block (6 lines × 14) src/officecli/Handlers/Word/WordHandler.Query.cs:1901 — src/officecli/Handlers/Word/WordHandler.Query.cs:1901-1906 | src/officecli/Handlers/Word/WordHandler.Query.cs:1982-1987 | src/officecli/Handlers/Word/WordHandler.Query.cs:2008-2013 | src/officecli/Handlers/Word/WordHandler.Query.cs:2061-2067 | src/officecli/Handlers/Word/WordHandler.Query.cs:2087-2092 | src/officecli/Handlers/Word/WordHandler.Query.cs:2428-2433 | src/officecli/Handlers/Word/WordHandler.Query.cs:2572-2577 | src/officecli/Handlers/Word/WordHandler.Query.cs:2619-2624 | src/officecli/Handlers/Word/WordHandler.Query.cs:2658-2663 | src/officecli/Handlers/Word/WordHandler.Query.cs:2680-2685 | src/officecli/Handlers/Word/WordHandler.Query.cs:2778-2783 | src/officecli/Handlers/Word/WordHandler.Query.cs:2946-2951 | src/officecli/Handlers/Word/WordHandler.Query.cs:3268-3273 | src/officecli/Handlers/Word/WordHandler.Query.cs:3302-3307 — all 14 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Word/WordHandler.Query.cs:1901` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/officecli/Handlers/Word/WordHandler.Query.cs:3301` calls `ElementToNode` and `src/officecli/Handlers/Word/WordHandler.Query.cs:1901` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (5 lines × 9) · ×1
  • Duplicated block (5 lines × 9) src/officecli/Handlers/Pptx/PowerPointHandler.Add.Shape.cs:504 — src/officecli/Handlers/Pptx/PowerPointHandler.Add.Shape.cs:504-508 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Shape.cs:521-525 | src/officecli/Handlers/Pptx/PowerPointHandler.Add.Shape.cs:531-535 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:1565-1569 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:1583-1587 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:1595-1599 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:3690-3694 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:3705-3709 | src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs:3718-3722 — there are 9 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 9 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.Add.Shape.cs:504` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (5 lines × 7) · ×1
  • Duplicated block (5 lines × 7) src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1910 — src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1910-1914 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1939-1943 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1968-1972 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1997-2001 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2025-2029 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2054-2058 | src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:2192-2196 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1910` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (3–5 lines × 4) · ×1
  • Duplicated block (3–5 lines × 4) src/officecli/Core/Chart/ChartSvgRenderer.cs:636 — src/officecli/Core/Chart/ChartSvgRenderer.cs:636-639 | src/officecli/Core/Chart/ChartSvgRenderer.cs:640-642 | src/officecli/Core/Chart/ChartSvgRenderer.cs:888-892 | src/officecli/Core/Chart/ChartSvgRenderer.cs:930-934 — 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 `src/officecli/Core/Chart/ChartSvgRenderer.cs:640` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/officecli/Core/Chart/ChartSvgRenderer.cs:639` calls `LabelDeleted`, `LabelText` and `src/officecli/Core/Chart/ChartSvgRenderer.cs:892` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (4–5 lines × 3) · ×1
  • Duplicated block (4–5 lines × 3) src/officecli/Core/Chart/ChartSvgRenderer.cs:5624 — src/officecli/Core/Chart/ChartSvgRenderer.cs:5624-5628 | src/officecli/Core/Chart/ChartSvgRenderer.cs:5635-5639 | src/officecli/Core/Chart/ChartSvgRenderer.cs:5645-5648 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `x` to `double b) FitExponential(double[]` in one and `double b) FitLogarithmic(double[]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/officecli/Core/Chart/ChartSvgRenderer.cs:5648` calls `Select`, `Log`, `ToArray` and `src/officecli/Core/Chart/ChartSvgRenderer.cs:5628` 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 (4–5 lines × 4) · ×1
  • Duplicated block (4–5 lines × 4) src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:1890 — src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:1890-1893 | src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:1902-1906 | src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:1912-1916 | src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:1920-1923 — 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 `src/officecli/Core/Formula/FormulaEvaluator.Functions.cs:1890` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (22 lines × 3) · ×1
  • Duplicated block (22 lines × 3) src/officecli/Core/TableStyles/Families/LightStyle1.cs:14 — src/officecli/Core/TableStyles/Families/LightStyle1.cs:14-41 | src/officecli/Core/TableStyles/Families/LightStyle2.cs:16-38 | src/officecli/Core/TableStyles/Families/LightStyle3.cs:14-35 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
P12 · CI test-gate honesty · Test suite runs only after the merge · ×1
  • Test suite runs only after the merge — `REDACTED` run(s) the test suite, but no workflow that runs tests is triggered by a pull request (or a merge queue) — so the suite reports on code that is already on the default branch. A red build there blocks nothing and the only remedy is a revert. Add the pull-request trigger to the workflow that runs your suite so the gate applies before the merge, not after it.
R1 · Type Safety · Type Safety · ×1
  • Type Safety — 0 typed · 9 plain JS — the untyped files are npm/install.js, npm/lib/install-binary.js, npm/officecli.js, sdk/node/demo.js, sdk/node/index.js, sdk/node/smoke.js (+3 more).
R10 · Code Duplication · Duplicated block (15 lines × 2 locations) · ×1
  • Duplicated block (15 lines × 2 locations) src/officecli/Resources/watch-sse-core.js:155 — src/officecli/Resources/watch-sse-core.js:155 · src/officecli/Resources/watch-sse-core.js:224 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
R10 · Code Duplication · Duplicated block (13 lines × 2 locations) · ×1
  • Duplicated block (13 lines × 2 locations) src/officecli/Resources/watch-overlay.js:824 — src/officecli/Resources/watch-overlay.js:824 · src/officecli/Resources/watch-overlay.js:864 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (9 lines × 2 locations) · ×1
  • Duplicated block (9 lines × 2 locations) src/officecli/Resources/watch-sse-core.js:28 — src/officecli/Resources/watch-sse-core.js:28 · src/officecli/Resources/watch-sse-core.js:77 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
R10 · Code Duplication · Duplicated block with local edits (7 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (7 matched lines × 2 locations) sdk/node/index.js:323 — sdk/node/index.js:323 · sdk/node/index.js:346 — the two spans are one implementation copied and then locally edited — 51 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 (6 lines × 2 locations) · ×1
  • Duplicated block (6 lines × 2 locations) src/officecli/Resources/watch-sse-core.js:41 — src/officecli/Resources/watch-sse-core.js:41 · src/officecli/Resources/watch-sse-core.js:147 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R2 · Cyclomatic Complexity · Complex function applyMarks (cyclomatic 31, cognitive 82) · ×1
  • Complex function applyMarks (cyclomatic 31, cognitive 82) src/officecli/Resources/watch-overlay.js:423 — applyMarks has cyclomatic complexity 31 and cognitive complexity 82; 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 28, cognitive 42) · ×1
  • Complex function (anonymous) (cyclomatic 28, cognitive 42) src/officecli/Resources/watch-sse-core.js:318 — (anonymous) has cyclomatic complexity 28 and cognitive complexity 42; 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 26, cognitive 63) · ×1
  • Complex function (anonymous) (cyclomatic 26, cognitive 63) src/officecli/Resources/watch-overlay.js:822 — (anonymous) has cyclomatic complexity 26 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 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 24, cognitive 35) · ×1
  • Complex function (anonymous) (cyclomatic 24, cognitive 35) src/officecli/Resources/watch-sse-core.js:147 — (anonymous) has cyclomatic complexity 24 and cognitive complexity 35; 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 23, cognitive 25) · ×1
  • Complex function (anonymous) (cyclomatic 23, cognitive 25) src/officecli/Resources/watch-overlay.js:547 — (anonymous) has cyclomatic complexity 23 and cognitive complexity 25; 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 22, cognitive 46) · ×1
  • Complex function (anonymous) (cyclomatic 22, cognitive 46) src/officecli/Resources/watch-sse-core.js:239 — (anonymous) has cyclomatic complexity 22 and cognitive complexity 46; 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 17, cognitive 16) · ×1
  • Complex function (anonymous) (cyclomatic 17, cognitive 16) src/officecli/Resources/watch-overlay.js:642 — (anonymous) has cyclomatic complexity 17 and cognitive complexity 16; 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 ensureCliBinary (cyclomatic 16, cognitive 21) · ×1
  • Complex function ensureCliBinary (cyclomatic 16, cognitive 21) sdk/node/index.js:346 — ensureCliBinary has cyclomatic complexity 16 and cognitive complexity 21; 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 15, cognitive 34) · ×1
  • Complex function (anonymous) (cyclomatic 15, cognitive 34) src/officecli/Resources/watch-sse-core.js:355 — (anonymous) has cyclomatic complexity 15 and cognitive complexity 34; 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 15, cognitive 18) · ×1
  • Complex function (anonymous) (cyclomatic 15, cognitive 18) src/officecli/Resources/preview.js:131 — (anonymous) has cyclomatic complexity 15 and cognitive complexity 18; 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 _positionSelOverlay (cyclomatic 15, cognitive 18) · ×1
  • Complex function _positionSelOverlay (cyclomatic 15, cognitive 18) src/officecli/Resources/watch-overlay.js:68 — _positionSelOverlay has cyclomatic complexity 15 and cognitive complexity 18; 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 14, cognitive 23) · ×1
  • Complex function (anonymous) (cyclomatic 14, cognitive 23) src/officecli/Resources/watch-overlay.js:774 — (anonymous) has cyclomatic complexity 14 and cognitive complexity 23; 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 14, cognitive 20) · ×1
  • Complex function (anonymous) (cyclomatic 14, cognitive 20) src/officecli/Resources/watch-overlay.js:912 — (anonymous) has cyclomatic complexity 14 and cognitive complexity 20; 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 isMusl (cyclomatic 13, cognitive 12) · ×1
  • Complex function isMusl (cyclomatic 13, cognitive 12) npm/lib/install-binary.js:42 — isMusl has cyclomatic complexity 13 and cognitive complexity 12; 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 detectAsset (cyclomatic 12, cognitive 21) · ×1
  • Complex function detectAsset (cyclomatic 12, cognitive 21) npm/lib/install-binary.js:63 — detectAsset has cyclomatic complexity 12 and cognitive complexity 21; 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 _detectRect (cyclomatic 11, cognitive 16) · ×1
  • Complex function _detectRect (cyclomatic 11, cognitive 16) src/officecli/Resources/watch-overlay.js:23 — _detectRect has cyclomatic complexity 11 and cognitive complexity 16; 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 11, cognitive 12) · ×1
  • Complex function (anonymous) (cyclomatic 11, cognitive 12) src/officecli/Resources/watch-sse-core.js:41 — (anonymous) has cyclomatic complexity 11 and cognitive complexity 12; 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.
R3 · Large Files · src/officecli/Resources/watch-overlay.js · ×1
  • src/officecli/Resources/watch-overlay.js: 1013 lines of code src/officecli/Resources/watch-overlay.js:1 — src/officecli/Resources/watch-overlay.js has 1013 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 · sdk/node/index.js · ×1
  • sdk/node/index.js: 604 lines of code sdk/node/index.js:1 — sdk/node/index.js has 604 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 · src/officecli/Resources/watch-sse-core.js · ×1
  • src/officecli/Resources/watch-sse-core.js: 455 lines of code src/officecli/Resources/watch-sse-core.js:1 — src/officecli/Resources/watch-sse-core.js has 455 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R6 · Tooling · No test, lint or typecheck script · ×1
  • No test, lint or typecheck script — test ✗ · lint ✗ · typecheck ✗ — read from this repository's package.json scripts and corroborated against its CI workflows. A script counts when its name or command matches the step: `test` for the suite, `lint` or `prettier` for linting, `typecheck`/`type-check`/`tsc` for type checking. ✗ therefore means no script or CI step under those names was found, NOT that the step is absent from your pipeline — a task invoked by a runner this check does not read, or named something else entirely, is not seen and is worth confirming before acting on a cross. A ✓ means the wiring is DECLARED — a script or CI step under those names exists. It is not a statement that the step passes, or that it runs at all: nothing here installs a dependency or executes a suite.
R7 · Dead Code · Dead file (~38 LoC) · ×1
  • Dead file (~38 LoC) sdk/node/demo.js — no import path from any entry point (5 application, 3 tooling, 1 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
SC1 · Supply-chain hygiene · NuGet dependencies are not locked · ×1
  • NuGet dependencies are not locked — No packages.lock.json and no central package management — restores aren't reproducible or pinned (SSDF PW.4.4). Enable <RestorePackagesWithLockFile>true</RestorePackagesWithLockFile> (commit the lockfile) or adopt Directory.Packages.props. Advisory — never scored.
SC1 · Supply-chain hygiene · JavaScript dependencies are not locked · ×1
  • JavaScript dependencies are not locked — No package-lock.json / yarn.lock / pnpm-lock.yaml / bun.lock — JS installs aren't reproducible (SSDF PW.4.4). Commit your package manager's lockfile and install from it (`npm ci`, `yarn --immutable`, `pnpm i --frozen-lockfile` or `bun i --frozen-lockfile`). Advisory — never scored.
X1 · Async correctness · Blocking `MemoryStream.Write` inside an `async` method · ×1
  • Blocking `MemoryStream.Write` inside an `async` method src/officecli/Core/Watch/WatchServer.cs:2153 — `MemoryStream.Write` blocks the thread on I/O while `MemoryStream.WriteAsync` exists to wait without one — inside a method that is already `async`, await the twin.
X13 · Undrained process stream · Redirected process stream is never drained (deadlock) · ×1
  • Redirected process stream is never drained (deadlock) src/officecli/CommandBuilder.cs:296 — `RedirectStandardOutput` is set here, but nothing in this type ever reads `StandardOutput` — while `StandardError` is read to the end. The child blocks as soon as it fills the StandardOutput pipe (~4 KB, never more than 64 KB), and it can then never finish writing StandardError, so the read-to-end above never returns and the `WaitForExit` timeout beside it does not help: the timeout bounds the WAIT, not the read that precedes it. Drain both — read one stream on a background thread (`BeginErrorReadLine()` with an `ErrorDataReceived` handler, or a `Task` running the second `ReadToEndAsync()`) and await both before `WaitForExit()` — or stop redirecting the stream you do not consume.
X14 · Bypassable address classification · IP classification is bypassable through an IPv4-in-IPv6 embedding · ×1
  • IP classification is bypassable through an IPv4-in-IPv6 embedding src/officecli/Core/SsrfGuard.cs:131 — This method unwraps IPv4-MAPPED IPv6 (`IsIPv4MappedToIPv6`, line 112) and then rejects `10.0.0.0/8` on its IPv4 path — but the IPv6 branch at line 131 classifies the address as written, and IPv4 reaches IPv6 through three MORE embeddings this method never mentions: IPv4-compatible (`::a.b.c.d`), 6to4 (`2002::/16`) and NAT64 (`64:ff9b::/96`). So `::10.0.0.1`, `2002:0a00:0001::` and `64:ff9b::10.0.0.0` all name a host inside `10.0.0.0/8` — the range this same method declares non-public — and all reach the IPv6 branch un-unwrapped, taking the opposite verdict. Unwrap every embedding to its IPv4 form before classifying, or reject any IPv6 address carrying an embedded IPv4 outright.
X15 · Unvalidated length from an untrusted reader · Length read from the parsed input is spent without ever being bounded · ×1
  • Length read from the parsed input is spent without ever being bounded src/officecli/Handlers/Pptx/PowerPointHandler.Add.Model3D.cs:470 — `chunkLen` is read from the stream being parsed at line 468 (`ReadUInt32`), then read in bulk from that same stream at line 470 — and nowhere in this method is `chunkLen` bounded from above — compared to a limit, clamped, or checked against the input that remains (a zero or sign test, or the loop that counts up to it, bounds nothing). A file the caller did not write therefore chooses the size directly: a value near `int.MaxValue` allocates until the process dies, and a value that overflows the cast to `int` goes negative and throws out of a parser whose failure path was written for malformed input, not for hostile input. Bound `chunkLen` against the bytes actually remaining in the stream before spending it.
X18 · Disposal-pattern correctness · Release token given back after an unprotected call · ×1
  • Release token given back after an unprotected call src/officecli/Core/DeferredStdout.cs:46 — `_handler` is declared `IDisposable` and nothing more, and every assignment to it takes a constructor parameter — so `DeferredStdout` can do exactly one thing with it, which is the release performed here (line 46), and it is the only reference left that can perform it. That release is the tail of an unprotected sequence: `Console.SetOut(_original)` runs first (line 45), and nothing in `Dispose` catches it. A single throw from that call skips the release entirely — and because a bare `IDisposable` carries no state to inspect and no second holder to fall back on, whatever it represents (a lock taken for this instance, a semaphore lease, a scope) is then held for the remaining lifetime of the process, with nothing left that could ever give it back. Wrap the calls that precede it in a `try` and move the release into the `finally`, so the one statement that must happen is the one that always happens.
X18 · Disposal-pattern correctness · Disposable created and abandoned in the method that made it · ×1
  • Disposable created and abandoned in the method that made it src/officecli/Core/Watch/WatchServer.cs:2147 — `raw` is a `MemoryStream`, which implements `IDisposable`, and it is created here (line 2147). Every use of it in `ReadHttpRequestHeaderAsync` reads a member through it — it is never returned, never stored, never handed to anything else, and never disposed — so this method both creates the value and is the last thing that can release it, and does not. Nothing announces the leak: the object holds its resource until finalization if its type has a finalizer, and until the process ends if it does not, so the cost accumulates once per CALL rather than showing up as a failure. Declare it with `using` (`using var raw = …;`), which releases it at the end of the scope on every path including a throw.
Minor — 111 finding(s)
P2 · Observability · Console output used as the logging channel · ×27
  • Console output used as the logging channel src/officecli/Handlers/Excel/ExcelHandler.Add.Cells.cs:421 — `src/officecli/Handlers/Excel/ExcelHandler.Add.Cells.cs` reports through `Console.Write…` at line 421 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters.
  • Console output used as the logging channel src/officecli/Handlers/Excel/ExcelHandler.Add.Cells.cs:427 — `src/officecli/Handlers/Excel/ExcelHandler.Add.Cells.cs` reports through `Console.Write…` at line 427 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters.
  • Console output used as the logging channel src/officecli/Handlers/Excel/ExcelHandler.Add.Cells.cs:455 — `src/officecli/Handlers/Excel/ExcelHandler.Add.Cells.cs` reports through `Console.Write…` at line 455 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters.
  • Console output used as the logging channel src/officecli/Handlers/Excel/ExcelHandler.Add.Cells.cs:543 — `src/officecli/Handlers/Excel/ExcelHandler.Add.Cells.cs` reports through `Console.Write…` at line 543 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters.
  • Console output used as the logging channel src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs:131 — `src/officecli/Handlers/Excel/ExcelHandler.Add.Chart.cs` reports through `Console.Write…` at line 131 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters.
  • Console output used as the logging channel src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:142 — `src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs` reports through `Console.Write…` at line 142 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters.
  • Console output used as the logging channel src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:311 — `src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs` reports through `Console.Write…` at line 311 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters.
  • Console output used as the logging channel src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:610 — `src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs` reports through `Console.Write…` at line 610 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters.
  • Console output used as the logging channel src/officecli/Handlers/Excel/ExcelHandler.FormulaCache.cs:272 — `src/officecli/Handlers/Excel/ExcelHandler.FormulaCache.cs` reports through `Console.Write…` at line 272 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters.
  • Console output used as the logging channel src/officecli/Handlers/Excel/ExcelHandler.Helpers.Cell.cs:334 — `src/officecli/Handlers/Excel/ExcelHandler.Helpers.Cell.cs` reports through `Console.Write…` at line 334 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters.
  • Console output used as the logging channel src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:1364 — `src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs` reports through `Console.Write…` at line 1364 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters.
  • Console output used as the logging channel src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:1370 — `src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs` reports through `Console.Write…` at line 1370 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters.
  • Console output used as the logging channel src/officecli/Handlers/Excel/ExcelHandler.Helpers.Sheet.cs:552 — `src/officecli/Handlers/Excel/ExcelHandler.Helpers.Sheet.cs` reports through `Console.Write…` at line 552 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters.
  • Console output used as the logging channel src/officecli/Handlers/Excel/ExcelHandler.Query.cs:1251 — `src/officecli/Handlers/Excel/ExcelHandler.Query.cs` reports through `Console.Write…` at line 1251 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters.
  • Console output used as the logging channel src/officecli/Handlers/Excel/ExcelHandler.Set.Cells.cs:160 — `src/officecli/Handlers/Excel/ExcelHandler.Set.Cells.cs` reports through `Console.Write…` at line 160 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters.
  • Console output used as the logging channel src/officecli/Handlers/Excel/ExcelHandler.Set.Cells.cs:197 — `src/officecli/Handlers/Excel/ExcelHandler.Set.Cells.cs` reports through `Console.Write…` at line 197 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters.
  • Console output used as the logging channel src/officecli/Handlers/Excel/ExcelHandler.Set.Drawings.cs:212 — `src/officecli/Handlers/Excel/ExcelHandler.Set.Drawings.cs` reports through `Console.Write…` at line 212 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters.
  • Console output used as the logging channel src/officecli/Handlers/Excel/ExcelHandler.Set.Tables.cs:798 — `src/officecli/Handlers/Excel/ExcelHandler.Set.Tables.cs` reports through `Console.Write…` at line 798 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters.
  • Console output used as the logging channel src/officecli/Handlers/Excel/ExcelHandler.Slicer.cs:664 — `src/officecli/Handlers/Excel/ExcelHandler.Slicer.cs` reports through `Console.Write…` at line 664 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters.
  • Console output used as the logging channel src/officecli/Handlers/ExcelHandler.cs:123 — `src/officecli/Handlers/ExcelHandler.cs` reports through `Console.Write…` at line 123 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters.
  • Console output used as the logging channel src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs:1090 — `src/officecli/Handlers/Pptx/PowerPointHandler.Add.Misc.cs` reports through `Console.Write…` at line 1090 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters.
  • Console output used as the logging channel src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs:922 — `src/officecli/Handlers/Pptx/PowerPointHandler.Animations.cs` reports through `Console.Write…` at line 922 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters.
  • Console output used as the logging channel src/officecli/Handlers/Pptx/PowerPointHandler.Effects.cs:850 — `src/officecli/Handlers/Pptx/PowerPointHandler.Effects.cs` reports through `Console.Write…` at line 850 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters.
  • Console output used as the logging channel src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:2030 — `src/officecli/Handlers/Word/WordHandler.Add.Misc.cs` reports through `Console.Write…` at line 2030 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters.
  • Console output used as the logging channel src/officecli/Handlers/Word/WordHandler.Helpers.Chart.cs:163 — `src/officecli/Handlers/Word/WordHandler.Helpers.Chart.cs` reports through `Console.Write…` at line 163 although other files in its project log through a logger. Console lines carry no level, category or structured properties and never reach the log pipeline or its exporters.
  • + 2 more in this group — see findings.md.
X10 · Duplicated predicate · Duplicated predicate · ×25
  • Duplicated predicate src/officecli/Handlers/Excel/ExcelHandler.ChartCache.cs:47 — `!Modified && _dirtyWorksheets.Count == 0` appears character-identically in 2 files — src/officecli/Handlers/Excel/ExcelHandler.ChartCache.cs, src/officecli/Handlers/Excel/ExcelHandler.FormulaCache.cs. 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 src/officecli/Core/Formula/FormulaEvaluator.cs:901 — `!NumericText.IsDecimalCommaSpelling(s) && DateTime.TryParse(s, CultureInfo.InvariantCulture, DateTimeStyles.None, out var dt)` appears character-identically in 2 files — src/officecli/Core/Formula/FormulaEvaluator.Helpers.cs, src/officecli/Core/Formula/FormulaEvaluator.cs. 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 src/officecli/Core/DrawingEffectsHelper.cs:168 — `!double.TryParse(numStr, System.Globalization.CultureInfo.InvariantCulture, out var radiusPt) || double.IsNaN(radiusPt) || double.IsInfinity…` appears character-identically in 2 files — src/officecli/Core/DrawingEffectsHelper.cs, src/officecli/Handlers/Pptx/PowerPointHandler.Effects.cs. 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 src/officecli/Core/ParseHelpers.cs:425 — `!double.TryParse(trimmed, CultureInfo.InvariantCulture, out var result) || double.IsNaN(result) || double.IsInfinity(result)` appears character-identically in 2 files — src/officecli/Core/ParseHelpers.cs, src/officecli/Core/SpacingConverter.cs. 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 src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:444 — `!double.TryParse(value, System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out var bcVal) || bcVal …` appears character-identically in 2 files — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs, src/officecli/Handlers/Word/WordHandler.Set.Element.cs. 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 src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs:1100 — `!double.TryParse(value, System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out var lnOpacity) || do…` appears character-identically in 2 files — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Shape.cs, src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs. 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 src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs:339 — `!double.TryParse(value, System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out var opacityVal) || d…` appears character-identically in 2 files — src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs, src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs. 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 src/officecli/Core/PivotTableHelper.cs:1715 — `!emitSubtotals && ActiveLayoutMode == "compact" && rowFieldIndices.Count >= 2` appears character-identically in 2 files — src/officecli/Core/PivotTableHelper.Render.cs, src/officecli/Core/PivotTableHelper.cs. 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 src/officecli/CommandBuilder.Add.cs:88 — `!force && file.Extension.Equals(".docx", StringComparison.OrdinalIgnoreCase)` appears character-identically in 2 files — src/officecli/CommandBuilder.Add.cs, src/officecli/CommandBuilder.Batch.cs. 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 src/officecli/CommandBuilder.View.cs:789 — `!int.TryParse(parts[0], out var ps) || !int.TryParse(parts[1], out var pe)` appears character-identically in 2 files — src/officecli/CommandBuilder.View.cs, src/officecli/ResidentServer.cs. 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 src/officecli/Core/Chart/ChartHelper.Setter.cs:4136 — `!int.TryParse(rest[..dotIdx], out pointIndex) || pointIndex < 1` appears character-identically in 2 files — src/officecli/Core/Chart/ChartHelper.Setter.cs, src/officecli/Core/Chart/ChartHelper.SetterHelpers.cs. 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 src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs:1147 — `!int.TryParse(value, out var lnDist) || lnDist < 0` appears character-identically in 2 files — src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs, src/officecli/Handlers/Word/WordHandler.Set.SectionLayout.cs. 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 src/officecli/Handlers/Word/WordHandler.Query.cs:230 — `!nameForm && int.TryParse(indexOrName, out var ffIdx)` appears character-identically in 2 files — src/officecli/Handlers/Word/WordHandler.Query.cs, src/officecli/Handlers/Word/WordHandler.Set.cs. 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 src/officecli/Handlers/Excel/ExcelHandler.Helpers.Ole.cs:32 — `!node.Format.TryGetValue("relId", out var relObj) || relObj is not string relId || string.IsNullOrEmpty(relId)` appears character-identically in 3 files — src/officecli/Handlers/Excel/ExcelHandler.Helpers.Ole.cs, src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Ole.cs, src/officecli/Handlers/Word/WordHandler.Query.cs. 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 src/officecli/Handlers/Excel/ExcelHandler.Set.Drawings.cs:149 — `!properties.ContainsKey("progId") && !properties.ContainsKey("progid")` appears character-identically in 2 files — src/officecli/Handlers/Excel/ExcelHandler.Set.Drawings.cs, src/officecli/Handlers/Pptx/PowerPointHandler.Set.Media.cs. 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 src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs:272 — `!properties.TryGetValue("path", out var imgPath) && !properties.TryGetValue("src", out imgPath)` appears character-identically in 3 files — src/officecli/Handlers/Excel/ExcelHandler.Add.Drawings.cs, src/officecli/Handlers/Pptx/PowerPointHandler.Add.Media.cs, src/officecli/Handlers/Word/WordHandler.Add.Media.cs. 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 src/officecli/Core/Chart/ChartExBuilder.cs:842 — `!properties.TryGetValue(key, out var v) || string.IsNullOrEmpty(v)` appears character-identically in 2 files — src/officecli/Core/Chart/ChartExBuilder.cs, src/officecli/Handlers/Word/WordHandler.Add.Structure.cs. 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 src/officecli/Handlers/Pptx/PptxBatchEmitter.Charts.cs:77 — `!s.Format.TryGetValue("name", out var nObj) || nObj == null` appears character-identically in 2 files — src/officecli/Handlers/Pptx/PptxBatchEmitter.Charts.cs, src/officecli/Handlers/Word/WordBatchEmitter.Charts.cs. 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 src/officecli/Handlers/Pptx/PptxBatchEmitter.Charts.cs:78 — `!s.Format.TryGetValue("values", out var vObj) || vObj == null` appears character-identically in 2 files — src/officecli/Handlers/Pptx/PptxBatchEmitter.Charts.cs, src/officecli/Handlers/Word/WordBatchEmitter.Charts.cs. 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 src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs:937 — `!short.TryParse(colParts[0], out var colCount) || colCount < 1 || colCount > 45` appears character-identically in 2 files — src/officecli/Handlers/Word/WordHandler.Set.Dispatch.cs, src/officecli/Handlers/Word/WordHandler.Set.SectionLayout.cs. 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 src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.RunFormat.cs:515 — `!string.Equals(value, "none", StringComparison.OrdinalIgnoreCase) && !string.Equals(value, "false", StringComparison.OrdinalIgnoreCase)` appears character-identically in 2 files — src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.RunFormat.cs, src/officecli/Handlers/Pptx/PowerPointHandler.ShapeProperties.cs. 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 REDACTED:2611 — `!string.IsNullOrEmpty(bmName) && !bmName.StartsWith("_GoBack")` appears character-identically in 2 files — src/officecli/Handlers/Word/WordHandler.HtmlPreview.Text.cs, REDACTED. 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 src/officecli/Handlers/Excel/ExcelHandler.Helpers.Ole.cs:55 — `!string.IsNullOrEmpty(destDir) && !Directory.Exists(destDir)` appears character-identically in 3 files — src/officecli/Handlers/Excel/ExcelHandler.Helpers.Ole.cs, src/officecli/Handlers/Pptx/PowerPointHandler.Helpers.Ole.cs, src/officecli/Handlers/Word/WordHandler.Query.cs. 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 src/officecli/Handlers/Word/WordHandler.Add.Misc.cs:3231 — `!string.IsNullOrEmpty(lineCompact) && !string.Equals(lineCompact, "none", StringComparison.OrdinalIgnoreCase)` appears character-identically in 2 files — src/officecli/Handlers/Word/WordHandler.Add.Misc.cs, src/officecli/Handlers/Word/WordHandler.Set.Element.cs. 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 src/officecli/CommandBuilder.Dump.cs:96 — `!string.IsNullOrEmpty(outPath) && outPath != "-"` appears character-identically in 2 files — src/officecli/CommandBuilder.Dump.cs, src/officecli/ResidentServer.cs. 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.
X9 · Subsumed condition operand · Subsumed condition operand · ×16
  • Subsumed condition operand src/officecli/Core/Chart/ChartHelper.cs:20 — `ct.EndsWith("3d")` can never decide this `||` — every value satisfying `ct.EndsWith("3d")` also satisfies `ct.Contains("3d")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand src/officecli/Core/LocaleFontRegistry.cs:188 — `lower.Contains("yu mincho")` can never decide this `||` — every value satisfying `lower.Contains("yu mincho")` also satisfies `lower.Contains("mincho")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand src/officecli/Core/LocaleFontRegistry.cs:189 — `lower.Contains("ms mincho")` can never decide this `||` — every value satisfying `lower.Contains("ms mincho")` also satisfies `lower.Contains("mincho")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand src/officecli/Core/LocaleFontRegistry.cs:190 — `lower.Contains("游明朝")` can never decide this `||` — every value satisfying `lower.Contains("游明朝")` also satisfies `lower.Contains("明朝")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand src/officecli/Core/LocaleFontRegistry.cs:191 — `lower.Contains("游ゴシック")` can never decide this `||` — every value satisfying `lower.Contains("游ゴシック")` also satisfies `lower.Contains("ゴシック")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand src/officecli/Core/LocaleFontRegistry.cs:201 — `lower.Contains("simhei")` can never decide this `||` — every value satisfying `lower.Contains("simhei")` also satisfies `lower.Contains("hei")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand src/officecli/Core/LocaleFontRegistry.cs:202 — `lower.Contains("仿宋")` can never decide this `||` — every value satisfying `lower.Contains("仿宋")` also satisfies `lower.Contains("宋")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand src/officecli/Core/LocaleFontRegistry.cs:203 — `lower.Contains("fangsong")` can never decide this `||` — every value satisfying `lower.Contains("fangsong")` also satisfies `lower.Contains("song")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand src/officecli/Core/LocaleFontRegistry.cs:204 — `lower.Contains("yahei")` can never decide this `||` — every value satisfying `lower.Contains("yahei")` also satisfies `lower.Contains("hei")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand src/officecli/Core/LocaleFontRegistry.cs:205 — `lower.Contains("微软雅黑")` can never decide this `||` — every value satisfying `lower.Contains("微软雅黑")` also satisfies `lower.Contains("黑")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand src/officecli/Handlers/Pptx/PptxBatchEmitter.cs:1235 — `slice.Contains("<p:animMotion", StringComparison.Ordinal)` can never decide this `||` — every value satisfying `slice.Contains("<p:animMotion", StringComparison.Ordinal)` also satisfies `slice.Contains("<p:anim", StringComparison.Ordinal)`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand src/officecli/Handlers/Pptx/PptxBatchEmitter.cs:1238 — `slice.Contains("<p:animClr", StringComparison.Ordinal)` can never decide this `||` — every value satisfying `slice.Contains("<p:animClr", StringComparison.Ordinal)` also satisfies `slice.Contains("<p:anim", StringComparison.Ordinal)`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:2709 — `f.Contains("fangsong")` can never decide this `||` — every value satisfying `f.Contains("fangsong")` also satisfies `f.Contains("song")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:2709 — `font.Contains("仿宋")` can never decide this `||` — every value satisfying `font.Contains("仿宋")` also satisfies `font.Contains("宋")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:2726 — `f.Contains("sf mono")` can never decide this `||` — every value satisfying `f.Contains("sf mono")` also satisfies `f.Contains("mono")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:2727 — `f.Contains("monospace")` can never decide this `||` — every value satisfying `f.Contains("monospace")` also satisfies `f.Contains("mono")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
X6 · Hand-rolled structured-format parsing · Hand-rolled JSON/XML parsing via regex · ×8
  • Hand-rolled JSON/XML parsing via regex src/officecli/Core/Diagram/MermaidImageRenderer.cs:540 — 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 project already references a real parser; use it here too.
  • Hand-rolled JSON/XML parsing via regex src/officecli/Core/Watch/WatchServer.cs:1429 — 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 project already references a real parser; use it here too.
  • Hand-rolled JSON/XML parsing via regex src/officecli/Core/Watch/WatchServer.cs:1695 — 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 project already references a real parser; use it here too.
  • Hand-rolled JSON/XML parsing via regex src/officecli/Core/Watch/WatchServer.cs:1697 — 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 project already references a real parser; use it here too.
  • Hand-rolled JSON/XML parsing via regex src/officecli/Core/Watch/WatchServer.cs:1698 — 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 project already references a real parser; use it here too.
  • Hand-rolled JSON/XML parsing via regex REDACTED:2172 — 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 project already references a real parser; use it here too.
  • Hand-rolled JSON/XML parsing via regex REDACTED:2175 — 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 project already references a real parser; use it here too.
  • Hand-rolled JSON/XML parsing via regex REDACTED:3673 — 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 project already references a real parser; use it here too.
X7 · Silent fallback defaults · Silent fallback default on parse failure · ×8
  • Silent fallback default on parse failure src/officecli/Core/Chart/ChartHelper.Setter.cs:3812 — `SetGridlineWidth` returns `false` when `TryParseLineWidthEmu(value, out var widthEmu)` is false, with no log or throw — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer to the test rather than a stand-in for a value that could not be read, this is not a silent default: say so in a comment on the member and the row stops firing.
  • Silent fallback default on parse failure src/officecli/Core/Chart/ChartHelper.Setter.cs:4593 — `DLblsOrd` falls back to `99` when `DLblsChildOrder.TryGetValue(e.GetType(), out var o)` is false, with no log or throw — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer to the test rather than a stand-in for a value that could not be read, this is not a silent default: say so in a comment on the member and the row stops firing.
  • Silent fallback default on parse failure src/officecli/Core/PivotTableHelper.Parse.cs:756 — `ParseCellRef` falls back to `1` when `int.TryParse(cellRef[i..], out var r)` is false, with no log or throw — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer to the test rather than a stand-in for a value that could not be read, this is not a silent default: say so in a comment on the member and the row stops firing.
  • Silent fallback default on parse failure src/officecli/Handlers/Excel/ExcelHandler.Helpers.Drawing.cs:1088 — `ReadAnchorPosition` falls back to `0` when `int.TryParse(from.ColumnId?.Text, out var fc)` is false, with no log or throw — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer to the test rather than a stand-in for a value that could not be read, this is not a silent default: say so in a comment on the member and the row stops firing.
  • Silent fallback default on parse failure src/officecli/Handlers/Pptx/PowerPointHandler.HtmlPreview.Css.cs:1414 — `ParsePct` falls back to `0` when `double.TryParse(s.TrimEnd('%').Trim(), System.Globalization.NumberStyles.Float, …` is false, with no log or throw — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer to the test rather than a stand-in for a value that could not be read, this is not a silent default: say so in a comment on the member and the row stops firing.
  • Silent fallback default on parse failure src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:260 — `ResolveShapeBorderCss` falls back to `1` when `w != null && long.TryParse(w, out var emu)` is false, with no log or throw — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer to the test rather than a stand-in for a value that could not be read, this is not a silent default: say so in a comment on the member and the row stops firing.
  • Silent fallback default on parse failure src/officecli/Handlers/Word/WordHandler.HtmlPreview.Css.cs:2572 — `ResolveDiagonalLine` falls back to `1.0` when `sz != null && int.TryParse(sz, out var s)` is false, with no log or throw — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer to the test rather than a stand-in for a value that could not be read, this is not a silent default: say so in a comment on the member and the row stops firing.
  • Silent fallback default on parse failure REDACTED:701 — `GetIntAttr` falls back to `0` when `val != null && int.TryParse(val, out var v)` is false, with no log or throw — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer to the test rather than a stand-in for a value that could not be read, this is not a silent default: say so in a comment on the member and the row stops firing.
X7 · Silent fallback defaults · Silent fallback default in catch · ×7
  • Silent fallback default in catch src/officecli/BatchTypes.cs:325 — `IsJsonObjectOrArray` swallows every exception into `return false;` — a data error becomes a silent behavior change with no trail. Log the failure or let validation throw.
  • Silent fallback default in catch src/officecli/Core/CliLogger.cs:20 — `Enabled` swallows every exception into `return false;` — a data error becomes a silent behavior change with no trail. Log the failure or let validation throw.
  • Silent fallback default in catch src/officecli/Core/HtmlScreenshot.cs:127 — `GetPaginationFromDom` swallows every exception into `return null;` — a data error becomes a silent behavior change with no trail. Log the failure or let validation throw.
  • Silent fallback default in catch src/officecli/Handlers/Pptx/PptxBatchEmitter.Resources.cs:500 — `EmitNoteSlideRawOne` swallows every exception into `return false;` — a data error becomes a silent behavior change with no trail. Log the failure or let validation throw.
  • Silent fallback default in catch src/officecli/Handlers/Word/WordHandler.Add.Diagram.cs:448 — `SectionContentHeightCm` swallows every exception into `return 24.13;` — a data error becomes a silent behavior change with no trail. Log the failure or let validation throw.
  • Silent fallback default in catch src/officecli/Handlers/WordHandler.cs:959 — `GetActiveXEmitData` swallows every exception into `return null;` — a data error becomes a silent behavior change with no trail. Log the failure or let validation throw.
  • Silent fallback default in catch src/officecli/Handlers/WordHandler.cs:1198 — `ResolveChartPartFromRunPath` swallows every exception into `return null;` — a data error becomes a silent behavior change with no trail. Log the failure or let validation throw.
AX6 · Interface segregation · Fat interface · ×1
  • Fat interface: IDocumentHandler (21 members) src/officecli/Core/IDocumentHandler.cs:65 — `IDocumentHandler` declares 21 members: `ViewAsText`, `ViewAsAnnotated`, `ViewAsOutline`, `ViewAsStats`, `ViewAsStatsJson`, `ViewAsOutlineJson`, `ViewAsTextJson`, `ViewAsIssues`, `Get`, `Query`, `Set`, `Add`, `Remove`, `Move`, `CopyFrom`, `Raw`, `RawSet`, `AddPart`, `Validate`, `TryExtractBinary`, `Save`. Counted as the author wrote them — a property is ONE member and its get/set accessors are not counted separately, and an event counts once. 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.
D18 · Solution Shape · Single-project monolith · ×1
  • Single-project monolith — The whole codebase lives in one project — at this size, splitting along clear seams (domain / infrastructure / hosting) would make boundaries explicit and builds faster.
D19 · Documentation Quality · Documentation · ×1
  • Documentation: no architecture or design documentation README.md — The README mentions no architecture or design documentation, despite the project having a non-empty architecture/design docs folder. Add an 'Architecture' section citing the existing architecture/Docs markdown files.
D20 · ADR Quality · No ADRs found · ×1
  • No ADRs found — No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`.
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion — 1 of 1 project(s) overshoot their size bounds, lowering Project Cohesion to 0.0/10. The most over is `officecli` (264139 LoC, 166 public types across 10 namespaces). Review these for cohesion — split a project that spans unrelated responsibilities.
D28 · Secrets (history) · Rotate the exposed credentials · ×1
  • REDACTED
D30 · Dependency Vulnerabilities · Scanner failed to run · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D39 · IL Efficiency · IL efficiency · ×1
  • IL efficiency: 775 authored method(s) exceed the IL budget src/officecli/Core/Chart/ChartHelper.Setter.cs:221 — 775 of 5221 first-party methods compile to oversized IL bodies (> 250 instructions); worst: OfficeCli.Core.ChartHelper.SetChartProperties @ src/officecli/Core/Chart/ChartHelper.Setter.cs:221, 14859 IL instructions; that pulled this dimension to 7.0/10. These bodies are far past the JIT's inline budget, so splitting them does not make them inlinable — what moves the number is emitting less: collapsing LINQ chains and closures on hot paths, and interpolation built eagerly where it is only sometimes used.
D43 · Malicious Dependencies · Scanner failed to run · ×1
  • REDACTED
D9 · Test Distribution · No tests found · ×1
  • No tests found — No test suite could be collected — no discoverable tests to count. If this repository does test, wiring the suite to a framework a runner can collect (xUnit, NUnit or MSTest) is what makes it countable here; a pipeline step that invokes a runner is not evidence on its own, because a runner over an empty suite passes. Tests written as plain executables or shell/PowerShell harnesses are not collectible this way and are not scored here.
ED5 · Idempotency · Possible non-idempotent mutation (review) · ×1
  • Possible non-idempotent mutation (review): Handlers.ExcelHandler.Import src/officecli/Handlers/Excel/ExcelHandler.Import.cs:25 — `Handlers.ExcelHandler.Import` mutates persistent state (a repository write) with no visible idempotency guard. Under a client retry or at-least-once redelivery a re-run could double-apply it — confirm it's safe to re-run, or add an exists/dedup check, an upsert, an idempotency-key/inbox, or a versioned write.
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.
M4 · Documentation accuracy · README/code drift · ×1
  • README/code drift README.md:191 — README advertises Docker containerisation, but no Dockerfile/compose file exists — searched for: `dockerfile`, `docker-compose`, `compose.yaml`, `compose.yml`. Each was matched case- and separator-insensitively against file and directory NAMES anywhere in the tree, and against the CONTENTS of manifest and configuration files (package.json and other *.json, *.csproj, *.props, *.sln/*.slnx, *.yml, *.toml, *.config, tool configs such as eslint.config.js, Dockerfile); the README's own prose never counts, so a claim is never refuted by merely being made. Nothing outside that search was read — a footprint living only in a submodule, in a file type not listed here, or under a name none of those terms matches is not seen, and this row is then wrong.
P3 · Security & performance tooling · No SAST · ×1
  • No SAST — No static application security testing detected. For this repository's stack, add CodeQL's csharp pack, or a .NET security analyzer package (or `semgrep --config=auto`, which runs on any language) as a CI step. What was searched, so you can tell an absence from a miss: the 21904 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.
PF1 · Benchmark discipline · No performance benchmarks · ×1
  • No performance benchmarks — No benchmark suite was found by the two searches this check runs. FIRST, a BenchmarkDotNet package reference in any project file — every project the workspace loaded, plus a walk of project files on disk that never loaded, because a benchmark suite is exactly the project a partial load drops. SECOND, a script harness: a file whose name contains `benchmark` and ends `.py`, `.sh`, `.ps1`, `.bash`, `.rb`, `.js` or `.mjs`, credited ONLY when this repository's CI text also mentions benchmarks — a harness no pipeline runs is read as a fixture, deliberately. Neither search can see a benchmark suite in another ecosystem's idiom (a Go `testing.B` file, a JMH or criterion project, a pytest-benchmark run), so this is 'no benchmark found by those two searches', not a verdict that the repository has none. Where code is performance-sensitive, a benchmark guards against silent regressions — but it's a bonus here, not a deduction.
X2 · Cancellation propagation · Not all async methods take a CancellationToken · ×1
  • Not all async methods take a CancellationToken — Only 27/31 async methods accept a CancellationToken, so in-flight work can't be stopped early when the caller gives up — whatever ends it in your host (shutdown signal, timeout, abandoned request, user cancel). Thread a token through the call chain and honour it at each await and loop; where a method genuinely cannot be interrupted, omitting it is a deliberate choice — judge against your hosting model.
X5 · Nullable reference types · Null-forgiving operator (`!`) suppressions reduce the NRT score · ×1
  • Null-forgiving operator (`!`) suppressions reduce the NRT score — ~1.1 `!` suppressions per 1k syntax nodes — 1633 suppression(s) across the 1554867 syntax node(s) in code where nullable warnings are ENABLED, which is the only code a `!` can suppress anything in (a `!` under `#nullable disable` is inert and is not counted, and its file's nodes are not in the denominator). Each one tells the compiler to trust you about null, suppressing the very safety NRTs provide.
X7 · Silent fallback defaults · Silent fallback default on unknown code · ×1
  • Silent fallback default on unknown code src/officecli/Core/Chart/ChartExBuilder.cs:1053 — `ParseSeriesLayout` maps every unrecognised code to `CX.SeriesLayout.Funnel`, one of the real values, with no log or throw — a malformed or new code silently reads as a known one. Throw on the unknown code, or log it. If that member is the correct answer for any other code, say so in a comment on the member and the row stops firing.
Minor — 1 finding(s)
D19 · Documentation Quality · XML-doc coverage · ×1
  • XML-doc coverage: officecli src/officecli/officecli.csproj — officecli: 38 % XML-doc coverage (679/1802).

Appendix B — Reproduction & audit trail

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

DimensionToolVersionCommandFindingsRaw output
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-71c1e465d0ef45fb93bad5cf3cfacc3a/history.json --exit-code 0 --source .0artifacts/raw/gitleaks-history.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-git --no-banner --config /opt/gitleaks-rules/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-71c1e465d0ef45fb93bad5cf3cfacc3a/tree.json --exit-code 0 --source .0artifacts/raw/gitleaks-tree.json
D29 · Static Analysis (SAST)semgrep—semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/watchdog-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off .36artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiesnuget—nuget: not applicable — nuget: the solution did not restore on the analyzer's .NET SDK (an SDK/target-framework/restore mismatch, common for an older codebase), so there was no restored dependency graph to scan0—
D30 · Dependency Vulnerabilitiesosv-scanner—osv-scanner --format json --recursive --experimental-disable-plugins transitivedependency/requirements --experimental-disable-plugins dotnet/csproj --experimental-disable-plugins dotnet/nugetcpm .0—
D30 · Dependency Vulnerabilitiestrivy—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
D31 · IaC & Container Securitytrivy—trivy: not applicable — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.0—
D32 · Data Compliance (PII/GDPR)semgrep—semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that. semgrep could not parse 12 file(s) — `src/officecli/BatchTypes.cs`, `src/officecli/Core/Formula/FormulaEvaluator.Spill.cs`, `src/officecli/Core/Formula/FormulaEvaluator.cs`, `src/officecli/Core/NativeRenderFailure.cs`, `src/officecli/Core/OutputFormatter.cs`, … (+7 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 Dependenciesosv-scanner—osv-scanner --format json --recursive --experimental-disable-plugins transitivedependency/requirements --experimental-disable-plugins dotnet/csproj --experimental-disable-plugins dotnet/nugetcpm .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 01a165f3-b3a3-7140-a2fa-4489c847dd48 · 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