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

Resolve CA1863 by using emitted methods #3264

Closed
8 tasks done
JustArchi opened this issue Aug 4, 2024 · 1 comment
Closed
8 tasks done

Resolve CA1863 by using emitted methods #3264

JustArchi opened this issue Aug 4, 2024 · 1 comment
Labels
✨ Enhancement Issues marked with this label indicate further enhancements to the program, such as new features. 🟢 Low priority Issues marked with this label are actively being worked on if nothing serious is on the list. 🙏 Wishlist Issues marked with this label are wishlisted. We'd like to make them happen but they're not crucial.

Comments

@JustArchi
Copy link
Member

JustArchi commented Aug 4, 2024

Checklist

Enhancement purpose

ASF ignored CA1863 for a while now due to dotnet/roslyn-analyzers#7032. We should aim to resolve it now that we have an option.

Solution

I did the initial part of using the new source generator in 7a8e209 - EmitFormatMethods="true" can be used for telling source generator to emit format options, afterwards, we need to do a lot of manual labour to replace every single occurance of string.Format() that we have today with the new method.

Why currently available solutions are not sufficient?

Existing string.Format() calls is a lot of boilerplate code, CA1863 is just a cherry on top. Now that there is a better solution to deal with this, we should prefer it.

Can you help us with this enhancement idea?

Yes, I can code the solution myself and send a pull request

Additional info

There are cases where plugins use ASF localization in part to avoid more work on their end - we'll need to #pragma warning disable those places before EmitFormatMethods="true" generates public methods.

dotnet/roslyn-analyzers#7360

@JustArchi JustArchi added ✨ Enhancement Issues marked with this label indicate further enhancements to the program, such as new features. 👀 Evaluation Issues marked with this label are currently being evaluated if they're going to be considered. 🙏 Wishlist Issues marked with this label are wishlisted. We'd like to make them happen but they're not crucial. 🟢 Low priority Issues marked with this label are actively being worked on if nothing serious is on the list. and removed 👀 Evaluation Issues marked with this label are currently being evaluated if they're going to be considered. labels Aug 4, 2024
@JustArchi
Copy link
Member Author

JustArchi commented Aug 6, 2024

For plugin creators there is only one visible breaking change, ASF no longer silences CA1863 warning by default: afa602f

If you need to silence it, you can consider adding it in your own plugin project: Directory.Build.props or .csproj:

	<PropertyGroup>
		<NoWarn>$(NoWarn),CA1863</NoWarn>
	</PropertyGroup>

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
✨ Enhancement Issues marked with this label indicate further enhancements to the program, such as new features. 🟢 Low priority Issues marked with this label are actively being worked on if nothing serious is on the list. 🙏 Wishlist Issues marked with this label are wishlisted. We'd like to make them happen but they're not crucial.
Projects
None yet
Development

No branches or pull requests

1 participant