Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update dependency csharpier to 0.30.3 #67

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Jun 25, 2023

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
csharpier 0.24.2 -> 0.30.3 age adoption passing confidence

Release Notes

belav/csharpier (csharpier)

v0.30.3

Compare Source

What's Changed

CSharpier.MsBuild doesn't fail the github action anymore #​1357

The changes for 1311 caused CSharpier.MsBuild to not report unformatted files as errors on linux.

Thanks go to @​PetSerAl for the fix

v0.30.2

Compare Source

What's Changed
Collection expression inside a dictionary adds unexpected new line #​1390
// input & expected output
Dictionary<string, string[]> dictionary = new()
{
    {
        "Key",
        [
            "SomeValue__________________________________________",
            "SomeValue__________________________________________",
        ]
    },
};

// 0.30.1
Dictionary<string, string[]> dictionary = new()
{
    {
        "Key",

        [
            "SomeValue__________________________________________",
            "SomeValue__________________________________________",
        ]
    },
};
Failed syntax tree validation reported when trailing comma added before a trailing comment #​1388

With the following code, CSharpier will add a trailing comma before the trailing comment.
CSharpier's syntax tree validation was incorrectly reporting this as a failure.

// input
var someObject = new SomeObject()
{
    Property1 = 1,
    Property2 = 2 // Trailing Comment
};

// output
var someObject = new SomeObject()
{
    Property1 = 1,
    Property2 = 2, // Trailing Comment
};

v0.30.1

Compare Source

What's Changed

Revert tool command back to dotnet-csharpier, it was supposed to be changed to csharpier for 1.0.0

v0.30.0

Compare Source

Breaking Changes

The CSharpier dotnet tool no longer supports net6 & net7.

What's Changed

Support C# 13 & dotnet 9. #​1318

CSharpier now supports dotnet 9 along with formatting all C# 13 language features.

Inconsistent Formatting for new() Operator Compared to Explicit Object Constructors #​1364

Implicit and explicit object initialization with constructors was not formatted consistently

// input & expected output
SomeObject someObject = new(
    someLongParameter___________________,
    someLongParameter___________________
)
{
    Property = longValue_______________________________________________________________________,
};

SomeObject someObject = new SomeObject(
    someLongParameter___________________,
    someLongParameter___________________
)
{
    Property = longValue_______________________________________________________________________,
};

// 0.29.2
SomeObject someObject =
    new(someLongParameter___________________, someLongParameter___________________)
    {
        Property = longValue_______________________________________________________________________,
    };

SomeObject someObject = new SomeObject(
    someLongParameter___________________,
    someLongParameter___________________
)
{
    Property = longValue_______________________________________________________________________,
};
Adds additional space before each member access in verbatim interpolated multiline string #​1358

When an interpolated verbatim string contained line breaks, the code within the interpolations would contain extra spaces.

// input & expected output
var someStringWithLineBreakAndLongValue =
    $@&#8203;"
{someValue.GetValue().Name} someLongText________________________________________________________________";

// 0.29.2
var someStringWithLineBreakAndLongValue =
    $@&#8203;"
        {someValue .GetValue() .Name} someLongText________________________________________________________________";
Inserting trailing comma with trailing comment causes problems. #​1354

CSharpier would insert a trailing comma after a trailing comment and format the end result poorly.

// input
var someObject = new SomeObject()
{
    Property1 = 1,
    Property2 = 2 // Trailing Comment
};

// 0.29.2
var someObject = new SomeObject()
{
    Property1 = 1,
    Property2 =
        2 // Trailing Comment
    ,
};

// 0.30.0
var someObject = new SomeObject()
{
    Property1 = 1,
    Property2 = 2, // Trailing Comment
};
Double line break before collection expression in field #​1351

CSharpier was inserting an extra line break on a long field name followed by a collection expression to initialize it.

// input & expected output
class ClassName
{
    public SomeType[] LongName____________________________________________________________________________ =
    [
        someLongValue___________________________________________________,
        someLongValue___________________________________________________,
    ];
}

// 0.29.2
class ClassName
{
    public SomeType[] LongName____________________________________________________________________________ =

        [
            someLongValue___________________________________________________,
            someLongValue___________________________________________________,
        ];
}

Full Changelog: belav/csharpier@0.29.2...0.30.0

v0.29.2

Compare Source

What's Changed

Comments don't follow tabs indent style #​1343

Prior to 0.29.2 CSharpier was converting any tabs within the block of a multiline comment to spaces.

public void SomeFunction()
{
	/*
	The following line is an example with an indent:
		This line is indented by one tab. (prior to 0.29.2 this would end up as a tab followed by 4 spaces)
	*/
	/*
	The following line is an example with an indent:
		This line is indented by 4 spaces but will be converted to 1 tab (prior to 0.29.2 this would end up as a tab followed by 4 spaces)
	*/
	/*
	The following line is an example with an indent:
	   This line is indented by 3 spaces but will be left as 3 spaces
	*/
}
csharpier-ignore-start now supported in object initializers #​1342
// input & expected output
return new SomeClass
{
    // csharpier-ignore-start
    SomeProperty =     someValue,
    SomeProperty2 =     someValue
    // csharpier-ignore-end
};

// 0.29.1
return new SomeClass
{
    // csharpier-ignore-start
    SomeProperty = someValue,
    SomeProperty2 = someValue
    // csharpier-ignore-end
};
Fixed extra new line between cast and collection expression. #​1334
// input & expected output
CallMethod(
    (string[])
        [
            longerValue_____________________________________________,
            longerValue_____________________________________________,
        ]
);

// 0.29.1
CallMethod(
    (string[])

        [
            longerValue_____________________________________________,
            longerValue_____________________________________________,
        ]
);
Support custom extensions in .editorconfig #​1273

As of 0.29.0 CSharpier could format non-standard file extensions, but only if configured in the csharpierrc file. This is now supported with an .editorconfig

[*.cst]
csharpier_formatter = csharp
indent_style = space
indent_size = 2
max_line_length = 80

Full Changelog: belav/csharpier@0.29.1...0.29.2

v0.29.1

Compare Source

What's Changed

Sorting of usings with underscore differs from Visual Studio #​1327

CSharpier now sorts _ to the bottom of usings.

using SomeCompany.MWord;
using SomeCompany.ZWord;
using SomeCompany._Word;
Process cannot access the file "....net8.0\any\server.log" while running multiple extensions. #​1324

CSharpier Server now uses a log file name based on the port that it is starting on to avoid concurrency issues trying to access the same log file

Full Changelog: belav/csharpier@0.29.0...0.29.1

v0.29.0

Compare Source

Breaking Changes

The formatting command will now exit with an error code of 1 if one of the target files cannot be compiled #​1131

Prior to 0.29.0 if csharpier encountered a file that could not be compiled it would treat it as a warning and exit with a code of 0.
As of 0.29.0 a file that cannot be compiled is now treated as an error and csharpier will exit with code 1

What's Changed

Enforce trailing commas in object and collection initializer #​668

CSharpier will now add trailing commas automatically where appropriate. It will collapse to a single line and remove the trailing comma in cases where everything fits on one line.

// input
public enum SomeEnum
{
    Value1,
    Value2
}

string[] someArray = new string[]
{
    someLongValue_____________________________________________,
    someLongValue_____________________________________________
};

string[] someArray = new string[]
{
    someValue,
    someValue,
};

// 0.29.0
public enum SomeEnum
{
    Value1,
    Value2,
}

string[] someArray = new string[]
{
    someLongValue_____________________________________________,
    someLongValue_____________________________________________,
}

string[] someArray = new string[] { someValue, someValue };

Many thanks go to @​dawust for the contribution.

Support for formatting custom file extensions #​1220

Prior to 0.29.0 csharpier would only format files with an extension of .cs or .csx. It is now possible to configure csharpier to format other files extensions, and to specify configuration options per file extension.
See https://csharpier.com/docs/Configuration#configuration-overrides for more details.

Invalid blank line being added with lambda returning collection expression #​1306
// input & expected output
CallMethod(_ =>
    [
        LongValue________________________________________________,
        LongValue________________________________________________,
    ]
);

// 0.28.2
CallMethod(_ =>

    [
        LongValue________________________________________________,
        LongValue________________________________________________,
    ]
);
Switch expressions do not break consistently with other lambdas #​1282

Prior to 0.29.0 csharpier would break before the => in switch expression arms. It now breaks after them to be consistent with other lambda expressions.

// 0.28.2
return someEnum switch
{
    Value1 => someOtherValue,
    Value2
    or Value3
        => someValue________________________________________________________________________,
    Value4
        => someValue_____________________________________________________________________________,
};

// 0.29.0
return someEnum switch
{
    Value1 => someOtherValue,
    Value2 or Value3 =>
        someValue________________________________________________________________________,
    Value4 =>
        someValue_____________________________________________________________________________,
};
Formatting of empty collection initializer for huge type #​1268

Empty collection expression initializers formatting was including a break plus indentation resulting in poor formatting.

// 0.28.2
var someObject = new List<(
    int Field1__________________________________,
    int Field2__________________________________
)>
{
    };

// 0.29.0
var someObject = new List<(
    int Field1__________________________________,
    int Field2__________________________________
)>
{ };

Thanks go to @​Rudomitori for the contribution

Switch expression single line broken when preceded by comment #​1262

Improved formatting for short expression arms that have a leading comment.

// 0.28.2
return someValue switch
{
    // comment
    Some.One
        => 1,
    Some.Two => 2,
};

return someValue switch
{
    Some.One => 1,
    // comment
    Some.Two
        => 2,
};

// 0.29.0
return someValue switch
{
    // comment
    Some.One => 1,
    Some.Two => 2,
};

return someValue switch
{
    Some.One => 1,
    // comment
    Some.Two => 2,
};
Incorrect formatting of ternary expression with a comment after an interpolated string #​1258

Fixed bug with comments on a ternary expression that resulted in invalid code.

// input & expected output
public string TrailingComment = someCondition
    ? $"empty" // trailing comment
    : someString;

// 0.28.2
public string TrailingComment = someCondition ? $"empty" // trailing comment : someString;
Formatting for indexer parameters should mostly be the same as for method parameters. #​1255

Improved formatting of indexed properties that contained attributes.

// input & expected output
public class ClassName
{
    public string this[
        [SomeAttribute] int a________________________________,
        [SomeAttribute] int b________________________________
    ] => someValue;
}

// 0.28.2
public class ClassName
{
    public string this[[SomeAttribute] int a________________________________, [SomeAttribute]
        int b________________________________] => someValue;
}
Do not overwrite CSharpier_Check when already set. #​1314

Fixed a bug with csharpier.msbuild where it would overwrite the CSharpier_Check value in some cases.

Thanks go to @​PetSerAl for the contribution

The CLI has contradictory message about directoryOrFile being required #​1296

The help text for the cli has been improved to better indicate when directoryOrFile is required.

Thanks go to @​marcinjahn for the contribution

Fullwidth unicode characters should be accounted for in print width #​260

CSharpier now considers full width unicode characters such as to be 2 spaces wide when determining how to format code.

Full Changelog: belav/csharpier@0.28.2...0.29.0

v0.28.2

Compare Source

What's Changed

Pipe to dotnet csharpier fails when subdirectory is inaccessible #​1240

When running the following CSharpier would look for config files in subdirectories of the pwd. This could lead to exceptions if some of those directories were inaccessible.

echo "namespace Foo { public class Bar { public string Baz {get;set;}}}" | dotnet csharpier

Thanks go to @​jamesfoster for reporting the issue.

Full Changelog: belav/csharpier@0.28.1...0.28.2

v0.28.1

Compare Source

What's Changed

Third party .editorconfig leading to: Error Failure parsing editorconfig files #​1227

When CSharpier encountered an invalid .editorconfig file, it would throw an exception and not format files. These files could appear in 3rd party code (for example within node_modules). CSharpier now ignores invalid lines in .editorconfigs

Thanks go to @​K0Te for reporting the issue

Full Changelog: belav/csharpier@0.28.0...0.28.1

v0.28.0

Compare Source

What's Changed

Fix dedented method call if there is a long chain #​1154

In some cases of method chains, the first invocation would end up dedented.

// 0.27.3
o.Property.CallMethod(
    someParameter_____________________________,
    someParameter_____________________________
)
    .CallMethod()
    .CallMethod();

// 0.28.0
o.Property.CallMethod(
        someParameter_____________________________,
        someParameter_____________________________
    )
    .CallMethod()
    .CallMethod();
Extra newline in switch case statement with curly braces [#​1192][https://github.com/belav/csharpier/issues/1192](https://redirect.github.com/belav/csharpier/issues/1192)2

If a case statement started with a block it would get an extra new line

// 0.27.3
switch (someValue)
{
    case 0:
    {
        // dedented because the only statement is a block
        break;
    }

    case 1:

        {
            // indented because there are two statements, a block then a break
        }
        break;
}

// 0.28.0
// 0.27.3
switch (someValue)
{
    case 0:
    {
        // dedented because the only statement is a block
        break;
    }

    case 1:
        {
            // indented because there are two statements, a block then a break
        }
        break;
}

Thanks go to @​emberTrev for reporting the bug.

Handle more editorconfig glob patterns. #​1214

The editorconfig parsing was not handling glob patterns that contained braces.

v0.27.3

Compare Source

[*.cs]
indent_size = 4
tab_width = 4

v0.27.2

Compare Source

What's Changed

Orphan variable since 0.27.1 #​1153

0.27.1 introduced the following formatting regression, resulting in short variables being orphaned on a line

// 0.27.1
o
    .Property.CallMethod(
        someParameter_____________________________,
        someParameter_____________________________
    )
    .CallMethod()
    .CallMethod();

// 0.27.2
o.Property.CallMethod(
    someParameter_____________________________,
    someParameter_____________________________
)
    .CallMethod()
    .CallMethod();

Thanks go to @​aurnoi1 for reporting the bug

Better support for CSharp Script #​1141

Version 0.27.1 parsed .csx files as if they were C#, so it could only format simple ones. It now parses them as CSharpScript files so it can format them properly.

Thanks go to @​Eptagone for reporting the bug.

Full Changelog: belav/csharpier@0.27.1...0.27.2

v0.27.1

Compare Source

What's Changed

Support for CSharp Script #​1141

Previously CSharpier would only format files matching *.cs which prevented it from formatting C# script files. It now formats *.{cs,csx}

Thanks go to @​Eptagone for the suggestion

Weird formatting of invocation chain #​1130

Invocation chains that started with an identifier <= 4 characters were causing a strange break in the first method call. There were other edge cases cleaned up while working on the fix.

// 0.27.0
var something________________________________________ = x.SomeProperty.CallMethod(
    longParameter_____________,
    longParameter_____________
)
    .CallMethod();

// 0.27.1
var something________________________________________ = x
    .SomeProperty.CallMethod(longParameter_____________, longParameter_____________)
    .CallMethod();
// 0.27.0
var someLongValue_________________ = memberAccessExpression[
    elementAccessExpression
].theMember______________________________();

// 0.27.1
var someLongValue_________________ = memberAccessExpression[elementAccessExpression]
    .theMember______________________________();
// 0.27.0
someThing_______________________
    ?.Property
    .CallMethod__________________()
    .CallMethod__________________();

// 0.27.1
someThing_______________________
    ?.Property.CallMethod__________________()
    .CallMethod__________________();

Thanks go to @​Rudomitori for reporting the issue

"Failed syntax tree validation" for raw string literals #​1129

When an interpolated raw string changed indentation due to CSharpier formatting, CSharpier was incorrectly reporting it as failing syntax tree validation.

// input
CallMethod(CallMethod(
   $$"""
   SomeString
   """, someValue));

// output
CallMethod(
    CallMethod(
        $$"""
        SomeString
        """,
        someValue
    )
);

Thanks go to @​Rudomitori for reporting the issue

Adding experimental support using HTTP for the extensions to communicate with CSharpier #​1137

The GRPC support added in 0.27.0 increased the size of the nuget package significantly and has been removed.

CSharpier can now start a kestrel web server to support communication with the extensions once they are all updated.

Full Changelog: belav/csharpier@0.27.0...0.27.1

v0.27.0

Compare Source

What's Changed

Improve formatting of lambda expressions #​1066

Many thanks go to @​Rudomitori for contributing a number of improvements to the formatting of lambda expressions.

Some examples of the improvements.

// input
var affectedRows = await _dbContext.SomeEntities
    .ExecuteUpdateAsync(
        x => 
            x.SetProperty(x => x.Name, x => command.NewName)
                .SetProperty(x => x.Title, x => command.NewTItle)
                .SetProperty(x => x.Count, x => x.Command.NewCount)
    );

// 0.27.0
var affectedRows = await _dbContext.SomeEntities
    .ExecuteUpdateAsync(x =>
        x.SetProperty(x => x.Name, x => command.NewName)
            .SetProperty(x => x.Title, x => command.NewTItle)
            .SetProperty(x => x.Count, x => x.Command.NewCount)
    );
// input
builder.Entity<IdentityUserToken<string>>(b =>
{
    b.HasKey(
        l =>
            new
            {
                l.UserId,
                l.LoginProvider,
                l.Name
            }
    );
    b.ToTable("AspNetUserTokens");
});

// 0.27.0
builder.Entity<IdentityUserToken<string>>(b =>
{
    b.HasKey(l => new
    {
        l.UserId,
        l.LoginProvider,
        l.Name
    });
    b.ToTable("AspNetUserTokens");
});
// input
table.PrimaryKey(
    "PK_AspNetUserTokens",
    x =>
        new
        {
            x.UserId,
            x.LoginProvider,
            x.Name
        }
);

// 0.27.0
table.PrimaryKey(
    "PK_AspNetUserTokens",
    x => new
    {
        x.UserId,
        x.LoginProvider,
        x.Name
    }
);
readonly ref is changed to ref readonly causing error CS9190 #​1123

CSharpier was sorting modifiers in all places they occurred. Resulting the following change that led to code that would not compile.

// input
void Method(ref readonly int someParameter) { }

// 0.26.7
void Method(readonly ref int someParameter) { }

// 0.27.0
void Method(ref readonly int someParameter) { }

Thanks go to @​aurnoi1 for reporting the bug

#if at the end of collection expression gets eaten #​1119

When a collection expression contained a directive immediately before the closing bracket, that directive was not included in the output.

// input
int[] someArray =
[
    1

#if DEBUG
    ,
    2

#endif
];

// 0.26.7
int[] someArray = [1];

// 0.27.0
int[] someArray =
[
    1

#if DEBUG
    ,
    2

#endif
];

Thanks go to @​Meowtimer for reporting the bug

CSharpier.MsBuild - Set Fallback for dotnetcore3.1 or net5.0 applications #​1111

CSharpier.MsBuild made an assumption that the project being built would be built using net6-net8 and failed when the project was built with earlier versions of dotnet.

It now falls back to trying to use net8

Thanks go to @​samtrion for the contribution

Allow empty/blank lines in object initializers #​1110

Large object initializers now retain single empty lines between initializers.

vvar someObject = new SomeObject
{
    NoLineAllowedAboveHere = 1,

    ThisLineIsOkay = 2,

    // comment
    AndThisLine = 3,
    DontAddLines = 4,
};

Thanks go to @​Qtax for the suggestion

Add option to allow formatting auto generated files. [#​1055][https://github.com/belav/csharpier/issues/1055](https://redirect.github.com/belav/csharpier/issues/1055)5

By default CSharpier will not format files that were generated by the SDK, or files that begin with <autogenerated /> comments.

Passing the option --include-generated to the CLI will cause those files to be formatted.

Format raw string literals indentation #​975

CSharpier now adjusts the indentation of raw string literals if the end delimiter is indented.

// input
var someString = """
            Indent based on previous line
            """;

var doNotIndentIfEndDelimiterIsAtZero = """
Keep This
    Where It
Is
""";

// 0.26.7
var someString = """
            Indent based on previous line
            """;

var doNotIndentIfEndDelimiterIsAtZero = """
Keep This
    Where It
Is
""";

// 0.27.0
var someString = """
    Indent based on previous line
    """;

var doNotIndentIfEndDelimiterIsAtZero = """
Keep This
    Where It
Is
""";

Thanks go to @​jods4 for reporting the issue

Incorrect indentation on a multi-line statement split by comments [#​968][https://github.com/belav/csharpier/issues/968](https://redirect.github.com/belav/csharpier/issues/968)8

CSharpier was not properly indenting an invocation chain when it was being split by comments.

// input
var someValue =
    // Some Comment
    CallSomeMethod()
        // Another Comment
        .CallSomeMethod();

// 0.26.7
var someValue =
// Some Comment
CallSomeMethod()
    // Another Comment
    .CallSomeMethod();

// 0.27.0
var someValue =
    // Some Comment
    CallSomeMethod()
        // Another Comment
        .CallSomeMethod();

Thanks go to @​tyrrrz for reporting the issue

Adding experimental support for GRPC for the extensions to communicate with CSharpier #​944

Currently the extensions for CSharpier send data to a running instance of CSharpier by piping stdin/stdout back and forth. This approach has proved problematic and hard to extend.

As of 0.27.0, CSharpier can run a GRPC server to allow communication with the extensions once they are all updated.

Full Changelog: belav/csharpier@0.26.7...0.27.0

v0.26.7

Compare Source

What's Changed

Keep Field.Method() on the same line when breaking long method chain #​1010

0.26.0 introduced changes that broke long invocation chains on fields/properties as well as methods. That change has been reverted after community feedback.

// 0.26.0
var loggerConfiguration = new LoggerConfiguration()
    .Enrich
    .FromLogContext()
    .Enrich
    .WithProperty("key", "value")
    .Enrich
    .WithProperty("key", "value")
    .Enrich
    .WithProperty("key", "value")
    .Enrich
    .WithProperty("key", "value")
    .WriteTo
    .Console(outputTemplate: "template");

// 0.26.7
var loggerConfiguration = new LoggerConfiguration()
    .Enrich.FromLogContext()
    .Enrich.WithProperty("key", "value")
    .Enrich.WithProperty("key", "value")
    .Enrich.WithProperty("key", "value")
    .Enrich.WithProperty("key", "value")
    .WriteTo.Console(outputTemplate: "template");

Full Changelog: belav/csharpier@0.26.6...0.26.7

v0.26.6

Compare Source

What's Changed

CSharpier incorrectly reports problems with differing line endings as "The file did not end with a single newline"#​1067

If CSharpier was validating that a file was formatted, and that file contained only \n but CSharpier was configured to use \r\n, then it would report the problem as The file did not end with a single newline

CSharpier added support for reading line ending configuration from an .editorconfig which could contain end_of_line = crlf so some users were unknowingly configuring CSharpier to use \r\n

CSharpier now correctly reports the problem as The file contained different line endings than formatting it would result in.

Full Changelog: belav/csharpier@0.26.5...0.26.6

v0.26.5

Compare Source

What's Changed

0.26.4 sorts NSubstitute before Newtonsoft.Json #​1061

The using sorting in 0.26.4 was taking into account case.

// 0.26.4
using System;
using NSubstitute;
using Newtonsoft.Json;

// 0.26.5
using System;
using Newtonsoft.Json;
using NSubstitute;

Thanks go to @​loraderon for contributing the fix.

Extra newline added when using a collection expression with { get; } #​1063

A collection expression in a property initializer was including an extra new line.

// 0.26.4
public class ClassName
{
    public List<DayOfWeek> DaysOfWeek { get; } =

        [
            DayOfWeek.Sunday,
            // snip
            DayOfWeek.Saturday
        ];    
}

// 0.26.5
public class ClassName
{
    public List<DayOfWeek> DaysOfWeek { get; } =
        [
            DayOfWeek.Sunday,
            // snip
            DayOfWeek.Saturday
        ];    
}

Thanks go to @​SapiensAnatis for contributing the fix.

Comments at the end of a collection expression should be indented #​1059

When the close bracket on a collection expression had a leading comment, it had the same indentation as the bracket.

// 0.26.4
host.AddSection(
    name: "Kontakt Libraries (Third Party)",
    tags: Tags.SamplesUsed,
    tasks:
    [
    // TODO: Add any used third party instruments below as you discover them.
    ]
);

// 0.26.5
host.AddSection(
    name: "Kontakt Libraries (Third Party)",
    tags: Tags.SamplesUsed,
    tasks:
    [
        // TODO: Add any used third party instruments below as you discover them.
    ]
);

Thanks go to @​fgimian for reporting the problem

Full Changelog: belav/csharpier@0.26.4...0.26.5

v0.26.4

Compare Source

What's Changed

Spacing bugs related to C#12 collection expressions #​1049 #​1047

There were a number of cases where CSharpier was including extra blank lines, an extra space, or not formatting contents of collection expressions.

// 0.26.3
var a = new A { B =  [1, 2, 3] };

List<string> items = [// My item
    "Hello",];

items.AddRange(

    [
        LongValue________________________________________________,
        LongValue________________________________________________
    ]
);

items =  [];
items ??=  [];

class SomeClass
{
    public SomeValue SomeProperty =>

        [
            LongValue________________________________________________,
            LongValue________________________________________________
        ];

    public SomeValue Method() =>

        [
            LongValue________________________________________________,
            LongValue________________________________________________
        ];
}

// 0.26.4
var a = new A { B = [1, 2, 3] };

List<string> items =
[
    // My item
    "Hello",
];

items.AddRange(
    [
        LongValue________________________________________________,
        LongValue________________________________________________
    ]
);

items = [];
items ??= [];

class SomeClass
{
    public SomeValue SomeProperty =>
        [
            LongValue________________________________________________,
            LongValue________________________________________________
        ];

    public SomeValue Method() =>
        [
            LongValue________________________________________________,
            LongValue________________________________________________
        ];
}

Thanks go to @​fgimian and @​JoshWoodArup for reporting the issues

Usings sorting differs based on system culture #​1051

The sorting of Usings was done in a culture specific manner, resulting in unexpected behavior.
In Czech (cs-CZ) the ch is a "single letter" which is placed between h and i, which resulted in the following sorting behavior.

// 0.26.3
using Microsoft.ApplicationInsights.DataContracts;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.ApplicationInsights.Channel;

// 0.26.4
using Microsoft.ApplicationInsights.Channel;
using Microsoft.ApplicationInsights.DataContracts;
using Microsoft.ApplicationInsights.Extensibility;

Thanks go to @​davidkudera for the contribution

Full Changelog: belav/csharpier@0.26.3...0.26.4

v0.26.3

Compare Source

What's Changed

C#12 Collection expressions are prefixed with two spaces #​1009
// 0.26.0
List<int> ids =  [];

// 0.26.3
List<int> ids = [];

Thanks go to @​Jackenmen for reporting the problem.

CSharpier inserts extra spaces around the contents of collection expressions #​1002
// 0.26.0
List<int> ids = [ ];
List<int> ids = [ 1, 2, 3 ];

// 0.26.3
List<int> ids = [];
List<int> ids = [1, 2, 3];

Thanks go to @​golavr for reporting the problem.

Configuration files not respected for stdin #​1028

When piping a file to csharpier via stdin, CSharpier uses the working directory to locate any configuration files. This was broken with 0.26.0.

Thanks go to @​kikniknik for reporting the problem.

Modify CSharpier.MSBuild to use NETCoreSdkVersion to detect which sdk to use for running CSharpier #​1022 #​1027

Previously CSharpier.MSBuild was using targetFramework to determine which version of CSharpier to run. This was problematic when there were multiple target frameworks, or the project was targeting a superset such as net8.0-windows

It now makes use of NETCoreSdkVersion to determine which version of CSharpier to run.

Thanks go to @​Tyrrrz for the suggestion and to @​Cjewett for the contribution to make it work

CSharpierIgnore not respected when recursively finding .editorconfig

When looking for .editorconfig files, CSharpier looks for them recursively in the current directory. This logic was not taking into account any files or directories ignored by a .csharpierignore.

Thanks go to @​sebastieng84 for the contribution.

Optimize editorconfig lookups when piping files #​1039

CSharpier now only looks for an .editorconfig for the file being piped to CSharpier. Under normal usage it recursively looks for all possible .editorconfig files for the given directory.

Full Changelog: belav/csharpier@0.26.2...0.26.3

v0.26.2

Compare Source

What's Changed

CSharpier.MsBuild does not support DotNet 8 #​1012

When using CSharpier.MsBuild in a setting where the project targeted net8.0 and only the net8 sdk was installed, CSharpier.MsBuild would attempt to run the net7.0 version of csharpier which failed.

Thanks go to @​aditnryn for the fix

Global System using directives should be sorted first #​1003

Global using were not sorting System to the top, which was inconsistent with regular using.

// 0.26.1
global using ZWord;
global using AWord;
global using System.Web;
global using System;

// 0.26.2
global using System;
global using System.Web;
global using AWord;
global using ZWord;

Thanks go to @​vipentti for the fix

Full Changelog: belav/csharpier@0.26.1...0.26.2

v0.26.1

Compare Source

What's Changed

Editorconfig with duplicated sections was freezing IDE's #​989

CSharpier was unable to parse an .editorconfig file that contained duplicate sections and would crash. This would result in a hung IDE.

[*]
insert_final_newline = true

[*]
spelling_languages = en-us

Thanks go to @​echoix for helping track this down.

A .csharpierrc file anywhere above a file now takes priority over any .editorconfig #​987

Given the following setup

/src/.editorconfig
/src/ProjectName/.editorconfig
/src/.csharpierrc

Originally with 0.26.0, the /src/ProjectName/.editorconfig file would be used for determining the configuration options for a file within src/ProjectName. This resulted in the existing options within .csharpierrc being ignored.

With 0.26.1, if a .csharpierrc exists anywhere above a given file, it will be used to determine the configuration options.

Thanks go to @​parched for reporting the issue.

Full Changelog: belav/csharpier@0.26.0...0.26.1

v0.26.0

Compare Source

What's Changed

EditorConfig Support

CSharpier will now read configuration options from an .editorconfig. See https://csharpier.com/docs/Configuration for more details.

Net8 Support

CSharpier now supports the .net8 sdk. It still supports net6 and net7.

Sorting of using directives #​661

CSharpier now sorts using statements. It follows the following rules

global using System.Linq; // sort global first
using System; // sort anything in System
using NonSystem; // sort anything non-system
using static Static; // sort static
using Alias = Z; // sort alias
using SomeAlias = A;

#if DEBUG // finally any usings in #if's
using Z; // contents are not sorted as of now
using A;

#endif
Remove line before the content of a bracketless if/else statement #​979
// input
if (true)

    CallMethod();
else if (false)

    CallMethod();
else

    CallMethod();

for (; ; )

    CallMethod();

while (true)

    CallMethod();

// 0.26.0
if (true)
    CallMethod();
else if (false)
    CallMethod();
else
    CallMethod();

for (; ; )
    CallMethod();

while (true)
    CallMethod();

Thanks go to @​Infinite-3D for reporting

Support C# 12 primary constructors on structs #​969

CSharpier now supports primary constructors on structs

public struct NamedItem2(
    string name1,
    string name2
)
{
    public string Name1 => name1;
    public string Name2 => name1;
}
Support C# 12 collection expressions [#​964][https://github.com/belav/csharpier/issues/964](https://redirect.github.com/belav/csharpier/issues/964)4

CSharpier now supports collection expressions

int[] a =  [ 1, 2, 3, 4, 5, 6, 7, 8 ];

Span<int> b =  [ 'a', 'b', 'c', 'd', 'e', 'f', 'h', 'i' ];

string[] c =
[
    "________________________",
    "________________________",
    "________________________",
    "________________________"
];

int[][] d =
[
    [1, 2, 3],
    [4, 5, 6],
    [7, 8, 9]
];

Thanks go to @​meenzen for reporting

MSBuild - when a file fails to compile csharpier interferes with getting you clickable links to the compilation errors. #​957

Build errors will now display properly when using CSharpier.MSBuild

Format element access properly in long invocation chains #​956
// 0.25.0
var x = someLongNameField.CallMethod____________________________________().AccessArray[
    1
].Property_______________;

// 0.26.0
var x = someLongNameField
    .CallMethod____________________________________()
    .AccessArray[1]
    .Property_______________;
Improvements to visible whitespace in console output. #​953

When using cshapier --check whitespace is now only visible in the following situations

When an otherwise empty line contains whitespace

----------------------------- Expected: Around Line 4 -----------------------------
    private string field1;

    private string field2;
----------------------------- Actual: Around Line 4 -----------------------------
    private string field1;
····
    private string field2;

When a line has extra trailing whitespace

----------------------------- Expected: Around Line 3 -----------------------------
{
    private string field1;
}
----------------------------- Actual: Around Line 3 -----------------------------
{
    private string field1;····
}
MSBuild is not encoding using UTF8 #​947

When CSharpier.MSBuild ran into a failed csharpier check, it was not encoding the std-error output with UTF8. This resulted in messages such as

----------------------------- Expected: Around Line 3 -----------------------------
{
┬╖┬╖┬╖┬╖private┬╖string┬╖field1;
}
----------------------------- Actual: Around Line 3 -----------------------------
{
┬╖┬╖┬╖┬╖private┬╖string┬╖field1;┬╖┬╖┬╖┬╖
}

Thanks go to @​Tyrrrz for reporting

Comment inside raw string literal is lost when file is formatted. #​937
// input
var rawLiteralWithExpressionThatWeDontFormat = new StringContent(
    // this comment shouldn't go away
    $$"""
      {
          "params": "{{searchFilter switch
{
    SearchFilter.Video => "EgIQAQ%3D%3D",
    _ => null
}}}"
      }
      """
);

// 0.25.0
var rawLiteralWithExpressionThatWeDontFormat = new StringContent(
    $$"""
      {
          "params": "{{searchFilter switch
{
    SearchFilter.Video => "EgIQAQ%3D%3D",
    _ => null
}}}"
      }
      """
);

Thanks go to @​Tyrrrz for reporting

Allow line endings to be configurable #​935

CSharpier now supports the following options for line endings. The default is auto

  • "auto" - Maintain existing line endings (mixed values within one file are normalised by looking at what's used after the first line)
  • "lf" – Line Feed only (\n), common on Linux and macOS as well as inside git repos
  • "crlf" - Carriage Return + Line Feed characters (\r\n), common on Windows

Thanks go to @​phuhl for the feature request

Avoid breaking only around binary expression but not binary expression itself #​924
// 0.25.0
if (
    someLongStatement == true || someOtherStatement________________________________ == false
)

// 0.26.0
if (someLongStatement == true || someOtherStatement________________________________ == false)

Thanks go to @​Nixxen for reporting

Nested loops without brackets should not be indented #​867
// 0.25.0
foreach (var subsequence in sequence)
    foreach (var item in subsequence)
        item.DoSomething();

// 0.26.0
foreach (var subsequence in sequence)
foreach (var item in subsequence)
    item.DoSomething();

Thanks go to @​Rudomitori for the contribution
Full Changelog: belav/csharpier@0.25.0...0.26.0

v0.25.0

Compare Source

Breaking Changes

Improve if directive formatting #​404

The preprocessorSymbolSets configuration option is no longer supported.
CSharpier can now parse and format the full range of #if preprocessor statements so it is no longer required.

// 0.24.2 - supported some basic versions of #if
#if DEBUG
// some code 
#endif

// 0.25.0 - supports the full range of #if including nested statements
// would require the use of the preprocessorSymbolSets configuration option previously 
#if (DEBUG && !NET48) || MONO
// some code
#if NET6_0
// some other code
#endif 
#endif

What's Changed

Sort Modifiers #​725

CSharpier will now sort modifiers according to the defaults for IDE0036

// input
public override async Task Method1() { } 
async public override Task Method2() { }

// output
public override async Task Method1() { } 
public override async Task Method2() { }

Thanks go to @​glmnet for the contribution

Support c# 12 features #​883

CSharpier now supports formatting
Primary Constructors,
Alias any typ, and
Default lambda parameters

Support for log levels #​875

CSharpier now supports --loglevel with the CLI and CSharpier_LogLevel for MSBuild. This changes the level of logging output. Valid options are:

  • None
  • Error
  • Warning
  • Information (default)
  • Debug

Thanks go to @​samtrion for the suggestion

CSharpier removes blank line before unsafe block #​917

CSharpier was not honoring lines that appeared before unsafe

// input
var x = 1;

unsafe
{
    // should retain empty line
}

// 0.24.2
var x = 1;
unsafe
{
    // should retain empty line
}

// 0.25.0
var x = 1;

unsafe
{
    // should retain empty line
}

Thanks go to @​fgimian for reporting the bug

Adding ability to bypass CSharpier when using CSharpier.MsBuild #​914

In some instances it is desirable to completely bypass CSharpier.MsBuild, this can now be done with the CSharpier_Bypass property.

dotnet publish -c release -o /app --no-restore /p:CSharpier_Bypass=true

Thanks go to @​OneCyrus for the suggestion

Strong Name Sign Assemblies #​911

CSharpier is now strong name signed so that it can be used in packages that are strong name signed.

Thanks go to @​TwentyFourMinutes for the suggestions and to @​goelhardik for strong name signing Ignore

Don't format files in obj folders #​910

CSharpier will no longer format cs files that are in an obj folder.

CSharpier.MsBuild runs once for each framework, can it be more efficient. #​900

When CSharpier.MsBuild was in a csproj that had multiple target frameworks, it would run once for each target framework. It will now run just a single time.

CSharpier.MsBuild returns exit code 1 when ManagePackageVersionsCentrally is set to true #​898

CSharpier.MsBuild was not running correctly when used in a project that had centrally managed package version.

Thanks go to @​adc-cjewett for reporting the bug

Multiline comments always indented with spaces when formatting with tabs #​891

With useTabs: true, CSharpier was formatting multiline comments with a space instead of a tab.

// input
public class Foo
{
	/**
	 * comment
	 */
	public class Bar { }
}

// 0.24.1
public class Foo
{
 /**
  * comment
  */
	public class Bar { }
}

// 0.25.0
public class Foo
{
	/**
	 * comment
	 */
	public class Bar { }
}

Thanks go to @​MonstraG for reporting the bug.

File scoped namespaces should be followed by a blank line #​861

CSharpier now adds an empty line after file scoped namespaces if there is not already one

// input
namespace Namespace;
using System;

// 0.25.0
namespace Namespace;

using System;

Full Changelog: belav/csharpier@0.24.2...0.25.0


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@renovate renovate bot force-pushed the renovate/csharpier-0.x branch from caa8adf to 2d3ba9d Compare November 7, 2023 00:29
@renovate renovate bot changed the title chore(deps): update dependency csharpier to v0.25.0 chore(deps): update dependency csharpier to v0.26.0 Nov 7, 2023
@renovate renovate bot force-pushed the renovate/csharpier-0.x branch from 2d3ba9d to 9abb6c9 Compare November 9, 2023 08:03
@renovate renovate bot changed the title chore(deps): update dependency csharpier to v0.26.0 chore(deps): update dependency csharpier to v0.26.1 Nov 9, 2023
@renovate renovate bot force-pushed the renovate/csharpier-0.x branch from 9abb6c9 to 2b97184 Compare November 16, 2023 06:20
@renovate renovate bot changed the title chore(deps): update dependency csharpier to v0.26.1 chore(deps): update dependency csharpier to v0.26.2 Nov 16, 2023
@renovate renovate bot force-pushed the renovate/csharpier-0.x branch from 2b97184 to 948c553 Compare November 23, 2023 22:05
@renovate renovate bot changed the title chore(deps): update dependency csharpier to v0.26.2 chore(deps): update dependency csharpier to v0.26.3 Nov 23, 2023
@renovate renovate bot force-pushed the renovate/csharpier-0.x branch from 948c553 to 900a7e7 Compare December 2, 2023 20:00
@renovate renovate bot changed the title chore(deps): update dependency csharpier to v0.26.3 chore(deps): update dependency csharpier to v0.26.4 Dec 2, 2023
@renovate renovate bot force-pushed the renovate/csharpier-0.x branch from 900a7e7 to dd6f142 Compare December 10, 2023 18:51
@renovate renovate bot changed the title chore(deps): update dependency csharpier to v0.26.4 chore(deps): update dependency csharpier to v0.26.5 Dec 10, 2023
@renovate renovate bot force-pushed the renovate/csharpier-0.x branch from dd6f142 to 6036050 Compare December 14, 2023 04:31
@renovate renovate bot changed the title chore(deps): update dependency csharpier to v0.26.5 chore(deps): update dependency csharpier to v0.26.6 Dec 14, 2023
@renovate renovate bot force-pushed the renovate/csharpier-0.x branch from 6036050 to f825a88 Compare December 16, 2023 22:35
@renovate renovate bot changed the title chore(deps): update dependency csharpier to v0.26.6 chore(deps): update dependency csharpier to v0.26.7 Dec 16, 2023
@renovate renovate bot force-pushed the renovate/csharpier-0.x branch from f825a88 to 26ade78 Compare January 15, 2024 18:38
@renovate renovate bot changed the title chore(deps): update dependency csharpier to v0.26.7 chore(deps): update dependency csharpier to v0.27.0 Jan 15, 2024
@renovate renovate bot force-pushed the renovate/csharpier-0.x branch from 26ade78 to 8c0abba Compare January 24, 2024 01:08
@renovate renovate bot changed the title chore(deps): update dependency csharpier to v0.27.0 chore(deps): update dependency csharpier to v0.27.1 Jan 24, 2024
@renovate renovate bot force-pushed the renovate/csharpier-0.x branch from 8c0abba to 7f4848a Compare January 28, 2024 19:56
@renovate renovate bot changed the title chore(deps): update dependency csharpier to v0.27.1 chore(deps): update dependency csharpier to v0.27.2 Jan 28, 2024
@renovate renovate bot force-pushed the renovate/csharpier-0.x branch from 7f4848a to f94dc77 Compare February 18, 2024 18:03
@renovate renovate bot changed the title chore(deps): update dependency csharpier to v0.27.2 chore(deps): update dependency csharpier to v0.27.3 Feb 18, 2024
Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@renovate renovate bot force-pushed the renovate/csharpier-0.x branch from f94dc77 to 730e2c1 Compare April 8, 2024 01:21
@renovate renovate bot changed the title chore(deps): update dependency csharpier to v0.27.3 chore(deps): update dependency csharpier to v0.28.0 Apr 8, 2024
@renovate renovate bot force-pushed the renovate/csharpier-0.x branch from 730e2c1 to 2991bf7 Compare April 17, 2024 00:29
@renovate renovate bot changed the title chore(deps): update dependency csharpier to v0.28.0 chore(deps): update dependency csharpier to v0.28.1 Apr 17, 2024
@renovate renovate bot force-pushed the renovate/csharpier-0.x branch from 2991bf7 to 885eb56 Compare April 26, 2024 18:41
@renovate renovate bot changed the title chore(deps): update dependency csharpier to v0.28.1 chore(deps): update dependency csharpier to v0.28.2 Apr 26, 2024
Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@renovate renovate bot force-pushed the renovate/csharpier-0.x branch from 885eb56 to 0940b7c Compare August 17, 2024 19:51
@renovate renovate bot changed the title chore(deps): update dependency csharpier to v0.28.2 chore(deps): update dependency csharpier to v0.29.0 Aug 17, 2024
@renovate renovate bot force-pushed the renovate/csharpier-0.x branch from 0940b7c to 4aa2afb Compare August 23, 2024 18:10
@renovate renovate bot changed the title chore(deps): update dependency csharpier to v0.29.0 chore(deps): update dependency csharpier to v0.29.1 Aug 23, 2024
@renovate renovate bot changed the title chore(deps): update dependency csharpier to v0.29.1 chore(deps): update dependency csharpier to 0.29.1 Aug 28, 2024
@renovate renovate bot force-pushed the renovate/csharpier-0.x branch from 4aa2afb to 0995b22 Compare September 15, 2024 20:02
@renovate renovate bot changed the title chore(deps): update dependency csharpier to 0.29.1 chore(deps): update dependency csharpier to 0.29.2 Sep 15, 2024
Copy link

@renovate renovate bot force-pushed the renovate/csharpier-0.x branch from 0995b22 to 3d9cdd1 Compare November 17, 2024 19:37
@renovate renovate bot changed the title chore(deps): update dependency csharpier to 0.29.2 chore(deps): update dependency csharpier to 0.30.0 Nov 17, 2024
@renovate renovate bot force-pushed the renovate/csharpier-0.x branch from 3d9cdd1 to 2bebf14 Compare November 18, 2024 04:15
@renovate renovate bot changed the title chore(deps): update dependency csharpier to 0.30.0 chore(deps): update dependency csharpier to 0.30.1 Nov 18, 2024
@renovate renovate bot force-pushed the renovate/csharpier-0.x branch from 2bebf14 to 440313e Compare November 22, 2024 17:25
@renovate renovate bot changed the title chore(deps): update dependency csharpier to 0.30.1 chore(deps): update dependency csharpier to 0.30.2 Nov 22, 2024
@renovate renovate bot force-pushed the renovate/csharpier-0.x branch from 440313e to 8f45a25 Compare December 7, 2024 23:17
@renovate renovate bot changed the title chore(deps): update dependency csharpier to 0.30.2 chore(deps): update dependency csharpier to 0.30.3 Dec 7, 2024
Copy link

github-actions bot commented Dec 7, 2024

Code Coverage

Package Line Rate Branch Rate Health
SteamTogether.Bot 7% 6%
SteamTogether.Core 9% 50%
SteamTogether.Scraper 49% 42%
Summary 15% (344 / 2341) 19% (33 / 174)

Copy link

sonarqubecloud bot commented Dec 7, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants