Skip to content

Contribution proposal and discussion #1636

@AndreiShenets

Description

@AndreiShenets

Hi,

I would like to contribute to the project and add a few things that I miss.

The first thing I would like to add a setting to RCS0053. The setting will force to put closing bracket on a new line.
It might affect RCS0027 or requires a new formatter.

Examples:

diagnostic

void M(
    object x,
    object y, object z)
{
}

fix

void M(
    object x,
    object y, 
    object z
)
{
}

diagnostic

if (x &&
    y &&
    z)
{
}

fix

if (
    x
    && y
    && z
)
{
}

The second thing I would like to add is a diagnostic and fix to make code structurally honest. What structural honesty means described here

Examples:

diagnostic

Dictionary<string, NewItemType> itemDictionary = state.Where(item => item.Name != null)
    .Select(item => new NewItemType()
    {
        Name = item.Name
    })
    .ToDictionary(item => 
    {
        string key = item.Name;
        ...
        return key;
    },
    item => item,StringComparer.Ordinal);

fix

Dictionary<string, NewItemType> itemDictionary = 
    state
        .Where(item => item.Name != null)
        .Select(
            item => 
                new NewItemType()
                {
                    Name = item.Name
                }
        )
        .ToDictionary(
            item => 
            {
                string key = item.Name;
                ...
                return key;
            },
            item => item,
            StringComparer.Ordinal
        );

Please advise.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions