Closed rjarrattmsft closed 3 years ago
Hi @rjarrattmsft,
could you please provide a list of the code analysis error/warning codes that you think should be suppressed?
Thanks Stefan
Actually I just realised they are StyleCop errors, like SA1633, SA1200, SA1629, SA1101 (and a few others).
Thanks for getting back to me so quickly. To be honest, I consider this a minor issue of roslyn/source-generators/IDEs: source generated files shouldn't be subject to code styles of the user at all. I could now go ahead and add a bunch of suppressions into the relevant files, but it will probably never be a complete list. What do you think?
There used to be a way to mark files as auto generated that suppressed all analysis, although I am not sure if that is always respected. I would be happy just for all analysis to be suppressed on generated code.
I wouldn't call it a minor issue though because once you start to ignore some warnings then you can't see the warnings that actually do matter and you can't fail the build because of warnings, which I think is very important generally (but not in my specific instance).
I consider this a minor issue as it only affects optional code analysis which can be configured to ignore certain files.
Anyway: I have updated the code generator to include a // <auto-generated />
comment at the top of each auto-generated file. Hopefully that resolves your issue. Please let me know whether you still get those warnings with version 2.5.9.
Sorry, didn't mean to close this yet...
That seems to have fixed it. Thanks for the super-quick response!
If I enable full code analysis on the solution that references this package I am flooded with code analysis errors on files like GroupAttribute.cs. I don't really get why I need the grouping thing anyway, but given that it is there it would be good to make sure it does not generate code analysis errors.