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

Output from Roslyn Source Generators should be ignored by default #3299

Closed
clairernovotny opened this issue Feb 9, 2021 · 1 comment
Closed
Labels

Comments

@clairernovotny
Copy link

clairernovotny commented Feb 9, 2021

With Source Generators becoming more popular now that Roslyn has direct support for it, StyleCop should be able to directly detect and ignore them without each generated file needing to specify // <auto-generated /> in it. That's putting the burden on the source generator author to know about and get right and hurts users of these analyzers who are "caught in the middle."

@sharwell
Copy link
Member

sharwell commented Feb 9, 2021

StyleCop Analyzers automatically ignores everything that Roslyn says is considered generated code. This should by filed on https://github.com/dotnet/roslyn. I would recommend source generator authors include the // <auto-generated /> comment in the generated code (or name the generated file ending with .g.cs), which is the same requirement that appeared for source generators prior to the ISourceGenerator interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants