neo4j-labs / neodash

NeoDash - a Dashboard Builder for Neo4j
https://neo4j.com/labs/neodash/
Apache License 2.0
422 stars 143 forks source link

Refactor enum implicit values code smells #702

Closed hugorplobo closed 11 months ago

hugorplobo commented 11 months ago

Hello, I'm taking a software quality course, and as a final assignment, we were instructed to perform code smell refactorings in open source projects. For this issue I identified the Enum Implicit Value smell in 7 components.

The Enum Implicit Value occurs when an enumeration has no explicit numerical values for each of its variants. This can lead to bugs when the enum values are used in a numerical situation and new variants are introduced, since the typescript compiler will assign an automatic value for each variant.

Code quality metrics were collected with Understand, before and after refactoring, but for this code smell, there was no change.

AvgCyclomatic CountDeclFunction Cyclomatic SumCyclomatic MaxNesting CountLine CountLineComment
1,93 1933 3272 9594 14 57043 3413

This pull request contains my refactoring for this smell.

sonarcloud[bot] commented 11 months ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

codecov[bot] commented 11 months ago

Codecov Report

Attention: 1975 lines in your changes are missing coverage. Please review.

Comparison is base (f151d32) 46.28% compared to head (1e66f6c) 38.72%. Report is 28 commits behind head on develop.

Files Patch % Lines
...ons/advancedcharts/chart/gantt/frappe/lib/index.ts 0.43% 453 Missing :warning:
...sions/advancedcharts/chart/gantt/frappe/lib/bar.ts 0.00% 194 Missing :warning:
src/dashboard/sidebar/DashboardSidebar.tsx 13.11% 158 Missing and 1 partial :warning:
...dvancedcharts/chart/gantt/frappe/lib/date_utils.js 6.08% 92 Missing and 16 partials :warning:
...tensions/advancedcharts/chart/gantt/GanttChart.tsx 1.13% 87 Missing :warning:
src/extensions/forms/chart/NeoForm.tsx 1.44% 68 Missing :warning:
.../text2cypher/component/OverrideCardQueryEditor.tsx 4.22% 68 Missing :warning:
src/dashboard/DashboardThunks.ts 7.57% 61 Missing :warning:
...advancedcharts/chart/gantt/frappe/lib/svg_utils.ts 9.83% 55 Missing :warning:
src/extensions/text2cypher/clients/ModelClient.ts 0.00% 54 Missing :warning:
... and 66 more
Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #702 +/- ## =========================================== - Coverage 46.28% 38.72% -7.56% =========================================== Files 166 203 +37 Lines 6594 8459 +1865 Branches 2043 2502 +459 =========================================== + Hits 3052 3276 +224 - Misses 3501 5124 +1623 - Partials 41 59 +18 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.