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

Update dependency csharpier to 0.29.2 #23

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

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Jan 15, 2024

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
csharpier 0.26.7 -> 0.29.2 age adoption passing confidence

Release Notes

belav/csharpier (csharpier)

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


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.

@renovate renovate bot changed the title Update dependency csharpier to v0.27.0 Update dependency csharpier to v0.27.1 Jan 24, 2024
@renovate renovate bot changed the title Update dependency csharpier to v0.27.1 Update dependency csharpier to v0.27.2 Jan 28, 2024
@renovate renovate bot changed the title Update dependency csharpier to v0.27.2 Update dependency csharpier to v0.27.3 Feb 18, 2024
@renovate renovate bot changed the title Update dependency csharpier to v0.27.3 Update dependency csharpier to v0.28.0 Apr 8, 2024
@renovate renovate bot changed the title Update dependency csharpier to v0.28.0 Update dependency csharpier to v0.28.1 Apr 17, 2024
@renovate renovate bot changed the title Update dependency csharpier to v0.28.1 Update dependency csharpier to v0.28.2 Apr 26, 2024
@renovate renovate bot changed the title Update dependency csharpier to v0.28.2 Update dependency csharpier to v0.29.0 Aug 17, 2024
@renovate renovate bot changed the title Update dependency csharpier to v0.29.0 Update dependency csharpier to v0.29.1 Aug 23, 2024
@renovate renovate bot changed the title Update dependency csharpier to v0.29.1 Update dependency csharpier to 0.29.1 Aug 28, 2024
@renovate renovate bot changed the title Update dependency csharpier to 0.29.1 Update dependency csharpier to 0.29.2 Sep 15, 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