SteveDunn / Vogen

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

Analyzer to suggest using `readonly struct` #603

Closed SteveDunn closed 1 month ago

SteveDunn commented 4 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 1 month ago

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

SteveDunn commented 1 month ago

That would be great, thank you!

danigutsch commented 1 month ago

Should record structs trigger the analyzer?

SteveDunn commented 1 month 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: @.***>