Skip to content

Move the dimensions extractor implementation into infrastructure.

70ce78e
Select commit
Loading
Failed to load commit list.
Merged

Media: Set width and height for uploaded SVGs #22244

Move the dimensions extractor implementation into infrastructure.
70ce78e
Select commit
Loading
Failed to load commit list.
CodeScene Delta Analysis / CodeScene Code Health Review (main) failed Mar 26, 2026 in 54s

CodeScene PR Check

Quality Gate Failed

Gates Failed
Enforce advisory code health rules (5 files with Large Method, Complex Method, Excess Number of Function Arguments, Code Duplication, Primitive Obsession, 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
SvgFileUploadMediaSavingNotificationHandlerTests.cs 4 advisory rules 8.55 Suppress
SvgDimensionExtractorTests.cs 1 advisory rule 8.55 Suppress
SvgFileUploadMediaSavingNotificationHandler.cs 2 advisory rules 9.39 Suppress
UmbracoBuilder.CoreServices.cs 1 advisory rule 8.78 → 8.77 Suppress
UmbracoPlan.cs 1 advisory rule 9.55 → 9.55 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):

  • Code Duplication SvgDimensionExtractorTests.cs
  • Large Method UmbracoBuilder.CoreServices.cs: AddCoreInitialServices
  • Code Duplication SvgFileUploadMediaSavingNotificationHandlerTests.cs
  • Large Method UmbracoBuilder.CoreServices.cs: AddCoreNotifications
  • Large Method UmbracoPlan.cs: UmbracoPlan
  • Complex Method SvgFileUploadMediaSavingNotificationHandler.cs: AutoFillSvgWidthHeight
  • Excess Number of Function Arguments SvgFileUploadMediaSavingNotificationHandler.cs: SetProperty
  • Primitive Obsession SvgFileUploadMediaSavingNotificationHandlerTests.cs
  • String Heavy Function Arguments SvgFileUploadMediaSavingNotificationHandlerTests.cs
  • Excess Number of Function Arguments SvgFileUploadMediaSavingNotificationHandlerTests.cs: CreateMedia
  • Excess Number of Function Arguments SvgFileUploadMediaSavingNotificationHandlerTests.cs: CreateMedia
  • Excess Number of Function Arguments SvgFileUploadMediaSavingNotificationHandlerTests.cs: CreateMedia

Annotations

Check warning on line 172 in src/Umbraco.Infrastructure/Migrations/Upgrade/UmbracoPlan.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (main)

❌ Getting worse: Large Method

UmbracoPlan increases from 80 to 81 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 231 in src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.CoreServices.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (main)

❌ Getting worse: Large Method

AddCoreInitialServices increases from 124 to 125 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 407 in src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.CoreServices.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (main)

❌ Getting worse: Large Method

AddCoreNotifications increases from 105 to 106 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 86 in src/Umbraco.Infrastructure/PropertyEditors/NotificationHandlers/SvgFileUploadMediaSavingNotificationHandler.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (main)

❌ New issue: Complex Method

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

Check warning on line 110 in src/Umbraco.Infrastructure/PropertyEditors/NotificationHandlers/SvgFileUploadMediaSavingNotificationHandler.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (main)

❌ New issue: Excess Number of Function Arguments

SetProperty has 5 arguments, max arguments = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.

Check warning on line 66 in tests/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/PropertyEditors/SvgFileUploadMediaSavingNotificationHandlerTests.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (main)

❌ New issue: Code Duplication

The module contains 7 functions with similar structure: Does_Not_Set_Properties_When_Dimensions_Not_Extracted,Passes_Culture_And_Segment_To_SetValue,Sets_Width_And_Height_When_Dimensions_Extracted,Skips_When_Height_Property_Missing and 3 more functions. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.

Check warning on line 1 in tests/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/PropertyEditors/SvgFileUploadMediaSavingNotificationHandlerTests.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (main)

❌ New issue: Primitive Obsession

In this module, 80.0% of all function arguments are primitive types, threshold = 30.0%. The functions in this file have too many primitive types (e.g. int, double, float) in their function argument lists. Using many primitive types lead to the code smell Primitive Obsession. Avoid adding more primitive arguments.

Check warning on line 208 in tests/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/PropertyEditors/SvgFileUploadMediaSavingNotificationHandlerTests.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (main)

❌ New issue: Excess Number of Function Arguments

CreateMedia has 7 arguments, max arguments = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.

Check warning on line 226 in tests/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/PropertyEditors/SvgFileUploadMediaSavingNotificationHandlerTests.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (main)

❌ New issue: Excess Number of Function Arguments

CreateMedia has 6 arguments, max arguments = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.

Check warning on line 288 in tests/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/PropertyEditors/SvgFileUploadMediaSavingNotificationHandlerTests.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (main)

❌ New issue: Excess Number of Function Arguments

CreateMedia has 9 arguments, max arguments = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.

Check warning on line 1 in tests/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/PropertyEditors/SvgFileUploadMediaSavingNotificationHandlerTests.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (main)

❌ New issue: String Heavy Function Arguments

In this module, 64.0% of all arguments to its 15 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.

Check warning on line 39 in tests/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Media/SvgDimensionExtractorTests.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (main)

❌ New issue: Code Duplication

The module contains 14 functions with similar structure: Can_Parse_And_Fallback_Attribute_Width_Height_Percent,Can_Parse_And_Fallback_Width_Height_Em,Can_Parse_Attribute_Width_Height_No_Unit,Can_Parse_Attribute_Width_Height_Pixels and 10 more functions. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.