Simplify creating content from a blueprint programmatically#19528
CodeScene PR Check
Quality Gate Failed
Code Health Improved
(1 files improve in Code Health)
Gates Failed
Enforce advisory code health rules
(2 files with Complex Method, String Heavy Function Arguments)
Gates Passed
3 Quality Gates Passed
See analysis details in CodeScene
Reason for failure
| Enforce advisory code health rules | Violations | Code Health Impact | |
|---|---|---|---|
| ContentBlueprintEditingServiceTests.GetScaffold.cs | 1 advisory rule | 10.00 → 9.69 | Suppress |
| DataTypeBuilder.cs | 1 advisory rule | 9.64 → 9.39 | Suppress |
View Improvements
| File | Code Health Impact | Categories Improved |
|---|---|---|
| ContentService.cs | no change | Bumpy Road Ahead, Overall Code Complexity |
| ElementSwitchValidatorTests.cs | 8.82 → 9.69 | Code Duplication, Primitive Obsession |
Quality Gate Profile: Clean Code Collective
Want more control? Customize Code Health rules or catch issues early with our IDE extension and CLI tool.
Details
🚩 Declining Code Health (highest to lowest):
- String Heavy Function Arguments ContentBlueprintEditingServiceTests.GetScaffold.cs
- Complex Method DataTypeBuilder.cs: CreateSimpleElementDataType
✅ Improving Code Health:
- Overall Code Complexity ContentService.cs 🔥
- Bumpy Road Ahead ContentService.cs: CreateContentFromBlueprint 🔥
- Code Duplication ElementSwitchValidatorTests.cs
- Primitive Obsession ElementSwitchValidatorTests.cs
Annotations
Check notice on line 3681 in src/Umbraco.Core/Services/ContentService.cs
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ No longer an issue: Bumpy Road Ahead
CreateContentFromBlueprint 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 1 in src/Umbraco.Core/Services/ContentService.cs
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ Getting better: Overall Code Complexity
The mean cyclomatic complexity decreases from 4.14 to 4.10, 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 warning on line 205 in tests/Umbraco.Tests.Common/Builders/DataTypeBuilder.cs
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Method
CreateSimpleElementDataType has a cyclomatic complexity of 9, 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 Cloud Delta Analysis (main)
✅ No longer an issue: Code Duplication
The module no longer contains too many functions with similar structure
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ No longer an issue: Primitive Obsession
The ratio of primivite types in function arguments is no longer above the threshold
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: String Heavy Function Arguments
In this module, 40.0% of all arguments to its 9 functions are strings. The threshold for string arguments is 39.0%. The functions in this file have a high ratio of strings as arguments. Avoid adding more.