Skip to content

Add analyzer "Invalid argument null check" (RCS1256)#888

Merged
josefpihrt merged 33 commits intomainfrom
feature/unnecessary-null-check
Nov 19, 2022
Merged

Add analyzer "Invalid argument null check" (RCS1256)#888
josefpihrt merged 33 commits intomainfrom
feature/unnecessary-null-check

Conversation

@josefpihrt
Copy link
Collaborator

No description provided.

# Conflicts:
#	src/Analyzers/CSharp/Analysis/ValidateArgumentsCorrectlyAnalyzer.cs
# Conflicts:
#	src/Analyzers.CodeFixes/CSharp/CodeFixes/IfStatementCodeFixProvider.cs
#	src/Analyzers.CodeFixes/CSharp/CodeFixes/ValidateArgumentsCorrectlyCodeFixProvider.cs
#	src/Analyzers/CSharp/Analysis/ValidateArgumentsCorrectlyAnalyzer.cs
#	src/Analyzers/CSharp/DiagnosticIdentifiers.Generated.cs
#	src/Analyzers/CSharp/DiagnosticRules.Generated.cs
#	src/Common/ArgumentNullCheckAnalysis.cs
This reverts commit 9139d7d.

# Conflicts:
#	src/Analyzers/Analyzers.xml
@josefpihrt josefpihrt changed the title Add analyzer "Unnecessary null check" Add analyzer "Invalid argument null check" Nov 19, 2022
@josefpihrt josefpihrt changed the title Add analyzer "Invalid argument null check" Add analyzer "Invalid argument null check" (RCS1256) Nov 19, 2022
@josefpihrt josefpihrt merged commit abe91e6 into main Nov 19, 2022
@josefpihrt josefpihrt deleted the feature/unnecessary-null-check branch November 19, 2022 18:16
@BenjaminBrienen
Copy link
Contributor

I wish you provided a description so that I could understand the reasoning for this lint, and how to fix the issue.

@josefpihrt
Copy link
Collaborator Author

@BenjaminBrienen Description can be found here: https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1256.md.

I can provide more detailed info if necessary.

@BenjaminBrienen
Copy link
Contributor

BenjaminBrienen commented Feb 2, 2023

Yes, please. I had a parameter that was a nullable interface type (IMyInterface<Generic>?), and when I did a null check on it, I got this lint. When I removed the null check, I got a different lint warning me that the value of the parameter may be null (when I try to use it as an argument).

@josefpihrt
Copy link
Collaborator Author

Could you please create new issue and provide a code sample there? Thanks.

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