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

Refactored code in public/src/client/account/settings.js to reduce complexity. #571

Open
wants to merge 6 commits into
base: f24
Choose a base branch
from

Conversation

jullia02
Copy link

@jullia02 jullia02 commented Sep 5, 2024

This PR refactors the saveSettings() function in settings.js, reducing cognitive complexity from 17 to 15 to improve readability and for simplicity. This was done by making multiple helper functions handleNewSettings(), processNewSettings(), and checkAndUpdateConfig().

This PR resolves #570, with the sonar cloud warning: https://sonarcloud.io/project/issues?open=AZFmi_ySybYwxy-_uEQC&id=CMU-313_NodeBB

This refactored code is covered by the test file: ./test/public/src/settings.js

UI Test Instructions

  1. Click on profile icon on top right.
  2. Click on Settings
  3. Change either the language/skin/home page setting.
  4. Click on "Save changes". This should print the console log message.
Screenshot 2024-09-05 at 8 19 20 PM

@coveralls
Copy link

coveralls commented Sep 5, 2024

Pull Request Test Coverage Report for Build 10730309223

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 82.671%

Totals Coverage Status
Change from base Build 10607818019: 0.0%
Covered Lines: 22323
Relevant Lines: 25582

💛 - Coveralls

Copy link

sonarcloud bot commented Sep 6, 2024

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.

Refactor code in public/src/client/account/settings.js
2 participants