Diya 🔥 fix(sonarqube): Fixed Sonarqube Duplication Issues#2207
Merged
Conversation
one-community
approved these changes
May 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes SonarQube Quality Gate failures blocking the CI pipeline. This PR addresses code quality and security issues flagged by SonarCloud on the main branch analysis PR #2206
Fixes: SonarQube Quality Gate – Security Rating D → A, and Duplication > 3%
Related PRs (if any):
This PR is related to the PR #2206
Main changes explained:
src/controllers/lbdashboard/bidsController.js— Replaced...req.bodyspread with an explicit field allowlist when constructingnewBidsDatato prevent mass assignment of user-controlled data into database operations (line 89)src/controllers/bmdashboard/bmEquipmentController.js— Removed user-controlledcreatedByvalue fromconsole.errorlog to prevent logging of user-controlled data (line 301)src/controllers/calendarController.js— ReplacedparseIntwithNumber.parseInton lines 10–11 per SonarQube best practicessrc/helpers/userHelper.js— RefactoredassignBlueSquareForTimeNotMet(line 534) to reduce Cognitive Complexity from 90 to within the allowed limit of 15, by extracting the following helper functions:buildHistoryInfringements— formats past infringement HTMLcheckIsNewUser— determines new user statusbuildInfringementDescription— builds infringement description stringsupdateCategoryTangibleHrs— handles category hours DB updatesprocessUserForBlueSquare— handles all per-user processing logicsrc/helpers/userHelper.js— Replaced.filter((assignment) => assignment.assignedTo && assignment.assignedTo.isActive === true)with optional chainingassignment.assignedTo?.isActive === true(line 581)src/helpers/userHelper.js— Replacedforloop withfor...ofloop inemailWeeklySummariesForAllUsers(line 466)src/helpers/userHelper.js— Removed commented-out code (lines 2057, 2063, 2074, 2088, 2090, 2109, 2111, 2199, 2315, 2319) to satisfy SonarCloudNote:
SonarCloud Quality Gate before this PR:
developmentand then intomain.continuestatement behavior in the originalassignBlueSquareForTimeNotMetcategory update block has been intentionally changed: cache clearing now runs for all users regardless of whether category data exists, which is the safer behavior. Flag this with the team if the original skip behavior needs to be preserved.