Skip to content

fix: virtual member check in IgnoreVirtualMembersSpecimenBuilder#333

Merged
piotrzajac merged 1 commit intomasterfrom
piotrzajac-patch-1
Apr 19, 2026
Merged

fix: virtual member check in IgnoreVirtualMembersSpecimenBuilder#333
piotrzajac merged 1 commit intomasterfrom
piotrzajac-patch-1

Conversation

@piotrzajac
Copy link
Copy Markdown
Collaborator

@piotrzajac piotrzajac commented Apr 19, 2026

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Improved virtual member detection in specimen generation to properly identify virtual properties regardless of getter accessibility levels.

Checklist

  • Commit messages follow Conventional Commits (type(scope): description)
  • dotnet build src/Objectivity.AutoFixture.XUnit2.AutoMock.sln passes with no warnings
  • dotnet test src/Objectivity.AutoFixture.XUnit2.AutoMock.sln passes on all framework slices
  • Code coverage remains at least at the level prior the change (verified by Codecov)
  • Mutation score remains at least at the level prior the change (verified by Stryker)
  • New tests follow the GIVEN/WHEN/THEN naming convention and AAA structure (see AGENTS.md)
  • No new [SuppressMessage] without a justification comment
  • No // TODO: comments added — open a GitHub issue instead
  • No new dependencies introduced that are incompatible with the MIT license (verified by FOSSA)

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 19, 2026

📝 Walkthrough

Walkthrough

Updated virtual-member detection in IgnoreVirtualMembersSpecimenBuilder.Create by removing the explicit nonPublic: false parameter when calling PropertyInfo.GetGetMethod(). This allows detection of both public and non-public property getters when determining whether to return OmitSpecimen.

Changes

Cohort / File(s) Summary
Virtual Member Detection
src/Objectivity.AutoFixture.XUnit2.Core/SpecimenBuilders/IgnoreVirtualMembersSpecimenBuilder.cs
Modified Create method to call PropertyInfo.GetGetMethod() without explicitly filtering to public getters, broadening virtual-getter detection scope.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested labels

enhancement

🚥 Pre-merge checks | ✅ 1 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning PR description is incomplete. The Summary section is empty with only a placeholder comment, and no issue is linked. The checklist shows all items checked but provides no description of the problem being fixed. Add a description explaining the issue and why the virtual member detection behavior needed to change. Include a link to the relevant GitHub issue and a PR label.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: fixing a virtual member check in a specific component, directly aligned with the code modification to IgnoreVirtualMembersSpecimenBuilder.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch piotrzajac-patch-1

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

codecov-commenter commented Apr 19, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (1677cd4) to head (928f5a7).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #333   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           39        39           
  Lines          419       419           
  Branches        53        53           
=========================================
  Hits           419       419           
Flag Coverage Δ
unittests 99.76% <100.00%> (ø)

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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@src/Objectivity.AutoFixture.XUnit2.Core/SpecimenBuilders/IgnoreVirtualMembersSpecimenBuilder.cs`:
- Line 26: The replacement of pi.GetGetMethod(nonPublic: false) with
pi.GetGetMethod() is a behavior-preserving no-op; clarify intent in the PR or
code: if the goal is purely refactor/simplification, add a short comment in
IgnoreVirtualMembersSpecimenBuilder (around the Create method / the
virtual-property check) stating this is intentionally equivalent and update the
PR description; if the goal was instead to also omit virtual properties with
non-public getters, change the check to pi.GetGetMethod(nonPublic: true) in
IgnoreVirtualMembersSpecimenBuilder and update the related test
(GivenVirtualPropertyInfoWithPrivateGetter / VirtualPropertyWithPrivateGetter
expectation) to expect OmitSpecimen.
🪄 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: CHILL

Plan: Pro

Run ID: c9ecf3fa-1ba2-4ce1-b234-1a2c33f050cc

📥 Commits

Reviewing files that changed from the base of the PR and between 1677cd4 and 928f5a7.

📒 Files selected for processing (1)
  • src/Objectivity.AutoFixture.XUnit2.Core/SpecimenBuilders/IgnoreVirtualMembersSpecimenBuilder.cs

@github-actions
Copy link
Copy Markdown

Qodana Community for .NET

Analyzed project: src/

It seems all right 👌

No new problems were found according to the checks applied

View the detailed Qodana report

To be able to view the detailed Qodana report, you can either:

To get *.log files or any other Qodana artifacts, run the action with upload-result option set to true,
so that the action will upload the files as the job artifacts:

      - name: 'Qodana Scan'
        uses: JetBrains/qodana-action@v2025.3.2
        with:
          upload-result: true
Contact Qodana team

Contact us at qodana-support@jetbrains.com

@piotrzajac piotrzajac merged commit 8611052 into master Apr 19, 2026
22 checks passed
@piotrzajac piotrzajac deleted the piotrzajac-patch-1 branch April 19, 2026 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants