fix(codeql): Fix CodeQL issues#330
Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 43 minutes and 50 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThree files updated: test display name and method name corrected for spelling accuracy, new test case added for virtual properties with private getters, and virtual-member detection logic refactored to use pattern matching instead of direct member access. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 1 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/Objectivity.AutoFixture.XUnit2.Core.Tests/SpecimenBuilders/IgnoreVirtualMembersSpecimenBuilderTests.cs (1)
153-154: Consider asserting the getter is actually non-public to keep the test meaningful.
VirtualPropertyWithPrivateGetterrelies on the compiler honoringprivate get;so thatGetGetMethod()(public-only) returnsnull. If someone later changes the accessor, this test would silently start exercising the public-getter path instead. An explicit guard (e.g.,Assert.Null(typeof(FakeObject).GetProperty(...)!.GetGetMethod())inside the Arrange block) would lock the intent.Also minor: the
CA1044suppression justification says "null getter scenario," but the property is not write-only (it has a private getter), so the justification text is slightly misleading.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Objectivity.AutoFixture.XUnit2.Core.Tests/SpecimenBuilders/IgnoreVirtualMembersSpecimenBuilderTests.cs` around lines 153 - 154, Add an explicit guard assertion in the test Arrange block to ensure the getter is non-public by asserting that typeof(FakeObject).GetProperty("VirtualPropertyWithPrivateGetter")!.GetGetMethod() returns null, so the test fails fast if the accessor is changed; also update the CA1044 suppression Justification from "Required to test null getter scenario." to accurately reflect a private-getter scenario (e.g., "Required to test private-getter scenario.").
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@src/Objectivity.AutoFixture.XUnit2.Core.Tests/SpecimenBuilders/IgnoreVirtualMembersSpecimenBuilderTests.cs`:
- Around line 153-154: Add an explicit guard assertion in the test Arrange block
to ensure the getter is non-public by asserting that
typeof(FakeObject).GetProperty("VirtualPropertyWithPrivateGetter")!.GetGetMethod()
returns null, so the test fails fast if the accessor is changed; also update the
CA1044 suppression Justification from "Required to test null getter scenario."
to accurately reflect a private-getter scenario (e.g., "Required to test
private-getter scenario.").
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 1ce720d1-7349-42a8-bbee-2446acbd1f33
📒 Files selected for processing (3)
src/Objectivity.AutoFixture.XUnit2.Core.Tests/Requests/ValuesRequestTests.cssrc/Objectivity.AutoFixture.XUnit2.Core.Tests/SpecimenBuilders/IgnoreVirtualMembersSpecimenBuilderTests.cssrc/Objectivity.AutoFixture.XUnit2.Core/SpecimenBuilders/IgnoreVirtualMembersSpecimenBuilder.cs
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #330 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 39 39
Lines 419 419
Branches 53 53
=========================================
Hits 419 419
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Qodana Community for .NETAnalyzed project: It seems all right 👌 No new problems were found according to the checks applied View the detailed Qodana reportTo be able to view the detailed Qodana report, you can either:
To get - name: 'Qodana Scan'
uses: JetBrains/qodana-action@v2025.3.2
with:
upload-result: trueContact Qodana teamContact us at qodana-support@jetbrains.com
|
Summary
Fix CodeQL issues:
IgnoreVirtualMembersSpecimenBuilderChecklist
type(scope): description)dotnet build src/Objectivity.AutoFixture.XUnit2.AutoMock.slnpasses with no warningsdotnet test src/Objectivity.AutoFixture.XUnit2.AutoMock.slnpasses on all framework slices[SuppressMessage]without a justification comment// TODO:comments added — open a GitHub issue insteadSummary by CodeRabbit
Tests
Bug Fixes