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 code in src/middleware/admin.js to reduce cognitive complexity #558

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

Conversation

e5z26
Copy link

@e5z26 e5z26 commented Sep 5, 2024

I changed an else and nestled if into else if on a helper function. I also removed a condition in an if (leads to adding some number to the time) by changing it into having the number times a factor (that is 0 or 1 depending on the condition) being added to the time. At the end of the code, instead of using an else, I returned on the other conditions and ran what was in the else in the body of the function. resolves #481

…into something that multiplies Math.min(60000, adminReloginDuration); Created a helper function for privilegeSet
Copy link

sonarcloud bot commented Sep 5, 2024

@coveralls
Copy link

Pull Request Test Coverage Report for Build 10727519299

Details

  • 10 of 12 (83.33%) changed or added relevant lines in 1 file are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.004%) to 82.667%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/middleware/admin.js 10 12 83.33%
Files with Coverage Reduction New Missed Lines %
src/meta/errors.js 1 76.74%
Totals Coverage Status
Change from base Build 10607818019: -0.004%
Covered Lines: 22326
Relevant Lines: 25586

💛 - 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.

Refactor code in src/middleware/admin.js
2 participants