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

Emit CA1305 when a nullable value type does not specify IFormatProvider #6730

Merged
merged 2 commits into from
Jul 5, 2023

Conversation

CollinAlpert
Copy link
Contributor

This PR only focuses on nullable value types which represent numbers. If I should extend this for more value types, please let me know.
I also noticed that the fixer was not implemented yet. Are there requirements for a fixer?

Fixes #6586

@CollinAlpert CollinAlpert requested a review from a team as a code owner July 2, 2023 15:53
@codecov
Copy link

codecov bot commented Jul 2, 2023

Codecov Report

Merging #6730 (868f3f5) into main (24890c9) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6730   +/-   ##
=======================================
  Coverage   96.32%   96.32%           
=======================================
  Files        1389     1389           
  Lines      325104   325128   +24     
  Branches    10721    10722    +1     
=======================================
+ Hits       313159   313189   +30     
+ Misses       9234     9228    -6     
  Partials     2711     2711           

@mavasani
Copy link
Contributor

mavasani commented Jul 5, 2023

This PR only focuses on nullable value types which represent numbers. If I should extend this for more value types, please let me know.

I think this is good.

@mavasani
Copy link
Contributor

mavasani commented Jul 5, 2023

I also noticed that the fixer was not implemented yet. Are there requirements for a fixer?

Yes, indeed - #413 (comment)

@mavasani mavasani merged commit 301c768 into dotnet:main Jul 5, 2023
11 checks passed
@CollinAlpert CollinAlpert deleted the issue_6586 branch July 5, 2023 07:08
@jnm2
Copy link
Contributor

jnm2 commented Apr 4, 2024

This PR only focuses on nullable value types which represent numbers. If I should extend this for more value types, please let me know.

Does this mean ToString on DateTime? is still not being analyzed? Can we have it automatically apply whenever it would apply on the non-nullable version of the type?

@CollinAlpert
Copy link
Contributor Author

@jnm2 I've created #7306 to fix this.

@jnm2
Copy link
Contributor

jnm2 commented May 9, 2024

@CollinAlpert You're awesome!

@CollinAlpert
Copy link
Contributor Author

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.

CA1305 Specify IFormatProvider misses nullable value types
3 participants