Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct null handling when using a custom comparer #2489

Merged
merged 15 commits into from
Dec 29, 2023
Merged

Correct null handling when using a custom comparer #2489

merged 15 commits into from
Dec 29, 2023

Conversation

MartinDemberger
Copy link
Contributor

Currently a custom comparer surpresses the BeEquivalent compare with a nullable struct property against a expected null value.
This change doesn't use the custom comparer for a struct with a expected null.

#2480

IMPORTANT

  • If the PR touches the public API, the changes have been approved in a separate issue with the "api-approved" label.
  • The code complies with the Coding Guidelines for C#.
  • The changes are covered by unit tests which follow the Arrange-Act-Assert syntax and the naming conventions such as is used in these tests.
  • If the PR adds a feature or fixes a bug, please update the release notes with a functional description that explains what the change means to consumers of this library, which are published on the website.
  • If the PR changes the public API the changes needs to be included by running AcceptApiChanges.ps1 or AcceptApiChanges.sh.
  • If the PR affects the documentation, please include your changes in this pull request so the documentation will appear on the website.
    • Please also run ./build.sh --target spellcheck or .\build.ps1 --target spellcheck before pushing and check the good outcome

Copy link

github-actions bot commented Nov 27, 2023

Qodana for .NET

It seems all right 👌

No new problems were found according to the checks applied

💡 Qodana analysis was run in the pull request mode: only the changed files were checked

View the detailed Qodana report

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

  1. Register at Qodana Cloud and configure the action
  2. Use GitHub Code Scanning with Qodana
  3. Host Qodana report at GitHub Pages
  4. Inspect and use qodana.sarif.json (see the Qodana SARIF format for details)

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@v2023.2.8
        with:
          upload-result: true
Contact Qodana team

Contact us at qodana-support@jetbrains.com

@MartinDemberger MartinDemberger marked this pull request as ready for review November 27, 2023 21:40
docs/_pages/releases.md Outdated Show resolved Hide resolved
@MartinDemberger
Copy link
Contributor Author

Can anyone help me? I don't understand the error message in Qodana.

@IT-VBFK
Copy link
Contributor

IT-VBFK commented Dec 1, 2023

Try rebase at the current develop and push again

From my understanding, a qodana report without a summary (like here) happens, if the default branch (here develop) moves forward while the PR is not onto this branch.

Copy link

github-actions bot commented Dec 1, 2023

Qodana for .NET

4 new problems were found

Inspection name Severity Problems
Possible 'System.NullReferenceException' 🔶 Warning 2
Auto-property accessor is never used (private accessibility) 🔶 Warning 2

💡 Qodana analysis was run in the pull request mode: only the changed files were checked
☁️ View the detailed Qodana report

Contact Qodana team

Contact us at qodana-support@jetbrains.com

@dennisdoomen dennisdoomen changed the title Correct null handling when having a nullable struct propertywith a custom comparer Correct null handling when having a nullable struct property with a custom comparer Dec 9, 2023
@coveralls
Copy link

coveralls commented Dec 9, 2023

Pull Request Test Coverage Report for Build 7357619396

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • 4 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.001%) to 97.464%

Files with Coverage Reduction New Missed Lines %
Src/FluentAssertions/Execution/DefaultAssertionStrategy.cs 4 20.0%
Totals Coverage Status
Change from base Build 7260721275: 0.001%
Covered Lines: 11746
Relevant Lines: 11930

💛 - Coveralls

@dennisdoomen dennisdoomen requested a review from jnyrup December 11, 2023 17:44
@jnyrup jnyrup linked an issue Dec 12, 2023 that may be closed by this pull request
docs/_pages/releases.md Outdated Show resolved Hide resolved
Co-authored-by: Jonas Nyrup <jnyrup@users.noreply.github.com>
MartinDemberger and others added 2 commits December 15, 2023 14:12
Co-authored-by: ITaluone <44049228+ITaluone@users.noreply.github.com>
Copy link

github-actions bot commented Dec 15, 2023

Qodana for .NET

58 new problems were found

Inspection name Severity Problems
Redundant type declaration body 🔶 Warning 51
Redundant using directive 🔶 Warning 7

💡 Qodana analysis was run in the pull request mode: only the changed files were checked
☁️ View the detailed Qodana report

Contact Qodana team

Contact us at qodana-support@jetbrains.com

@ITaluone
Copy link
Contributor

A few qodana issues are left :)

@jnyrup jnyrup changed the title Correct null handling when having a nullable struct property with a custom comparer Correct null handling when using a custom comparer Dec 29, 2023
@jnyrup jnyrup merged commit 666c348 into fluentassertions:develop Dec 29, 2023
3 of 5 checks passed
@jnyrup jnyrup mentioned this pull request Dec 29, 2023
7 tasks
@jnyrup jnyrup added the bug label Jan 6, 2024
jnyrup added a commit to jnyrup/fluentassertions that referenced this pull request Jul 14, 2024
…2489)

* Correct null handling when having a nullable struct propertywith a custom comparer.

fluentassertions#2480

* Release notes added

* typo corrected

* Removed the check for only value types and added the null check for the expectation. Also added more tests for all cases.

* typo corrected

* Warnings solved

* Added a comment for the changed code

* Comment cleaned

* Update docs/_pages/releases.md

Co-authored-by: Jonas Nyrup <jnyrup@users.noreply.github.com>

* Typo corrected

Co-authored-by: ITaluone <44049228+ITaluone@users.noreply.github.com>

* Corrected Qodana issues

* cleanups

---------

Co-authored-by: Martin Demberger <martin.demberger@root-nine.de>
Co-authored-by: Jonas Nyrup <jnyrup@users.noreply.github.com>
Co-authored-by: ITaluone <44049228+ITaluone@users.noreply.github.com>
Co-authored-by: Jonas Nyrup <jnyrup@gmail.com>
jnyrup added a commit to jnyrup/fluentassertions that referenced this pull request Jul 14, 2024
…2489)

* Correct null handling when having a nullable struct propertywith a custom comparer.

fluentassertions#2480

* Release notes added

* typo corrected

* Removed the check for only value types and added the null check for the expectation. Also added more tests for all cases.

* typo corrected

* Warnings solved

* Added a comment for the changed code

* Comment cleaned

* Update docs/_pages/releases.md

Co-authored-by: Jonas Nyrup <jnyrup@users.noreply.github.com>

* Typo corrected

Co-authored-by: ITaluone <44049228+ITaluone@users.noreply.github.com>

* Corrected Qodana issues

* cleanups

---------

Co-authored-by: Martin Demberger <martin.demberger@root-nine.de>
Co-authored-by: Jonas Nyrup <jnyrup@users.noreply.github.com>
Co-authored-by: ITaluone <44049228+ITaluone@users.noreply.github.com>
Co-authored-by: Jonas Nyrup <jnyrup@gmail.com>
jnyrup added a commit to jnyrup/fluentassertions that referenced this pull request Jul 14, 2024
…2489)

* Correct null handling when having a nullable struct propertywith a custom comparer.

fluentassertions#2480

* Release notes added

* typo corrected

* Removed the check for only value types and added the null check for the expectation. Also added more tests for all cases.

* typo corrected

* Warnings solved

* Added a comment for the changed code

* Comment cleaned

* Update docs/_pages/releases.md

Co-authored-by: Jonas Nyrup <jnyrup@users.noreply.github.com>

* Typo corrected

Co-authored-by: ITaluone <44049228+ITaluone@users.noreply.github.com>

* Corrected Qodana issues

* cleanups

---------

Co-authored-by: Martin Demberger <martin.demberger@root-nine.de>
Co-authored-by: Jonas Nyrup <jnyrup@users.noreply.github.com>
Co-authored-by: ITaluone <44049228+ITaluone@users.noreply.github.com>
Co-authored-by: Jonas Nyrup <jnyrup@gmail.com>
jnyrup added a commit to jnyrup/fluentassertions that referenced this pull request Aug 18, 2024
…2489)

* Correct null handling when having a nullable struct propertywith a custom comparer.

fluentassertions#2480

* Release notes added

* typo corrected

* Removed the check for only value types and added the null check for the expectation. Also added more tests for all cases.

* typo corrected

* Warnings solved

* Added a comment for the changed code

* Comment cleaned

* Update docs/_pages/releases.md

Co-authored-by: Jonas Nyrup <jnyrup@users.noreply.github.com>

* Typo corrected

Co-authored-by: ITaluone <44049228+ITaluone@users.noreply.github.com>

* Corrected Qodana issues

* cleanups

---------

Co-authored-by: Martin Demberger <martin.demberger@root-nine.de>
Co-authored-by: Jonas Nyrup <jnyrup@users.noreply.github.com>
Co-authored-by: ITaluone <44049228+ITaluone@users.noreply.github.com>
Co-authored-by: Jonas Nyrup <jnyrup@gmail.com>
jnyrup added a commit to jnyrup/fluentassertions that referenced this pull request Aug 18, 2024
…2489)

* Correct null handling when having a nullable struct propertywith a custom comparer.

fluentassertions#2480

* Release notes added

* typo corrected

* Removed the check for only value types and added the null check for the expectation. Also added more tests for all cases.

* typo corrected

* Warnings solved

* Added a comment for the changed code

* Comment cleaned

* Update docs/_pages/releases.md

Co-authored-by: Jonas Nyrup <jnyrup@users.noreply.github.com>

* Typo corrected

Co-authored-by: ITaluone <44049228+ITaluone@users.noreply.github.com>

* Corrected Qodana issues

* cleanups

---------

Co-authored-by: Martin Demberger <martin.demberger@root-nine.de>
Co-authored-by: Jonas Nyrup <jnyrup@users.noreply.github.com>
Co-authored-by: ITaluone <44049228+ITaluone@users.noreply.github.com>
Co-authored-by: Jonas Nyrup <jnyrup@gmail.com>
jnyrup added a commit to jnyrup/fluentassertions that referenced this pull request Aug 24, 2024
…2489)

* Correct null handling when having a nullable struct propertywith a custom comparer.

fluentassertions#2480

* Release notes added

* typo corrected

* Removed the check for only value types and added the null check for the expectation. Also added more tests for all cases.

* typo corrected

* Warnings solved

* Added a comment for the changed code

* Comment cleaned

* Update docs/_pages/releases.md

Co-authored-by: Jonas Nyrup <jnyrup@users.noreply.github.com>

* Typo corrected

Co-authored-by: ITaluone <44049228+ITaluone@users.noreply.github.com>

* Corrected Qodana issues

* cleanups

---------

Co-authored-by: Martin Demberger <martin.demberger@root-nine.de>
Co-authored-by: Jonas Nyrup <jnyrup@users.noreply.github.com>
Co-authored-by: ITaluone <44049228+ITaluone@users.noreply.github.com>
Co-authored-by: Jonas Nyrup <jnyrup@gmail.com>
jnyrup added a commit that referenced this pull request Sep 9, 2024
* Correct null handling when having a nullable struct propertywith a custom comparer.

#2480

* Release notes added

* typo corrected

* Removed the check for only value types and added the null check for the expectation. Also added more tests for all cases.

* typo corrected

* Warnings solved

* Added a comment for the changed code

* Comment cleaned

* Update docs/_pages/releases.md

Co-authored-by: Jonas Nyrup <jnyrup@users.noreply.github.com>

* Typo corrected

Co-authored-by: ITaluone <44049228+ITaluone@users.noreply.github.com>

* Corrected Qodana issues

* cleanups

---------

Co-authored-by: Martin Demberger <martin.demberger@root-nine.de>
Co-authored-by: Jonas Nyrup <jnyrup@users.noreply.github.com>
Co-authored-by: ITaluone <44049228+ITaluone@users.noreply.github.com>
Co-authored-by: Jonas Nyrup <jnyrup@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BeEquivalent failed with nullably struct property and EqualityComparer
7 participants