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

INTL0001 when using records #231

Open
Keboo opened this issue May 31, 2022 · 0 comments
Open

INTL0001 when using records #231

Keboo opened this issue May 31, 2022 · 0 comments
Labels
analyzer Items here affect the analyzers C# coding guidelines Content related to the C# coding guidelines proposal Items flagged with this are up for discussion to be included in the IntelliTect coding standards

Comments

@Keboo
Copy link
Member

Keboo commented May 31, 2022

With the introduction of positional records it has become more valuable to apply attributes inline. This is especially true when dealing with serialization.
Consider the following which triggers INTL0001 (Properties must be on their own line)

public record MyDto([property:JsonPropertyName("my_Value")] string Value);

The work around is to simply do as the analyzer suggests and put it on its own line:

public record MyDto(
    [property:JsonPropertyName("my_Value")] 
    string Value);

However, I would posit that this is less readable that the original.

We should revisit the attribute guidelines with these new use-cases in mind.

@Keboo Keboo added proposal Items flagged with this are up for discussion to be included in the IntelliTect coding standards analyzer Items here affect the analyzers C# coding guidelines Content related to the C# coding guidelines labels May 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer Items here affect the analyzers C# coding guidelines Content related to the C# coding guidelines proposal Items flagged with this are up for discussion to be included in the IntelliTect coding standards
Projects
None yet
Development

No branches or pull requests

1 participant