-
Notifications
You must be signed in to change notification settings - Fork 868
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
refactor: Rewrite parameter null checks using helper methods #9024
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #9024 +/- ##
==========================================
+ Coverage 76.87% 77.55% +0.68%
==========================================
Files 591 591
Lines 24758 24578 -180
==========================================
+ Hits 19033 19062 +29
+ Misses 5725 5516 -209
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many of these NULL checks could be replaced by nullable reference types in the future. Nevertheless, this is still a great enhancement to the existing codebase we have!
src/Docfx.Build.Common/ModelAttributeHandlers/Handlers/MarkdownContentHandler.cs
Show resolved
Hide resolved
* fix: Add empty filePath check (based on previous doc comment) #9024 (comment) * chore: Fix additional CA1510 rules * chore: fix redundant names (IDE0020) Commented on #9024 (comment) * fix: Fix wrong behavior changes introduced by previous PR Commented on #9024 (comment) * fix: Change thrown exception type. Commented on #9024 (comment)
…9024) refactor: rewrite guard statements to newer syntax
* fix: Add empty filePath check (based on previous doc comment) dotnet#9024 (comment) * chore: Fix additional CA1510 rules * chore: fix redundant names (IDE0020) Commented on dotnet#9024 (comment) * fix: Fix wrong behavior changes introduced by previous PR Commented on dotnet#9024 (comment) * fix: Change thrown exception type. Commented on dotnet#9024 (comment)
What's included in this PR
Rewrite parameter null check with following helper methods.
ArgumentNullException.ThrowIfNull
(Require .NET 6 or later)ArgumentNullException.ThrowIfNullOrEmpty
(Require .NET 7)These change will not affects application behaviors.
It's intended following purpose.
Related Roslyn Analyzer rules
CA1510: Use ArgumentNullException throw helper
https://github.com/dotnet/roslyn-analyzers/blob/main/src/NetAnalyzers/Microsoft.CodeAnalysis.NetAnalyzers.md#ca1510-use-argumentnullexception-throw-helper