-
Notifications
You must be signed in to change notification settings - Fork 280
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
Code Cleanup | null != x
=> x != null
#2751
Conversation
Your AI Analysis is not really correct afaik, technically they are different:
for an example, to see the call difference. That's why the whole Having said that, the only way I know of, how Personally I'd recommend normalizing Note: The same applies to the previously merged PR with |
@Tornhoof I won't disagree too hard - you're right that it is possible someone wrote a
It all likelihood, the last case is probably 90+% of the cases in the code, and in that case I would indeed advocate for using |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2751 +/- ##
==========================================
+ Coverage 71.74% 71.76% +0.01%
==========================================
Files 308 308
Lines 62301 62314 +13
==========================================
+ Hits 44700 44717 +17
+ Misses 17601 17597 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
I think, we can also have RoslynAnalyzer to enforce some coding standards to prevent this in future as this cannot be done in editorconfig file. |
commit ac1012a Author: dauinsight <[email protected]> Date: Fri Aug 16 13:22:55 2024 -0700 Hotfix v3.1.6 Release notes (dotnet#2767) commit 619fa74 Author: Javad Rahnama <[email protected]> Date: Thu Aug 15 13:48:15 2024 -0700 Fix | Fix the issue with Socke.Connect in managed SNI (dotnet#2777) commit d3658ed Author: DavoudEshtehari <[email protected]> Date: Wed Aug 14 17:18:51 2024 -0700 Update SNI version to 6.0.0-preview1.24226.4 (dotnet#2772) commit 7216e84 Author: Benjamin Russell <[email protected]> Date: Fri Aug 9 12:40:30 2024 -0500 `null != x` => `x != null` (dotnet#2751) commit 6fbbb78 Author: Benjamin Russell <[email protected]> Date: Sat Aug 3 11:47:53 2024 -0500 Code Cleanup | `null == x` to `x == null` (dotnet#2749) - With one approval and CI success, I think that's enough to move ahead on this one. * `null == x` to `x == null` * Update src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/TdsParser.cs Co-authored-by: David Engel <[email protected]> --------- Co-authored-by: David Engel <[email protected]> commit 6f177e3 Author: Aris Rellegue <[email protected]> Date: Tue Jul 30 19:52:38 2024 +0000 Fix | Fixed some Azure managed identity authentication unit test failures (dotnet#2652)
Description: In the second of a series of code cleanup PRs, this PR removes the Yoda conditions
null != x
and replaces it withx != null
. This is the most requested PR from my second PR, so hopefully it will be appreciated :)As with the previous PR, I have opted to only flip the operands and not replace the condition with
x is not null
. This is to make the changes as safe as possible, sinceis not null
will potentially behave differently than!= null
.AI Analysis: I ran the patch file through a large language model to assess safety
but uhhhh, it didn't like me.and it seems to approve of this PRTesting: projecs build andif CI goes through we should be good