csharpier
csharpier copied to clipboard
CSharpier is an opinionated code formatter for c#.
```c# ref Behavior behavior = ref (this.returnOrThrow == null) ? ref this.callback : ref this.afterReturnCallback; // vs (with added __ to get it to the same length Behavior behavior =...
This output was printing all the time. Lets put it behind a option and clean it up. ``` total time: 225ms Total files: 1 Failed syntax tree validation: 0 Threw...
Currently CoalesceAssignementExpressions break this way in a variable declaration ```c# var method = _convertToEnum ??= typeof(BindConverter).GetMethod( nameof(ConvertToEnum), BindingFlags.NonPublic | BindingFlags.Static ); ``` Should we break after the operator? It would...
```c# // currently formats like private static readonly string[] _defaultSources = new string[] { "https://api.nuget.org/v3/index.json" }; // but if it can fit onto two lines like this, that would be...
This line is just long enough that it breaks like so ```c# public void AddValidator( Castle.Components.DictionaryAdapter.IDictionaryValidator validator ) { } ``` Previously it was like this ```c# public void AddValidator(Castle.Components.DictionaryAdapter.IDictionaryValidator...
```c# // used to be internal static readonly Lazy SmtpDefaults = new Lazy(ReadSmtpDefaults); // now is internal static readonly Lazy SmtpDefaults = new Lazy< IDictionary >(ReadSmtpDefaults);
```c# var task = Task.Factory.StartNew(async () => { return await new WebClient().DownloadStringTaskAsync( "http://example.com" ); }); // should probably be var task = Task.Factory.StartNew(async () => { return await new WebClient().DownloadStringTaskAsync(...
Currently when a constructor has short parameters, but a long base, it formats like so ```c# public WithParameters(string parameter) : base( longParameter____________________________________________________________________________ ) { WithBody(); } ``` I think we...
Currently csharpier formats this way ```c# if ( string.Equals( node.BoundAttribute.TypeName, ModelExpressionTypeName, StringComparison.Ordinal ) || ( node.IsIndexerNameMatch && string.Equals( node.BoundAttribute.IndexerTypeName, ModelExpressionTypeName, StringComparison.Ordinal ) ) ) { } ``` Prettier formats the...
The comments in this code are short enough that it shouldn't break ```c# Debug.Assert( existingTemplate.Length >= sizeof(uint) /* MAGIC_HEADER */ + sizeof(Guid) /* keyId */ ); // should be Debug.Assert(...