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

Generated files should include /// <auto-generated/> preamble #273

Closed
AArnott opened this issue Nov 7, 2023 · 6 comments
Closed

Generated files should include /// <auto-generated/> preamble #273

AArnott opened this issue Nov 7, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@AArnott
Copy link

AArnott commented Nov 7, 2023

Describe the Bug

When these source generators are used in a project with Stylecop.Analyzers, diagnostics are produced that can block adoption.

Steps to Reproduce

Install StyleCop.Analyzers into a project that uses the ThisAssembly.Resource package.
Build.

Expected Behavior

No warnings

Actual behavior

Warnings such as this:

ThisAssembly.Resource\ThisAssembly.ResourcesGenerator\ThisAssembly.Resources.EmbeddedResource.cs(8,28,8,35): warning SA1400: Element 'baseDir' should declare an access modifier (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1400.md)

Version Info

1.4.1

Additional Info

By adding /// <auto-generated /> to the top of every emitted file, other analyzers are warned away from reporting frivolous diagnostics.

@AArnott AArnott added the bug Something isn't working label Nov 7, 2023
@svause-stryker
Copy link

@AArnott just curious if you figured out a way around this. I have tried every technique I could find to exclude the file with no luck.

@AArnott
Copy link
Author

AArnott commented Jan 25, 2024

No. I don't use this package anyway. I can't remember how I came across it initially. Probably some user asked for my help to solve it and I realized it was a problem that needed to be solved here.

@viceroypenguin
Copy link
Contributor

just curious if you figured out a way around this. I have tried every technique I could find to exclude the file with no luck.

@svause-stryker I had to remove this package from my apps and reimplement.

There are analyzers you can turn off, but they have to be done in the csproj instead of the .editorconfig. Besides, the analyzers are correct - string comparison should be done using case sensitive comparer, and I/O should not be done in a source generator.

This won't be easily addressed by consumers until kzu reviews and merges #278 and #280, which I don't expect to happen anytime soon.

@svause-stryker
Copy link

Yup I just ripped it out and went a different way. Wasn't ultra important for what I needed it for.

@kzu
Copy link
Member

kzu commented Jan 29, 2024

Looking into this. Sorry it slipped my inbox :(

@kzu
Copy link
Member

kzu commented Jan 30, 2024

Merged and released! https://github.com/devlooped/ThisAssembly/releases/tag/v1.4.2

@kzu kzu closed this as completed Jan 30, 2024
@devlooped devlooped locked and limited conversation to collaborators Sep 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants