parched / csharpier

CSharpier is an opinionated code formatter for c#.

Home Page:https://csharpier.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CSharpier

CSharpier is an opinionated code formatter for c#. It uses Roslyn to parse your code and re-prints it using its own rules. The printing process was ported from prettier but has evolved over time.

CSharpier provides a few basic options that affect formatting and has no plans to add more. It follows the Option Philosophy of prettier.

Quick Start

Install CSharpier globally using the following command.

dotnet tool install csharpier -g

Then format the contents of a directory and its children with the following command.

dotnet csharpier .

CSharpier can also format on save in your editor or as a pre-commit hook. Then you can ensure code was formatted with a CI/CD tool.


Read the documentation

Try it out


Before

public class ClassName {
    public void CallMethod() { 
        this.LongUglyMethod("1234567890", "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
    }
}

After

public class ClassName
{
    public void CallMethod()
    {
        this.LongUglyMethod(
            "1234567890",
            "abcdefghijklmnopqrstuvwxyz",
            "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
        );
    }
}

Contributing

See Development Readme

Join Us Discord

About

CSharpier is an opinionated code formatter for c#.

https://csharpier.com

License:MIT License


Languages

Language:C# 92.7%Language:TypeScript 2.8%Language:Java 2.5%Language:PowerShell 0.7%Language:JavaScript 0.5%Language:CSS 0.4%Language:HTML 0.2%Language:SCSS 0.1%Language:Dockerfile 0.1%