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

Add helper functions and constants to public/src/ajaxify.js to reduce cognitive complexity #165

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

Conversation

Sharkesh111
Copy link

@Sharkesh111 Sharkesh111 commented Jan 23, 2025

Edited the function(e) function by extracting redundant code and putting them in helper functions and making constants for them. Created the function andHelper to reduce the amount of &&'s in the code and reduce the the overall cognitive complexity. Also added const internalLinkAndHref which represented a value that was used multiple times in the code and had multiple &&'s in it.

Tested the changes by adding test cases that cover the public/src/ajaxify.js file and running npm run lint and npm run test. Also manually checked code by interacting with UI and triggering console.log

Resolves #107

@coveralls
Copy link

coveralls commented Jan 23, 2025

Pull Request Test Coverage Report for Build 12940941895

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.003%) to 82.674%

Files with Coverage Reduction New Missed Lines %
src/meta/errors.js 1 83.72%
Totals Coverage Status
Change from base Build 12896760049: 0.003%
Covered Lines: 22323
Relevant Lines: 25582

💛 - Coveralls

@Sharkesh111 Sharkesh111 changed the title Refactored public/src/ajaxify.js Add helper functions and constants to public/src/ajaxify.js to reduce cognitive complexity #120 Jan 24, 2025
@Sharkesh111 Sharkesh111 changed the title Add helper functions and constants to public/src/ajaxify.js to reduce cognitive complexity #120 Add helper functions and constants to public/src/ajaxify.js to reduce cognitive complexity 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 public/src/ajaxify.js
2 participants