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 src/topics/tools.js to reduce cognitive complexity of function with helper functions #82

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

QGRRK
Copy link

@QGRRK QGRRK commented Jan 22, 2025

Refactored the toggleDelete function in src/topics/tools.js.

I used helper functions to move an if statement that involves or's and and's to reduce the cognitive complexity of the function "toggleDelete" from 17 to 15. Specifically, the original function included many if statements, which increased the cognitive complexity within the function.

Resolves #78

@QGRRK QGRRK changed the title Refactored function with helper functions Refactored code in src/topics/tools/js to reduce cognitive complexity of function with helper functions Jan 22, 2025
@coveralls
Copy link

Pull Request Test Coverage Report for Build 12900493116

Details

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

Totals Coverage Status
Change from base Build 12896760049: 0.008%
Covered Lines: 22327
Relevant Lines: 25583

💛 - Coveralls

@QGRRK QGRRK changed the title Refactored code in src/topics/tools/js to reduce cognitive complexity of function with helper functions Refactored code in src/topics/tools.js to reduce cognitive complexity of function with helper functions Jan 24, 2025
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/topics/tools.js to reduce Cognitive Complexity
2 participants