SteveDunn / Vogen

A semi-opinionated library which is a source generator and a code analyser. It Source generates Value Objects
Apache License 2.0
887 stars 46 forks source link

Analyzer to suggest using `readonly struct` #603

Closed SteveDunn closed 3 months ago

SteveDunn commented 6 months ago

It is preferable for users to use a readonly struct rather than just a struct. Implement an analyzer to suggest this, and possibly a codefix.

This was a result of the following thread.

          @SteveDunn A suggestion that came to my mind while reading this: maybe enhance the analyzers to promote the usage of `readonly struct` instead of a `struct` as an _Information_ or _Warning_ message?

Originally posted by @Herdo in https://github.com/SteveDunn/Vogen/issues/52#issuecomment-1230748733

danigutsch commented 3 months ago

Hi @SteveDunn . I wanted to take this issue, if that's alright

SteveDunn commented 3 months ago

That would be great, thank you!

danigutsch commented 3 months ago

Should record structs trigger the analyzer?

SteveDunn commented 3 months ago

Hi, yes I think so. The benefits apply to them too. 👍

On Sun, 18 Aug 2024, 16:09 danigutsch, @.***> wrote:

Should record structs trigger the analyzer?

— Reply to this email directly, view it on GitHub https://github.com/SteveDunn/Vogen/issues/603#issuecomment-2295294082, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACAJ6DHH6M7AJHAIAW7QRDZSC2JFAVCNFSM6AAAAABIJXJXGOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJVGI4TIMBYGI . You are receiving this because you were mentioned.Message ID: @.***>