Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/belav/csharpier
CSharpier is an opinionated code formatter for c#.
https://github.com/belav/csharpier
csharp dotnet formatter prettier
Last synced: about 1 month ago
JSON representation
CSharpier is an opinionated code formatter for c#.
- Host: GitHub
- URL: https://github.com/belav/csharpier
- Owner: belav
- License: mit
- Created: 2020-11-17T21:52:19.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-09-27T18:57:24.000Z (about 2 months ago)
- Last Synced: 2024-09-30T16:43:16.736Z (about 1 month ago)
- Topics: csharp, dotnet, formatter, prettier
- Language: C#
- Homepage: https://csharpier.com
- Size: 6.28 MB
- Stars: 1,339
- Watchers: 10
- Forks: 91
- Open Issues: 129
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
![CSharpier](./banner.svg)
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](https://github.com/prettier/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](https://prettier.io/docs/en/option-philosophy.html) of prettier.
### Quick Start
Install CSharpier globally using the following command.
```bash
dotnet tool install csharpier -g
```
Then format the contents of a directory and its children with the following command.
```bash
dotnet csharpier .
```CSharpier can also format [on save in your editor](https://csharpier.com/docs/Editors) or as a [pre-commit hook](https://csharpier.com/docs/Pre-commit). Then you can ensure code was formatted with a [CI/CD tool](https://csharpier.com/docs/ContinuousIntegration).
---
[Read the documentation](https://csharpier.com)
[Try it out](https://playground.csharpier.com)---
### Before
```c#
public class ClassName {
public void CallMethod() {
this.LongUglyMethod("1234567890", "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
}
}
```### After
```c#
public class ClassName
{
public void CallMethod()
{
this.LongUglyMethod(
"1234567890",
"abcdefghijklmnopqrstuvwxyz",
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
);
}
}
```## Contributing
See [Development Readme](CONTRIBUTING.md)Join Us [![Discord](https://img.shields.io/badge/Discord-chat?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/HfAKGEZQcX)
## Sponsors
Special thanks to the [.NET on AWS Open Source Software Fund](https://github.com/aws/dotnet-foss) for sponsoring the ongoing development CSharpier.
[](https://github.com/aws/dotnet-foss)