Fix sql syntax issues (closes #20453) #21307
CodeScene PR Check
Quality Gate Failed
Code Health Improved
(1 files improve in Code Health)
Gates Failed
Enforce critical code health rules
(1 file with Low Cohesion)
Enforce advisory code health rules
(4 files with Complex Method, Complex Conditional, Code Duplication)
Gates Passed
2 Quality Gates Passed
See analysis details in CodeScene
Reason for failure
| Enforce critical code health rules | Violations | Code Health Impact | |
|---|---|---|---|
| NPocoSqlExtensions.cs | 1 critical rule | 7.79 → 6.40 | Suppress |
| Enforce advisory code health rules | Violations | Code Health Impact | |
|---|---|---|---|
| NPocoSqlExtensions.cs | 1 advisory rule | 7.79 → 6.40 | Suppress |
| Query.cs | 1 advisory rule | 10.00 → 9.39 | Suppress |
| DatabaseSchemaCreator.cs | 1 advisory rule | 8.94 → 8.91 | Suppress |
| UserRepository.cs | 1 advisory rule | 4.14 → 4.13 | Suppress |
View Improvements
| File | Code Health Impact | Categories Improved |
|---|---|---|
| DatabaseDataCreator.cs | 3.62 → 4.08 | Lines of Code in a Single File, Large Method, Overall Code Complexity, Primitive Obsession, Excess Number of Function Arguments, String Heavy Function Arguments |
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):
- Low Cohesion NPocoSqlExtensions.cs
- Complex Method UserRepository.cs: GetPagedResultsByQuery
- Code Duplication Query.cs
- Complex Conditional NPocoSqlExtensions.cs: GetAlias
- Complex Method DatabaseSchemaCreator.cs: CreateTable
✅ Improving Code Health:
- Large Method DatabaseDataCreator.cs: CreateNodeDataForDataTypes
- Large Method DatabaseDataCreator.cs: CreatePropertyTypeData
- Lines of Code in a Single File DatabaseDataCreator.cs
- Large Method DatabaseDataCreator.cs: CreateNodeDataForMediaTypes
- Primitive Obsession DatabaseDataCreator.cs
- String Heavy Function Arguments DatabaseDataCreator.cs
- Primitive Obsession SqlSyntaxProviderBase.cs
- String Heavy Function Arguments SqlSyntaxProviderBase.cs
- Large Method DatabaseDataCreator.cs: CreatePropertyTypeGroupData
- Large Method DatabaseDataCreator.cs: CreateUserGroupData
- Excess Number of Function Arguments DatabaseDataCreator.cs: ConditionalInsert
- Overall Code Complexity DatabaseDataCreator.cs
Annotations
Check notice on line 1 in src/Umbraco.Infrastructure/Migrations/Install/DatabaseDataCreator.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
✅ Getting better: Lines of Code in a Single File
The lines of code decreases from 2460 to 2118, 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.
Check notice on line 865 in src/Umbraco.Infrastructure/Migrations/Install/DatabaseDataCreator.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
✅ Getting better: Large Method
CreateNodeDataForDataTypes decreases from 626 to 561 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 notice on line 1736 in src/Umbraco.Infrastructure/Migrations/Install/DatabaseDataCreator.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
✅ Getting better: Large Method
CreatePropertyTypeData decreases from 423 to 339 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 notice on line 1001 in src/Umbraco.Infrastructure/Migrations/Install/DatabaseDataCreator.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
✅ Getting better: Large Method
CreateNodeDataForMediaTypes decreases from 143 to 129 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 notice on line 1385 in src/Umbraco.Infrastructure/Migrations/Install/DatabaseDataCreator.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
✅ Getting better: Large Method
CreatePropertyTypeGroupData decreases from 115 to 87 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 notice on line 1253 in src/Umbraco.Infrastructure/Migrations/Install/DatabaseDataCreator.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
✅ Getting better: Large Method
CreateUserGroupData decreases from 91 to 71 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 notice on line 1 in src/Umbraco.Infrastructure/Migrations/Install/DatabaseDataCreator.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
✅ No longer an issue: Overall Code Complexity
The mean cyclomatic complexity in this module is no longer above the threshold
Check notice on line 1 in src/Umbraco.Infrastructure/Migrations/Install/DatabaseDataCreator.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
✅ Getting better: Primitive Obsession
The ratio of primitive types in function arguments decreases from 82.86% to 74.29%, 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 notice on line 2443 in src/Umbraco.Infrastructure/Migrations/Install/DatabaseDataCreator.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
✅ No longer an issue: Excess Number of Function Arguments
ConditionalInsert is no longer above the threshold for number of arguments. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.
Check notice on line 1 in src/Umbraco.Infrastructure/Migrations/Install/DatabaseDataCreator.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
✅ Getting better: String Heavy Function Arguments
The ratio of strings in function arguments decreases from 57.14% to 51.43%, threshold = 39.0%. The functions in this file have a high ratio of strings as arguments. Avoid adding more.
Check warning on line 528 in src/Umbraco.Infrastructure/Migrations/Install/DatabaseSchemaCreator.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ Getting worse: Complex Method
CreateTable increases in cyclomatic complexity from 11 to 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.
Check warning on line 1 in src/Umbraco.Infrastructure/Persistence/NPocoSqlExtensions.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Low Cohesion
This module has at least 10 different responsibilities amongst its 72 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.
Check warning on line 1586 in src/Umbraco.Infrastructure/Persistence/NPocoSqlExtensions.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Complex Conditional
GetAlias has 1 complex conditionals with 3 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 52 in src/Umbraco.Infrastructure/Persistence/Querying/Query.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Code Duplication
The module contains 2 functions with similar structure: WhereIn,WhereNotIn. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ Getting worse: Complex Method
GetPagedResultsByQuery already has high cyclomatic complexity, and now it increases in Lines of Code from 109 to 115. 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/Persistence/SqlSyntax/SqlSyntaxProviderBase.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
✅ Getting better: Primitive Obsession
The ratio of primitive types in function arguments decreases from 52.11% to 51.35%, 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 notice on line 1 in src/Umbraco.Infrastructure/Persistence/SqlSyntax/SqlSyntaxProviderBase.cs
codescene-delta-analysis / CodeScene Code Health Review (main)
✅ Getting better: String Heavy Function Arguments
The ratio of strings in function arguments decreases from 43.66% to 43.24%, threshold = 39.0%. The functions in this file have a high ratio of strings as arguments. Avoid adding more.