Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor uncontrolled component code smells #711

Merged

Conversation

hugorplobo
Copy link
Contributor

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 Uncontrolled Component smell in 1 component.

The Uncontrolled Component smell occurs when a form doesn't use a state or prop, leading the form handling to the DOM itself. Sometimes this mean using a "ref" to access the input value instead of a state.

Code quality metrics were collected with Understand, before and after refactoring, and for this code smell, the cyclomatic, cyclomatic sum, number of functions and count line metrics were affected:

AvgCyclomatic CountDeclFunction Cyclomatic SumCyclomatic MaxNesting CountLine CountLineComment
1,93 1932 3273 9595 14 57061 3413

This pull request contains my refactoring for this smell.

Copy link

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

Copy link

codecov bot commented Nov 27, 2023

Codecov Report

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

Comparison is base (f151d32) 46.28% compared to head (c9e5a90) 38.71%.
Report is 29 commits behind head on develop.

Files Patch % Lines
...ons/advancedcharts/chart/gantt/frappe/lib/index.ts 0.43% 453 Missing ⚠️
...sions/advancedcharts/chart/gantt/frappe/lib/bar.ts 0.00% 194 Missing ⚠️
src/dashboard/sidebar/DashboardSidebar.tsx 13.11% 158 Missing and 1 partial ⚠️
...dvancedcharts/chart/gantt/frappe/lib/date_utils.js 6.08% 92 Missing and 16 partials ⚠️
...tensions/advancedcharts/chart/gantt/GanttChart.tsx 1.13% 87 Missing ⚠️
src/extensions/forms/chart/NeoForm.tsx 1.44% 68 Missing ⚠️
.../text2cypher/component/OverrideCardQueryEditor.tsx 4.22% 68 Missing ⚠️
src/dashboard/DashboardThunks.ts 7.57% 61 Missing ⚠️
...advancedcharts/chart/gantt/frappe/lib/svg_utils.ts 9.83% 55 Missing ⚠️
src/extensions/text2cypher/clients/ModelClient.ts 0.00% 54 Missing ⚠️
... and 66 more
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #711      +/-   ##
===========================================
- Coverage    46.28%   38.71%   -7.58%     
===========================================
  Files          166      203      +37     
  Lines         6594     8460    +1866     
  Branches      2043     2503     +460     
===========================================
+ Hits          3052     3275     +223     
- Misses        3501     5126    +1625     
- Partials        41       59      +18     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@alfredorubin96 alfredorubin96 merged commit 94d58ab into neo4j-labs:develop Nov 27, 2023
3 of 5 checks passed
@nielsdejong nielsdejong mentioned this pull request Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants