Management API: Add document patch endpoint #22104
CodeScene PR Check
Quality Gate Failed
Gates Failed
New code is healthy
(1 new file with code health below 8.00)
Enforce critical code health rules
(3 files with Low Cohesion, Bumpy Road Ahead)
Enforce advisory code health rules
(8 files with Lines of Code in a Single File, Code Duplication, Overall Function Size, Large Method, Complex Method, Complex Conditional, Large Assertion Blocks)
Gates Passed
1 Quality Gates Passed
See analysis details in CodeScene
Reason for failure
| New code is healthy | Violations | Code Health Impact | |
|---|---|---|---|
| PatchDocumentControllerTests.cs | 5 rules | 4.53 | Suppress |
| Enforce critical code health rules | Violations | Code Health Impact | |
|---|---|---|---|
| PatchDocumentControllerTests.cs | 1 critical rule | 4.53 | Suppress |
| PatchPathParser.cs | 1 critical rule | 9.24 | Suppress |
| PatchPathResolver.cs | 1 critical rule | 9.38 | Suppress |
| Enforce advisory code health rules | Violations | Code Health Impact | |
|---|---|---|---|
| PatchDocumentControllerTests.cs | 4 advisory rules | 4.53 | Suppress |
| PatchEngineTests.cs | 1 advisory rule | 8.55 | Suppress |
| PatchPathParserTests.cs | 1 advisory rule | 9.10 | Suppress |
| PatchPathParser.cs | 2 advisory rules | 9.24 | Suppress |
| PatchPathResolver.cs | 1 advisory rule | 9.38 | Suppress |
| PatchPathResolverTests.cs | 1 advisory rule | 9.39 | Suppress |
| DocumentPatcher.cs | 1 advisory rule | 9.66 | Suppress |
| UmbracoBuilderExtensions.cs | 1 advisory rule | 9.57 → 9.54 | Suppress |
Quality Gate Profile: Clean Code Collective
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.
Details
🚩 Declining Code Health (highest to lowest):
- Low Cohesion PatchDocumentControllerTests.cs
- Large Method PatchDocumentControllerTests.cs: CreateDeeplyNestedBlockDocument
- Code Duplication PatchEngineTests.cs
- Code Duplication PatchDocumentControllerTests.cs
- Large Method PatchDocumentControllerTests.cs: PatchDocument_BlockList_AddBlock_AppendsToExistingBlockList
- Large Assertion Blocks PatchPathParserTests.cs
- Large Method PatchDocumentControllerTests.cs: PatchDocument_BlockList_SingleBlock_UpdatesSingleProperty
- Lines of Code in a Single File PatchDocumentControllerTests.cs
- Overall Function Size PatchDocumentControllerTests.cs
- Code Duplication PatchPathResolverTests.cs
- Complex Method PatchPathResolver.cs: Resolve
- Large Method UmbracoBuilderExtensions.cs: AddUmbracoManagementApi
- Complex Method DocumentPatcher.cs: ApplyPatchAsync
- Complex Method PatchPathParser.cs: Parse
- Complex Conditional PatchPathParser.cs: Parse
- Bumpy Road Ahead PatchPathParser.cs: Parse
- Bumpy Road Ahead PatchPathResolver.cs: MatchesAllConditions
Annotations
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Lines of Code in a Single File
This module has 1373 lines of code, improve code health by reducing it to 1000. The number of Lines of Code in a single file. More Lines of Code lowers the code health.
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Low Cohesion
This module has at least 15 different responsibilities amongst its 19 functions, threshold = 3. Cohesion is calculated using the LCOM4 metric. Low cohesion means that the module/class has multiple unrelated responsibilities, doing too many things and breaking the Single Responsibility Principle.
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Code Duplication
The module contains 12 functions with similar structure: PatchDocument_BlockList_AddBlock_AppendsToExistingBlockList,PatchDocument_BlockList_SingleBlock_UpdatesSingleProperty,PatchDocument_DeeplyNestedBlocks_AddsBlockToNestedBlockList,PatchDocument_DeeplyNestedBlocks_InsertsBlockAtSpecificPosition and 8 more functions. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Overall Function Size
The median function size in this module is 57.0 LOC, threshold = 50.0. This file contains overly long functions, measured by their lines of code.
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Large Method
CreateDeeplyNestedBlockDocument has 307 lines, threshold = 70. Large functions with many lines of code are generally harder to understand and lower the code health. Avoid adding more lines to this function.
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Large Method
PatchDocument_BlockList_AddBlock_AppendsToExistingBlockList has 169 lines, threshold = 70. Large functions with many lines of code are generally harder to understand and lower the code health. Avoid adding more lines to this function.
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Large Method
PatchDocument_BlockList_SingleBlock_UpdatesSingleProperty has 166 lines, threshold = 70. Large functions with many lines of code are generally harder to understand and lower the code health. Avoid adding more lines to this function.
Check warning on line 113 in src/Umbraco.Cms.Api.Management/Patchers/DocumentPatcher.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Complex Method
ApplyPatchAsync has a cyclomatic complexity of 12, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ Getting worse: Large Method
AddUmbracoManagementApi increases from 78 to 82 lines of code, threshold = 70. Large functions with many lines of code are generally harder to understand and lower the code health. Avoid adding more lines to this function.
Check warning on line 109 in src/Umbraco.Cms.Api.Management/Patching/PatchPathParser.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Complex Method
Parse has a cyclomatic complexity of 16, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.
Check warning on line 62 in src/Umbraco.Cms.Api.Management/Patching/PatchPathParser.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Complex Conditional
Parse has 1 complex conditionals with 2 branches, threshold = 2. A complex conditional is an expression inside a branch (e.g. if, for, while) which consists of multiple, logical operators such as AND/OR. The more logical operators in an expression, the more severe the code smell.
Check warning on line 109 in src/Umbraco.Cms.Api.Management/Patching/PatchPathParser.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Bumpy Road Ahead
Parse has 2 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is 2 blocks per function. The Bumpy Road code smell is a function that contains multiple chunks of nested conditional logic. The deeper the nesting and the more bumps, the lower the code health.
Check warning on line 116 in src/Umbraco.Cms.Api.Management/Patching/PatchPathResolver.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Complex Method
Resolve has a cyclomatic complexity of 17, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.
Check warning on line 163 in src/Umbraco.Cms.Api.Management/Patching/PatchPathResolver.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Bumpy Road Ahead
MatchesAllConditions has 2 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is 2 blocks per function. The Bumpy Road code smell is a function that contains multiple chunks of nested conditional logic. The deeper the nesting and the more bumps, the lower the code health.
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Code Duplication
The module contains 14 functions with similar structure: Add_InsertAtIndex_InsertsElement,Add_NewObjectProperty_AddsProperty,Remove_ArrayElementByFilter_RemovesElement,Remove_ArrayElementByIndex_RemovesElement and 10 more functions. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Large Assertion Blocks
The test suite contains 6 assertion blocks with at least 4 assertions, threshold = 4. This test file has several blocks of large, consecutive assert statements. Avoid adding more.
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Code Duplication
The module contains 6 functions with similar structure: Resolve_FilterWithBooleanFalseValue_MatchesElement,Resolve_FilterWithBooleanValue_MatchesElement,Resolve_FilterWithDecimalValue_MatchesElement,Resolve_FilterWithMixedStringAndNumericConditions_MatchesElement and 2 more functions. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.