Skip to content

CodeQL 12: chore: style sweep for remaining CodeQL alerts#198

Open
rlorenzo wants to merge 2 commits into
mainfrom
codeql/12-style-sweep
Open

CodeQL 12: chore: style sweep for remaining CodeQL alerts#198
rlorenzo wants to merge 2 commits into
mainfrom
codeql/12-style-sweep

Conversation

@rlorenzo
Copy link
Copy Markdown
Contributor

@rlorenzo rlorenzo commented May 13, 2026

Summary

Sweep PR covering the remaining straightforward CodeQL style alerts that earlier PRs deferred.

Closes

cs/useless-tostring-call (7):

  • HomeController.cs:315 - doc.ToString() in string concat → drop
  • GradYearClassLevel.cs:57,60,69 - .ToString() after int in "V" + ...
  • UinformService.cs:274 - epochTime.ToString() in concat
  • LdapUserContact.cs:39 - v.ToString() in concat
  • TermCodeService.cs:39 - year.ToString() in string.Format

cs/missed-ternary-operator (6 / 17):

  • HttpHelper.cs:51 - HttpContext getter collapsed to expression-bodied ?.HttpContext
  • RAPSController.cs:315,359 - if/else return View(...) → ternary
  • CMSController.cs:28 - if/else return cms.X(...) → ternary
  • VerificationService.cs:773 - dueDate if/else assignment → ternary
  • UserHelper.cs:68,152,280,345 - four if (x != null) return x; else return Y; blocks → x ?? Y (in CodeQL 12 part 1 before this PR was scoped - folded in here)

cs/local-shadows-member (3):

  • HttpHelper.Configure parameters httpContextAccessor, authorizationService, dataProtectionProvider renamed to non-shadowing names (contextAccessor, authzService, dataProtection); the assignments to private static fields no longer need the HttpHelper. qualifier.

cs/loss-of-precision (3):

  • test/ClinicalScheduler/EmailNotificationTest.cs:122-123 and TestDataBuilder.cs:179 - explicit (double) casts around the int arithmetic flowing into DateTime.AddDays(double).

Not addressed

Remaining cs/missed-ternary-operator (11) where the branches contain multi-statement bodies that don't fit ternary cleanly (UinformService.cs:247 deserialize path, EffortAuditService.cs:605 IQueryable build, etc.) - converting them would hurt readability. Same for cs/complex-condition (17) which are subjective rewrites, cs/complex-block (1), cs/nested-if-statements (2). The two js/implicit-operand-conversion alerts in course-import-dialog.test.ts:72,96 are intentional test code simulating non-Error throws.

Context

Twelfth in the CodeQL N: cleanup series.

Test plan

  • npm run test:backend - 1946 tests passing
  • Pre-commit lint+test+verify all passed
  • CodeQL workflow on this PR shows the listed style alerts closed

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 13, 2026

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • review-ready

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: db34ce3a-52cb-4fef-989a-4c6c2c42bd57

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codeql/12-style-sweep

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov-commenter
Copy link
Copy Markdown

Bundle Report

Bundle size has no change ✅

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 13, 2026

Codecov Report

❌ Patch coverage is 25.00000% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 42.98%. Comparing base (38de1ad) to head (eea4ff3).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
web/Areas/RAPS/Controllers/RAPSController.cs 0.00% 6 Missing ⚠️
web/Classes/UserHelper.cs 0.00% 5 Missing ⚠️
web/Areas/CMS/Controllers/CMSController.cs 0.00% 3 Missing ⚠️
web/Areas/Students/Services/GradYearClassLevel.cs 0.00% 3 Missing ⚠️
web/Areas/Directory/Models/LdapUserContact.cs 0.00% 1 Missing ⚠️
web/Areas/RAPS/Services/UinformService.cs 0.00% 1 Missing ⚠️
web/Classes/HttpHelper.cs 75.00% 1 Missing ⚠️
web/Controllers/HomeController.cs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #198      +/-   ##
==========================================
+ Coverage   42.96%   42.98%   +0.02%     
==========================================
  Files         877      877              
  Lines       51468    51433      -35     
  Branches     4802     4804       +2     
==========================================
- Hits        22113    22109       -4     
+ Misses      28831    28800      -31     
  Partials      524      524              
Flag Coverage Δ
backend 43.06% <25.00%> (+0.02%) ⬆️
frontend 41.34% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment thread test/ClinicalScheduler/EmailNotificationTest.cs Fixed
Comment thread test/ClinicalScheduler/EmailNotificationTest.cs Fixed
Comment thread test/ClinicalScheduler/TestDataBuilder.cs Fixed
Comment thread test/ClinicalScheduler/EmailNotificationTest.cs Fixed
Comment thread test/ClinicalScheduler/EmailNotificationTest.cs Fixed
Comment thread test/ClinicalScheduler/TestDataBuilder.cs Fixed
- UserHelper.cs: capture user into 'fallbackUser' local before
  GetOrCreate lambda so ReSharper AccessToModifiedClosure is silenced
- HttpHelper.cs: drop stale '<param name="memoryCache">' XML tag now
  that the other params don't have matching tags (was creating 5
  InvalidXmlDocComment warnings since the rename)
- test/ClinicalScheduler/{EmailNotificationTest,TestDataBuilder}.cs:
  replace '(double)(-7 * x)' with '-7.0 * x' — same intent (force the
  multiplication into double per cs/loss-of-precision) but no
  RedundantCast warning from ReSharper
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.

3 participants