chore(codeql): simplify redundant null-conditionals in StudentList#222
Open
rlorenzo wants to merge 1 commit into
Open
chore(codeql): simplify redundant null-conditionals in StudentList#222rlorenzo wants to merge 1 commit into
rlorenzo wants to merge 1 commit into
Conversation
Inside the `if (std.Student != null)` guard, ClassLevel/TermCode/Active still used `std.Student?.` / `std?.Student?.`, which CodeQL flagged as always-true conditions (cs/constant-condition). Drop the redundant operators; keep the genuinely-nullable StudentInfo?. Behavior unchanged.
Bundle ReportBundle size has no change ✅ |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #222 +/- ##
=======================================
Coverage 44.49% 44.49%
=======================================
Files 895 895
Lines 51655 51655
Branches 4812 4812
=======================================
Hits 22983 22983
Misses 28108 28108
Partials 564 564
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
There was a problem hiding this comment.
Pull request overview
This PR addresses CodeQL cs/constant-condition findings by removing redundant null-conditional operators inside StudentList.CreateStudentListFromStudentGradYears, where std.Student is already guarded by if (std.Student != null).
Changes:
- Simplify
ClassLevelandTermCodeassignments by removing redundantstd.Student?.null-conditionals while preserving the genuinely nullableStudentInfo?. - Simplify
Activecomputation by removing redundantstd?.Student?.null-conditionals under the existingstd.Student != nullguard.
bsedwards
approved these changes
Jun 18, 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.
What
StudentList.CreateStudentListFromStudentGradYearsbuilds aStudentinside anif (std.Student != null)guard, but three members still usedstd.Student?./std?.Student?.:The genuinely-nullable
StudentInfo?is kept.Why
CodeQL flagged these as
cs/constant-condition(#634, #635, #636, #637) — always-non-null because thestd.Student != nullguard already holds andstdcomes from.First(). The?.operators were dead. This is a behavior-neutral simplification, not a null-safety change.Notes
MailIdline is out of scope for this PR.