Skip to content

CSharpier-config is a non opinionated code formatter for C# based on csharpier

License

Notifications You must be signed in to change notification settings

pisolofin/csharpier-editorconfig

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

csharpier-config

Validate Pull Request

NuGet Version

This is as non opinionated version of csharpier version 0.29.2 tool created to add EditorConfig file style guide, allowing users to define and apply custom styling options.

All documentation that you find about csharpier is also valid for csharpier-config, you have only to change command like All documentation you find about CSharpier is also valid for CSharpier-Config. You only need to adjust the commands accordingly.

  • dotnet csharpier -> dotnet csharpier-config
  • dotnet-csharpier -> dotnet-csharpier-config

Extra rules than CSharpier

CSharp formatting

#  CSharp formatting rules:
[*.cs]
csharp_new_line_before_open_brace = methods, properties, control_blocks, types
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true

For more information, please refer to the documentation

From

public class ClassName
{
    private int _property = 0;
    public int Property {
        get
            {
            // Some logic
            return _property;
        }
        set {
            // Some logic
            _property = value;
        }
    }

    public void MethodName()
    {
        var anonymous = delegate(int param)
        {
            // Do something
            return param;
        };

        int localFunction(int paramB) {
            int def = paramB;
            return def;
        }

        var condition = true;
        if (condition)
        {
            // Do something
        }    else
        {
            // Do other
        }

        var localObject = new
        {
            Property = 1,
        };
    }
}

To

public class ClassName
{
    private int _property = 0;
    public int Property
    {
        get {
            // Some logic
            return _property;
        }
        set {
            // Some logic
            _property = value;
        }
    }

    public void MethodName()
    {
        var anonymous = delegate(int param) {
            // Do something
            return param;
        };

        int localFunction(int paramB) {
            int def = paramB;
            return def;
        }

        var condition = true;
        if (condition)
        {
            // Do something
        }
        else
        {
            // Do other
        }

        var localObject = new {
            Property = 1,
        };
    }
}

About

CSharpier-config is a non opinionated code formatter for C# based on csharpier

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 90.6%
  • TypeScript 4.0%
  • Java 3.2%
  • PowerShell 0.8%
  • JavaScript 0.5%
  • CSS 0.4%
  • Other 0.5%