Variation: Rethink the segment model #23060
CodeScene PR Check
Quality Gate Failed
Code Health Improved
(5 files improve in Code Health)
Gates Failed
Enforce advisory code health rules
(2 files with Complex Method, Code Duplication)
Gates Passed
3 Quality Gates Passed
See analysis details in CodeScene
Reason for failure
| Enforce advisory code health rules | Violations | Code Health Impact | |
|---|---|---|---|
| BlockEditorVarianceHandlerTests.cs | 1 advisory rule | 9.10 → 8.82 | Suppress |
| BlockEditorValidatorBase.cs | 1 advisory rule | 8.07 → 8.00 | Suppress |
View Improvements
| File | Code Health Impact | Categories Improved |
|---|---|---|
| ContentEditingServiceBase.cs | 6.44 → 6.49 | Complex Method, Complex Conditional, Overall Code Complexity |
| ContentValidationServiceBase.cs | 7.95 → 8.77 | Complex Method, Complex Conditional, Overall Code Complexity, Deep, Nested Complexity |
| MemberEditingService.cs | 7.41 → 7.43 | Complex Method, Overall Code Complexity |
| ContentEditingModelFactory.cs | 8.36 → 8.91 | Complex Method, Bumpy Road Ahead, Deep, Nested Complexity |
| ContentControllerBase.cs | 8.89 → 8.91 | Large Method |
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):
- Complex Method BlockEditorValidatorBase.cs: GetBlockEditorDataValidation
- Code Duplication BlockEditorVarianceHandlerTests.cs
✅ Improving Code Health:
- Low Cohesion ContentEditingServiceTests.Create.cs
- Code Duplication ContentEditingServiceTests.Create.cs: Cannot_Create_Segment_Variant_Without_Default_Segment
- Code Duplication BlockExposeFallbackHelperTests.cs: IsBlockExposed_Returns_False_When_Segment_Does_Not_Match_In_Fallback
- Overall Code Complexity ContentEditingServiceBase.cs
- Deep, Nested Complexity ContentValidationServiceBase.cs: HandlePropertiesValidationAsync
- Overall Code Complexity MemberEditingService.cs
- Lines of Code in a Single File BlockListElementLevelVariationTests.Editing.cs
- Code Duplication BlockEditorVarianceHandlerTests.cs: AlignedExposeVarianceAsync_Preserves_Segment_When_Assigning_Culture
- Complex Method ContentValidationServiceBase.cs: HandlePropertiesValidationAsync
- Large Method ContentControllerBase.cs: ContentEditingOperationStatusResult
- Complex Method MemberEditingService.cs: ValidateMemberDataAsync
- Complex Conditional ContentEditingServiceBase.cs: TryGetAndValidateContentType
- Deep, Nested Complexity ContentEditingModelFactory.cs: MapNames
- Complex Method ContentEditingModelFactory.cs: MapNames
- Complex Method ContentEditingServiceBase.cs: TryGetAndValidateContentType
- Bumpy Road Ahead ContentEditingModelFactory.cs: MapNames
- Complex Conditional ContentValidationServiceBase.cs: HandlePropertiesValidationAsync
- Overall Code Complexity ContentValidationServiceBase.cs
Annotations
Check notice on line 539 in src/Umbraco.Core/Services/ContentEditingServiceBase.cs
codescene-delta-analysis / CodeScene Code Health Review (v19/dev)
✅ Getting better: Complex Method
TryGetAndValidateContentType decreases in cyclomatic complexity from 13 to 10, 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 notice on line 526 in src/Umbraco.Core/Services/ContentEditingServiceBase.cs
codescene-delta-analysis / CodeScene Code Health Review (v19/dev)
✅ No longer an issue: Complex Conditional
TryGetAndValidateContentType no longer has a complex conditional. 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 notice on line 1 in src/Umbraco.Core/Services/ContentEditingServiceBase.cs
codescene-delta-analysis / CodeScene Code Health Review (v19/dev)
✅ Getting better: Overall Code Complexity
The mean cyclomatic complexity decreases from 4.78 to 4.52, threshold = 4. This file has many conditional statements (e.g. if, for, while) across its implementation, leading to lower code health. Avoid adding more conditionals.
Check notice on line 140 in src/Umbraco.Core/Services/ContentValidationServiceBase.cs
codescene-delta-analysis / CodeScene Code Health Review (v19/dev)
✅ Getting better: Complex Method
HandlePropertiesValidationAsync decreases in cyclomatic complexity from 24 to 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 notice on line 127 in src/Umbraco.Core/Services/ContentValidationServiceBase.cs
codescene-delta-analysis / CodeScene Code Health Review (v19/dev)
✅ No longer an issue: Complex Conditional
HandlePropertiesValidationAsync no longer has a complex conditional
Check notice on line 1 in src/Umbraco.Core/Services/ContentValidationServiceBase.cs
codescene-delta-analysis / CodeScene Code Health Review (v19/dev)
✅ No longer an issue: Overall Code Complexity
The mean cyclomatic complexity in this module is no longer above the threshold
Check notice on line 140 in src/Umbraco.Core/Services/ContentValidationServiceBase.cs
codescene-delta-analysis / CodeScene Code Health Review (v19/dev)
✅ Getting better: Deep, Nested Complexity
HandlePropertiesValidationAsync decreases in nested complexity depth from 5 to 4, threshold = 4. This function contains deeply nested logic such as if statements and/or loops. The deeper the nesting, the lower the code health.
Check warning on line 146 in src/Umbraco.Infrastructure/PropertyEditors/BlockEditorValidatorBase.cs
codescene-delta-analysis / CodeScene Code Health Review (v19/dev)
❌ Getting worse: Complex Method
GetBlockEditorDataValidation increases in cyclomatic complexity from 26 to 29, 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 notice on line 394 in src/Umbraco.Infrastructure/Services/MemberEditingService.cs
codescene-delta-analysis / CodeScene Code Health Review (v19/dev)
✅ Getting better: Complex Method
ValidateMemberDataAsync decreases in cyclomatic complexity from 17 to 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 notice on line 1 in src/Umbraco.Infrastructure/Services/MemberEditingService.cs
codescene-delta-analysis / CodeScene Code Health Review (v19/dev)
✅ Getting better: Overall Code Complexity
The mean cyclomatic complexity decreases from 5.41 to 5.29, threshold = 4. This file has many conditional statements (e.g. if, for, while) across its implementation, leading to lower code health. Avoid adding more conditionals.
Check notice on line 56 in tests/Umbraco.Tests.Common/Factories/ContentEditingModelFactory.cs
codescene-delta-analysis / CodeScene Code Health Review (v19/dev)
✅ No longer an issue: Complex Method
MapNames is no longer above the threshold for cyclomatic complexity. 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 notice on line 56 in tests/Umbraco.Tests.Common/Factories/ContentEditingModelFactory.cs
codescene-delta-analysis / CodeScene Code Health Review (v19/dev)
✅ No longer an issue: Bumpy Road Ahead
MapNames is no longer above the threshold for logical blocks with deeply nested code. 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 notice on line 56 in tests/Umbraco.Tests.Common/Factories/ContentEditingModelFactory.cs
codescene-delta-analysis / CodeScene Code Health Review (v19/dev)
✅ No longer an issue: Deep, Nested Complexity
MapNames is no longer above the threshold for nested complexity depth. This function contains deeply nested logic such as if statements and/or loops. The deeper the nesting, the lower the code health.
codescene-delta-analysis / CodeScene Code Health Review (v19/dev)
✅ Getting better: Low Cohesion
The number of different responsibilities decreases from 23 to 22, 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 (v19/dev)
✅ Getting better: Code Duplication
reduced similar code in: Cannot_Create_Segment_Variant_Without_Default_Segment. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.
codescene-delta-analysis / CodeScene Code Health Review (v19/dev)
✅ Getting better: Lines of Code in a Single File
The lines of code decreases from 1303 to 1298, 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 (v19/dev)
❌ Getting worse: Code Duplication
introduced similar code in: AlignExposeVariance_Can_Align_Variance,AlignExposeVariance_Skips_When_ElementType_Not_Found. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.
codescene-delta-analysis / CodeScene Code Health Review (v19/dev)
✅ Getting better: Code Duplication
reduced similar code in: AlignedExposeVarianceAsync_Preserves_Segment_When_Assigning_Culture. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.
codescene-delta-analysis / CodeScene Code Health Review (v19/dev)
✅ Getting better: Code Duplication
reduced similar code in: IsBlockExposed_Returns_False_When_Segment_Does_Not_Match_In_Fallback. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.
codescene-delta-analysis / CodeScene Code Health Review (v19/dev)
✅ Getting better: Large Method
ContentEditingOperationStatusResult decreases from 93 to 89 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.