IntelliTect / IntelliTect/CodingGuidelines

INTL0001 when using records

Ouverte
#231 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
analyzer C# coding guidelines proposal
Langage dominant
C#
Étoiles
12
Forks
16
Merge moyen
2 min
PR mergées (30 j)
7

Description

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)

```C#
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:
```C#
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.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.