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

Refactoring code in src/meta/configs.js #585

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

Conversation

tanoctavius
Copy link

@tanoctavius tanoctavius commented Sep 6, 2024

Addresses issue, resolves #465
Instruction: Refactor this function to reduce its Cognitive Complexity from 19 to the 15 allowed. (lines 19-54 for deserialize(config) function).

Original:
image
Cognitive Complexity of 19

Edited:
image
Cognitive Complexity of 7

To trigger the function:
The functions defined in configs.js are utility functions that aid with type conversions and validations for configuration settings. Hence, they are automatically called during the setup/ initialization phase of NodeBB (after running ./nodebb start and ./nodebb log) to ensure that the configuration values are correctly interpreted and validated. So, it is automatic and does not need to be triggered.

image

Copy link

sonarcloud bot commented Sep 6, 2024

@coveralls
Copy link

Pull Request Test Coverage Report for Build 10731238995

Details

  • 10 of 10 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.004%) to 82.675%

Totals Coverage Status
Change from base Build 10607818019: 0.004%
Covered Lines: 22324
Relevant Lines: 25582

💛 - Coveralls

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.

Refactoring code in src/meta/configs.js
3 participants