CodeQL 13: chore: additional style fixes (ternary, complex-block, implicit-conversion)#199
CodeQL 13: chore: additional style fixes (ternary, complex-block, implicit-conversion)#199rlorenzo wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughFour files across test suites and services are refactored to use ternary expressions and LINQ pipelines. Test error handling now validates object types before ChangesCode simplification refactoring
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Bundle ReportBundle size has no change ✅ |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #199 +/- ##
==========================================
- Coverage 43.02% 43.02% -0.01%
==========================================
Files 881 881
Lines 51436 51432 -4
Branches 4812 4807 -5
==========================================
- Hits 22131 22127 -4
Misses 28779 28779
Partials 526 526
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@web/Areas/Effort/Services/MeritMultiYearService.cs`:
- Around line 868-875: The code builds the responses list using
Enumerable.Repeat with n1..n5 but doesn't validate those counts; negative counts
will throw ArgumentOutOfRangeException. Before calling Enumerable.Repeat (the
block that constructs responses), clamp or sanitize the n1, n2, n3, n4, n5
values to a non-negative integer (e.g., Math.Max(0, nX) or a small helper
NormalizeCount) and then use those sanitized variables when creating responses
so Enumerable.Repeat(...) never receives a negative count.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 079a90be-124e-4667-b457-197ab51abdda
📒 Files selected for processing (6)
VueApp/src/Effort/__tests__/course-import-dialog.test.tsweb/Areas/ClinicalScheduler/Controllers/RotationsController.csweb/Areas/Effort/Services/EffortAuditService.csweb/Areas/Effort/Services/MeritMultiYearService.csweb/Areas/RAPS/Services/UinformService.csweb/Areas/Students/Services/GradYearClassLevel.cs
e9d677a to
9a6e6c1
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Pull request overview
This PR performs a small CodeQL style cleanup across backend C# and frontend test code without changing the intended application behavior.
Changes:
- Rewrites median response list construction using LINQ while handling negative counts safely.
- Converts simple conditional assignments to ternary expressions.
- Narrows test-side
unknownerror checks before accessingError.message.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
web/Areas/Effort/Services/MeritMultiYearService.cs |
Refactors median response list construction with Enumerable.Repeat/Concat. |
web/Areas/Effort/Services/EffortAuditService.cs |
Collapses conditional audit course query selection into a ternary assignment. |
web/Areas/ClinicalScheduler/Controllers/RotationsController.cs |
Simplifies service-based rotation loading with a ternary assignment. |
VueApp/src/Effort/__tests__/course-import-dialog.test.ts |
Adds explicit object narrowing before instanceof Error checks in tests. |
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
|
@bsedwards On TEST. Mainly cosmetic style changes reported by CodeQL. |
Summary
Final sweep of CodeQL style alerts that earlier PRs left as wontfix:
course-import-dialog.test.ts:72,96- narrow the union check by combiningtypeof === 'object'withinstanceof Error, then explicitas Errorcast on the truthy branch.MeritMultiYearService.CalculateMedian- five for-loops appending to a List collapsed into chainedEnumerable.Repeat(...).Concat(...).GradYearClassLevel.cs:63- case-4 if-else assignmentRotationsController.cs:63-serviceId.HasValue ? GetRotationsByServiceAsync : GetRotationsAsyncUinformService.cs:247-response.IsSuccessStatusCode ? Deserialize : new ErrorResponseEffortAuditService.cs:605- termCode-keyed IQueryable selectionuseless-tostringfix onGradYearClassLevel.cs:57,60,69(no-op vs PR CodeQL 12: chore: style sweep for remaining CodeQL alerts #198 which has the same change).Context
Thirteenth in the
CodeQL N:cleanup series.Test plan
npm run test:backend- 1946 tests passing