SonarSource/sonar-dotnet

New Rule T0030: Move the field initializer on the same line.

Opened this issue · 0 comments

Coding style:

Inferred from properties:

When using an arrow property or an arrow method, the => token must be on the same line as the declaration. Regarding the expression body:

  • for properties: it should be on the same line as the property declaration. It should be on the following line only when it is too long and would trigger S103.
private int name = "Lorem"; // Compliant
private int values[] =  // Compliant
    [
    ];
public List<int> list = 
    new()  // Noncompliant
    {
    }
public List<int> list =  new()  // Compliant
    {
    }

private int name = 
    "Ipsum"; // Noncompliant