chore(deps): update dependency csharpier to v1 #12

Open
Renovate wants to merge 1 commit from renovate/csharpier-1.x into main
Member

This PR contains the following updates:

Package Change Age Confidence
csharpier 0.30.6 -> 1.1.2 age confidence

Release Notes

belav/csharpier (csharpier)

v1.1.2

Compare Source

What's Changed

Inconsistencies with null-coalescing wrapping on method chains #​1573

On longer method chains, depending on the exact chain a null coalescing expression wouldn't always be preceded by a new line.

// input & expected output
var x =
    someValue
        .Property.CallLongMethod_____________________________________()
        .CallMethod__________()
    ?? throw new Exception();

var x =
    someValue
        .Property.CallLongMethod_____________________________________()
        .CallLongMethod___________________________________________________()
    ?? throw new Exception();

// 1.1.1
var x =
    someValue
        .Property.CallLongMethod_____________________________________()
        .CallMethod__________() ?? throw new Exception();

var x =
    someValue
        .Property.CallLongMethod_____________________________________()
        .CallLongMethod___________________________________________________()
    ?? throw new Exception();

Full Changelog: https://github.com/belav/csharpier/compare/1.1.1...1.1.2

v1.1.1

Compare Source

What's Changed

Unhandled exception: System.ArgumentOutOfRangeException: startIndex cannot be larger than length of string. (Parameter 'startIndex') #​1673

CSharpier was throwing an exception when formating a directory contained a file without an extension.

Full Changelog: https://github.com/belav/csharpier/compare/1.1.1...1.1.1

v1.1.0

Compare Source

What's Changed

.gitignore from parent folders impacts formatting of children #​1627

CSharpier will no longer consider .gitignore files located above the root of the current git repository.

Changes to stdin formatting #​288 #​1657

There is a new option --stdin-filepath that is used to specify the filepath CSharpier should use for resolving options and ignore files.
When no path is specified via stdin-path

  • No ignore files are considered.
  • The current directory is considered when locating options
  • The file is assumed to be c# unless the first non-whitespace character is < in which case it is assumed to be xml.
Support for C# 14 and .NET 10 #​1654 #​1646

Changes were required to support the following

  • Extension Declarations
  • File level directives in file based C# Apps
Support --ignore-path CLI option #​1585

It is now possible to specify the path to an ignore file

dotnet csharpier format . --ignore-path .config/.csharpierignore
Format xaml and slnx by default #​1628 #​1604

CSharpier now formats xaml and slnx by default without the need for configuration changes.

XML formatting is not taking into account EOL configuration on multiline comments #​1660

When formatting the following XML, CSharpier would always use the system system default for ending lines within the comment instead of the respecting the configured EOL setting.

<Element>
  <!--
  Comment with EOL
  -->
</Element>
Error when no read access to intermediate containing folder #​1656

In the case that CSharpier had access to a sub directory but not the parent of that sub directory, it was failing with an exception. That has been resolved.

Misleading message after "csharpier check" #​1645

Previously the format and check commands both used the same output message. The check command now correctly reports that it checked files and did not format them.

v1.0.3

Compare Source

dotnet csharpier check .
Formatted 13226 files in 21986ms.

v1.0.2

Compare Source

What's Changed

Performance issues when supporting .gitignore. #​1588

CSharpier was using a naive algorithm for parsing and evaluating gitignore rules that caused significant perfomance issues. @​kevinboss reworked the implementation to drastically increate performance.

Exclude bin/ and obj/ directory content from xml formatting #​1600

CSharpier now excludes all files in bin/ and obj/ by default.

Error on syntactically valid conditional with is #​1612

The following c# is valid and compiles with 9.0.300+. CSharpier was updated to properly parse it.

var x = y is y ? [] : z ?? [];
Xml formatting with comments in text element inserts extra new lines #​1607

CSharpier has some issues with formatting text that contained xml comments. That has been improved.

Input & expected output

<NoWarn>
  CA1031; <!-- Since this is not a library project, catching general exceptions is OK -->
  IDE0005; <!-- Allow unused usings -->
</NoWarn>

1.0.1

<NoWarn
    >
      CA1031;
    <!-- Since this is not a library project, catching general exceptions is OK -->

    
      IDE0005;
    <!-- Allow unused usings -->
</NoWarn>

Inconsistent formatting of single-line lambda expressions #​1594

CSharpier 1.0.0 introduced a regression that caused the following formatting. This is now working as expected.

// input & expected output
        CallMethod(() => CallAnotherMethod______________________________________________________());
        CallMethod(() =>
            CallAnotherMethod______________________________________________________1()
        );
        CallMethod(() =>
            CallAnotherMethod______________________________________________________12()
        );
        CallMethod(() =>
            CallAnotherMethod______________________________________________________123()
        );

// 1.0.0
        CallMethod(() => CallAnotherMethod______________________________________________________());
        CallMethod(() => CallAnotherMethod______________________________________________________1()
        );
        CallMethod(() => CallAnotherMethod______________________________________________________12()
        );
        CallMethod(() =>
            CallAnotherMethod______________________________________________________123()
        );

Full Changelog: https://github.com/belav/csharpier/compare/1.0.1...1.0.2

v1.0.1

Compare Source

What's Changed

CSharpier's support for .gitignore is causing performance issues #​1584

The support for .gitignore has some major performance problems when there are a large number of .gitignore files and/or ignore rules. The feature has been disabled for now until it can be fixed.

CSharpier.MsBuild issues #​1586

CSharpier.MsBuild was not properly logging errors when performing a formatting check. This would result in the build passing when files were not formatted.
Setting CSharpier_LogLevel was passing an invalid parameter of --loglevel to CSharpier, resulting in a build failure

Full Changelog: https://github.com/belav/csharpier/compare/1.0.0...1.0.1

v1.0.0

Compare Source

Major Changes

Support for formatting XML #​819

CSharpier now formats xml files by default. It will try to format ".csproj", ".props", ".targets", ".xml", ".config" as if they were xml.
If a file is not valid xml it will be treated as a warning.
The default indent size is 2 instead of 4

Performance Improvements

@​TimothyMakkison put a lot of effort into improving the performance of CSharpier. These benchmark numbers show drastic improvement for both speed and memory usage.

Baseline

| Method                        | Mean     | Error   | StdDev  | Median   | Gen0       | Gen1      | Gen2      | Allocated |
|------------------------------ |---------:|--------:|--------:|---------:|-----------:|----------:|----------:|----------:|
| Default_CodeFormatter_Tests   | 233.3 ms | 4.63 ms | 8.23 ms | 229.7 ms | 11000.0000 | 4000.0000 | 1000.0000 | 101.41 MB |
| Default_CodeFormatter_Complex | 433.7 ms | 8.53 ms | 7.56 ms | 433.4 ms | 20000.0000 | 5000.0000 | 1000.0000 | 182.44 MB |

After Improvements

| Method                        | Mean      | Error    | StdDev   | Gen0      | Gen1      | Allocated |
|------------------------------ |----------:|---------:|---------:|----------:|----------:|----------:|
| Default_CodeFormatter_Tests   |  64.72 ms | 0.548 ms | 0.512 ms | 1666.6667 | 1000.0000 |  18.33 MB |
| Default_CodeFormatter_Complex | 137.83 ms | 2.730 ms | 4.708 ms | 3000.0000 | 1000.0000 |  30.78 MB |

Breaking Changes

ConfigurationFile - rename TabWidth to IndentSize #​1377

In order to get consistency between an .editorconfig and .csharpierconfig the option TabWidth has been renamed to IndentSize. This is also a more accurate name considering by default indentation is done with spaces and not tabs.

Rework the CLI to use commands and arguments. #​1321

The CLI has been reworked to use commands. This helps make it clear which arguments apply to which commands. The two common commands are below, see https://csharpier.com/docs/CLI for more details.

dotnet csharpier format .
dotnet csharpier check .
Changing the tool command to csharpier. Changing the assembly/exe to CSharpier #​1418

Prior to 1.0.0 the tool command was dotnet-csharpier and assembly/exe were named dotnet_csharpier.
The tool command name was changed to just csharpier

  • Running a local tool remains the same dotnet csharpier --version
  • Running a global tool is changed to csharpier --version

The assembly/exe names have changed to just CSharpier

Support for ignoring files via a .gitignore #​631

CSharpier now works as follows when determining if a file should be ignored.

  • .gitignore files are considered when determining if a file will be ignored. A .gitignore file at the same level as a given file will take priority over a .gitignore file above it in the directory tree.
  • If a .csharpierignore file is present at the same level or anywhere above the given file in the tree and it contains a pattern for a given file, that will take priority.
  • The patterns within .csharpierignore work the same as a .gitignore, with patterns lower in the file taking priority over patterns above
  • CSharpier does not currently look further up the directory tree for additional .csharpierignore files if it finds one. But it does look for .gitignore files. If there is demand this could be added later.

What's Changed

Add logging format argument and support for msbuild logs #​1517

CSharpier now supports a --log-format argument. By default it will log with a console format.
With --log-format MsBuild CSharpier will produce logs in a format that allow jumping to files in the VisualStudio error list.

Thanks go to @​moormaster for the contribution

Allow passing an .editorconfig file path into --config-path #​1456

CSharpier now supports passing a path to an .editorconfig file when using the --config-path argument.

Always ignore any files in .git folder #​1438

CSharpier will now ignore any files that are in a .git folder. Previously if the .git folder happened to contain an invalid c# file CSharpier would attempt to format it and report an error.

Avoid excessive file system watches for --server #​1465

When CSharpier server was started, it would create file watches for all of the files within the directory the tool existed in. This can lead to some systems running out of the ability to monitor more files.

CSharpier server now uses a temporary empty content root to avoid creating all file watches.

Thanks go to @​chklauser for the contribution

Smarter EditorConfig parsing #​1228

Previously CSharpier was eagerly loading all .editorconfig files within a directory that it was asked to format. It now lazy loads them in a way that is performant and avoids loading and parsing editorconfigs that aren't needed.

Extra blank line before local scope block in global statement #​1566
// input & expected output
int x = 1;

{
    int x = 2;
}

// 0.30.6
int x = 1;

{
    int x = 2;
}
Inconsistent indentation for parenthesis expression #​1562

A statement being surrounded by parentheses affected the indentation in an inconsistent way.

// input & expected output
var b2 = 
    System.Environment.SpecialFolder.AdminTools
        is System.Environment.SpecialFolder.AdminTools
            or System.Environment.SpecialFolder.AdminTools
            or System.Environment.SpecialFolder.AdminTools;

var b2 = (
    System.Environment.SpecialFolder.AdminTools
        is System.Environment.SpecialFolder.AdminTools
            or System.Environment.SpecialFolder.AdminTools
            or System.Environment.SpecialFolder.AdminTools
);

// 0.30.6
var b2 =
    System.Environment.SpecialFolder.AdminTools
        is System.Environment.SpecialFolder.AdminTools
            or System.Environment.SpecialFolder.AdminTools
            or System.Environment.SpecialFolder.AdminTools;

var b2 = (
    System.Environment.SpecialFolder.AdminTools
    is System.Environment.SpecialFolder.AdminTools
        or System.Environment.SpecialFolder.AdminTools
        or System.Environment.SpecialFolder.AdminTools
);

Attribute on property accessor causes unnecessary newlines in formatting #​1558

The logic around when to break properties with attributes has been adjusted. See the example for more details

public class ClassName
{
    [Obsolete]
    public string Property { [Obsolete] get; [Obsolete] set; }

    public int ShortProperty { get; [SomeAttribute] init; } = 20;

    public int CommandTimeout
    {
        get;
        [SomeAttribute]
        [SomeOtherAttribute]
        set;
    }

    public int CommandTimeout
    {
        [SomeAttribute(someValue)]
        get;
    }
}
Fluent multiline with comment re-formats incorrectly. #​1556

When a single method in a fluent chain was commented out, csharpier would try to collapse the chain to a single line.

// input & expected output
builder
    .CallMethod()
    .CallMethod()
    .CallMethod()
    //.CallMethod()
;

// 0.30.6
builder.CallMethod().CallMethod().CallMethod()
//.CallMethod()
;

Comments on an invocation chain that began with a generic where breaking when they should not #​1555

In some cases CSharpier was breaking an invocation chain when it should not.

// input & expected output

// CommentOnGenericDoesNotBreakChain
SomeObject<SomeThing>.SomeProperty.SomeOtherProperty = 1;

// CommentOnGenericDoesNotBreakChain
SomeObject<SomeThing>.SomeProperty.CallMethod();

// 0.30.6

// CommentOnGenericDoesNotBreakChain
SomeObject<SomeThing>
    .SomeProperty
    .SomeOtherProperty = 1;

// CommentOnGenericDoesNotBreakChain
SomeObject<SomeThing>.SomeProperty.CallMethod();

Comment in line before attribute causes unexpected line break after attribute #​1553

CSharpier was breaking and indenting a parameter when it had a comment

// input & expected output
    public void SomeMethod(
        // Some Comment does not indent parameter
        [SomeAttribute] string someParameter
    ) { }

// 0.30.6
    public void SomeMethod(
        // Some Comment does not indent parameter
        [SomeAttribute]
            string someParameter
    ) { }
Huge oneliner with switch expression followed my method invocations #​1546

CSharpier was keeping a method chain on a single line if it was invoked on a switch expression within parentheses.

// input & expected output
(
    someValue switch
    {
        someValue => 1,
        _ => 2,
    }
)
    .SomeLongMethodCall______________________________()
    .SomeLongMethodCall______________________________()
    .SomeLongMethodCall______________________________();

// 0.30.6
(
    someValue switch
    {
        someValue => 1,
        _ => 2,
    }
).SomeLongMethodCall______________________________().SomeLongMethodCall______________________________().SomeLongMethodCall______________________________();

Inconsistent Formatting of Single Parameter Lambda Expressions #​1522

CSharpier was not formatting all lambda expressions consistently when they were the single argument to a method call.

// input & expected output
CallMethod(() =>
    CallOtherMethod___________________________________________________________()
);

CallMethod(() =>
    CallLongMethod_________________________________()
        .ThenAnotherMethod_____________________________________()
);

// 0.30.6
CallMethod(() =>
    CallOtherMethod___________________________________________________________()
);

CallMethod(
    () =>
        CallLongMethod_________________________________()
            .ThenAnotherMethod_____________________________________()
);
Empty lines after XmlComments should be removed #​1521

When a member has documentation comments, any empty lines after those comments and before the member are now removed.

// input
    /// <summary>Remove the lines after the summary</summary>

    public bool SomeField1;

// output
    /// <summary>Remove the lines after the summary</summary>
    public bool SomeField1;
CSharpier always includes indentation whitespace on non-content lines #​1455

CSharpier was indenting the final non-content line within a raw string. It now leaves them dedented to keep it consistent with other non-content lines.

MakeSureBothNonContentLinesHereStayTrimmed(
    $"""

    """
);

Full Changelog: https://github.com/belav/csharpier/compare/0.30.6...1.0.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 has been generated by Renovate Bot.

This PR contains the following updates: | Package | Change | Age | Confidence | |---|---|---|---| | [csharpier](https://github.com/belav/csharpier) | `0.30.6` -> `1.1.2` | [![age](https://developer.mend.io/api/mc/badges/age/nuget/csharpier/1.1.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/nuget/csharpier/0.30.6/1.1.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>belav/csharpier (csharpier)</summary> ### [`v1.1.2`](https://github.com/belav/csharpier/blob/HEAD/CHANGELOG.md#112) [Compare Source](https://github.com/belav/csharpier/compare/1.1.1...1.1.2) #### What's Changed ##### Inconsistencies with null-coalescing wrapping on method chains [#&#8203;1573](https://github.com/belav/csharpier/issues/1573) On longer method chains, depending on the exact chain a null coalescing expression wouldn't always be preceded by a new line. ```c# // input & expected output var x = someValue .Property.CallLongMethod_____________________________________() .CallMethod__________() ?? throw new Exception(); var x = someValue .Property.CallLongMethod_____________________________________() .CallLongMethod___________________________________________________() ?? throw new Exception(); // 1.1.1 var x = someValue .Property.CallLongMethod_____________________________________() .CallMethod__________() ?? throw new Exception(); var x = someValue .Property.CallLongMethod_____________________________________() .CallLongMethod___________________________________________________() ?? throw new Exception(); ``` **Full Changelog**: <https://github.com/belav/csharpier/compare/1.1.1...1.1.2> ### [`v1.1.1`](https://github.com/belav/csharpier/blob/HEAD/CHANGELOG.md#111) [Compare Source](https://github.com/belav/csharpier/compare/1.1.0...1.1.1) #### What's Changed ##### Unhandled exception: System.ArgumentOutOfRangeException: startIndex cannot be larger than length of string. (Parameter 'startIndex') [#&#8203;1673](https://github.com/belav/csharpier/issues/1673) CSharpier was throwing an exception when formating a directory contained a file without an extension. **Full Changelog**: <https://github.com/belav/csharpier/compare/1.1.1...1.1.1> ### [`v1.1.0`](https://github.com/belav/csharpier/blob/HEAD/CHANGELOG.md#110) [Compare Source](https://github.com/belav/csharpier/compare/1.0.3...1.1.0) #### What's Changed ##### .gitignore from parent folders impacts formatting of children [#&#8203;1627](https://github.com/belav/csharpier/issues/1627) CSharpier will no longer consider `.gitignore` files located above the root of the current git repository. ##### Changes to stdin formatting [#&#8203;288](https://github.com/belav/csharpier/issues/288) [#&#8203;1657](https://github.com/belav/csharpier/issues/1657) There is a new option `--stdin-filepath` that is used to specify the filepath CSharpier should use for resolving options and ignore files. \ When no path is specified via `stdin-path` - No ignore files are considered. - The current directory is considered when locating options - The file is assumed to be c# unless the first non-whitespace character is `<` in which case it is assumed to be xml. ##### Support for C# 14 and .NET 10 [#&#8203;1654](https://github.com/belav/csharpier/issues/1654) [#&#8203;1646](https://github.com/belav/csharpier/issues/1646) Changes were required to support the following - Extension Declarations - File level directives in file based C# Apps ##### Support --ignore-path CLI option [#&#8203;1585](https://github.com/belav/csharpier/issues/1585) It is now possible to specify the path to an ignore file ```bash dotnet csharpier format . --ignore-path .config/.csharpierignore ``` ##### Format xaml and slnx by default [#&#8203;1628](https://github.com/belav/csharpier/issues/1628) [#&#8203;1604](https://github.com/belav/csharpier/issues/1604) CSharpier now formats `xaml` and `slnx` by default without the need for configuration changes. ##### XML formatting is not taking into account EOL configuration on multiline comments [#&#8203;1660](https://github.com/belav/csharpier/issues/1660) When formatting the following XML, CSharpier would always use the system system default for ending lines within the comment instead of the respecting the configured EOL setting. ```xml <Element> <!-- Comment with EOL --> </Element> ``` ##### Error when no read access to intermediate containing folder [#&#8203;1656](https://github.com/belav/csharpier/issues/1656) In the case that CSharpier had access to a sub directory but not the parent of that sub directory, it was failing with an exception. That has been resolved. ##### Misleading message after "csharpier check" [#&#8203;1645](https://github.com/belav/csharpier/issues/1645) Previously the `format` and `check` commands both used the same output message. The `check` command now correctly reports that it checked files and did not format them. ```bash ``` ### [`v1.0.3`](https://github.com/belav/csharpier/blob/HEAD/CHANGELOG.md#103) [Compare Source](https://github.com/belav/csharpier/compare/1.0.2...1.0.3) dotnet csharpier check . Formatted 13226 files in 21986ms. ### [`v1.0.2`](https://github.com/belav/csharpier/blob/HEAD/CHANGELOG.md#102) [Compare Source](https://github.com/belav/csharpier/compare/1.0.1...1.0.2) #### What's Changed ##### Performance issues when supporting .gitignore. [#&#8203;1588](https://github.com/belav/csharpier/issues/1588) CSharpier was using a naive algorithm for parsing and evaluating gitignore rules that caused significant perfomance issues. [@&#8203;kevinboss](https://github.com/kevinboss) reworked the implementation to drastically increate performance. ##### Exclude `bin/` and `obj/` directory content from xml formatting [#&#8203;1600](https://github.com/belav/csharpier/issues/1600) CSharpier now excludes all files in `bin/` and `obj/` by default. ##### Error on syntactically valid conditional with `is` [#&#8203;1612](https://github.com/belav/csharpier/issues/1612) The following c# is valid and compiles with `9.0.300+`. CSharpier was updated to properly parse it. ```c# var x = y is y ? [] : z ?? []; ``` ##### Xml formatting with comments in text element inserts extra new lines [#&#8203;1607](https://github.com/belav/csharpier/issues/1607) CSharpier has some issues with formatting text that contained xml comments. That has been improved. Input & expected output ```xml <NoWarn> CA1031; <!-- Since this is not a library project, catching general exceptions is OK --> IDE0005; <!-- Allow unused usings --> </NoWarn> ``` 1.0.1 ```xml <NoWarn > CA1031; <!-- Since this is not a library project, catching general exceptions is OK --> IDE0005; <!-- Allow unused usings --> </NoWarn> ``` ##### Inconsistent formatting of single-line lambda expressions [#&#8203;1594](https://github.com/belav/csharpier/issues/1594) CSharpier `1.0.0` introduced a regression that caused the following formatting. This is now working as expected. ```c# // input & expected output CallMethod(() => CallAnotherMethod______________________________________________________()); CallMethod(() => CallAnotherMethod______________________________________________________1() ); CallMethod(() => CallAnotherMethod______________________________________________________12() ); CallMethod(() => CallAnotherMethod______________________________________________________123() ); // 1.0.0 CallMethod(() => CallAnotherMethod______________________________________________________()); CallMethod(() => CallAnotherMethod______________________________________________________1() ); CallMethod(() => CallAnotherMethod______________________________________________________12() ); CallMethod(() => CallAnotherMethod______________________________________________________123() ); ``` **Full Changelog**: <https://github.com/belav/csharpier/compare/1.0.1...1.0.2> ### [`v1.0.1`](https://github.com/belav/csharpier/blob/HEAD/CHANGELOG.md#101) [Compare Source](https://github.com/belav/csharpier/compare/1.0.0...1.0.1) #### What's Changed ##### CSharpier's support for .gitignore is causing performance issues [#&#8203;1584](https://github.com/belav/csharpier/issues/1584) The support for `.gitignore` has some major performance problems when there are a large number of `.gitignore` files and/or ignore rules. The feature has been disabled for now until it can be fixed. ##### CSharpier.MsBuild issues [#&#8203;1586](https://github.com/belav/csharpier/issues/1586) CSharpier.MsBuild was not properly logging errors when performing a formatting check. This would result in the build passing when files were not formatted. \ Setting `CSharpier_LogLevel` was passing an invalid parameter of `--loglevel` to CSharpier, resulting in a build failure **Full Changelog**: <https://github.com/belav/csharpier/compare/1.0.0...1.0.1> ### [`v1.0.0`](https://github.com/belav/csharpier/blob/HEAD/CHANGELOG.md#100) [Compare Source](https://github.com/belav/csharpier/compare/0.30.6...1.0.0) #### Major Changes ##### Support for formatting XML [#&#8203;819](https://github.com/belav/csharpier/issues/819) CSharpier now formats xml files by default. It will try to format ".csproj", ".props", ".targets", ".xml", ".config" as if they were xml. \ If a file is not valid xml it will be treated as a warning. \ The default indent size is `2` instead of `4` ##### Performance Improvements [@&#8203;TimothyMakkison](https://github.com/TimothyMakkison) put a lot of effort into improving the performance of CSharpier. These benchmark numbers show drastic improvement for both speed and memory usage. Baseline ``` | Method | Mean | Error | StdDev | Median | Gen0 | Gen1 | Gen2 | Allocated | |------------------------------ |---------:|--------:|--------:|---------:|-----------:|----------:|----------:|----------:| | Default_CodeFormatter_Tests | 233.3 ms | 4.63 ms | 8.23 ms | 229.7 ms | 11000.0000 | 4000.0000 | 1000.0000 | 101.41 MB | | Default_CodeFormatter_Complex | 433.7 ms | 8.53 ms | 7.56 ms | 433.4 ms | 20000.0000 | 5000.0000 | 1000.0000 | 182.44 MB | ``` After Improvements ``` | Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated | |------------------------------ |----------:|---------:|---------:|----------:|----------:|----------:| | Default_CodeFormatter_Tests | 64.72 ms | 0.548 ms | 0.512 ms | 1666.6667 | 1000.0000 | 18.33 MB | | Default_CodeFormatter_Complex | 137.83 ms | 2.730 ms | 4.708 ms | 3000.0000 | 1000.0000 | 30.78 MB | ``` #### Breaking Changes ##### ConfigurationFile - rename TabWidth to IndentSize [#&#8203;1377](https://github.com/belav/csharpier/issues/1377) In order to get consistency between an `.editorconfig` and `.csharpierconfig` the option `TabWidth` has been renamed to `IndentSize`. This is also a more accurate name considering by default indentation is done with spaces and not tabs. ##### Rework the CLI to use commands and arguments. [#&#8203;1321](https://github.com/belav/csharpier/issues/1321) The CLI has been reworked to use commands. This helps make it clear which arguments apply to which commands. The two common commands are below, see <https://csharpier.com/docs/CLI> for more details. ``` dotnet csharpier format . dotnet csharpier check . ``` ##### Changing the tool command to csharpier. Changing the assembly/exe to CSharpier [#&#8203;1418](https://github.com/belav/csharpier/pull/1418) Prior to `1.0.0` the tool command was `dotnet-csharpier` and assembly/exe were named `dotnet_csharpier`. The tool command name was changed to just `csharpier` - Running a local tool remains the same `dotnet csharpier --version` - Running a global tool is changed to `csharpier --version` The assembly/exe names have changed to just `CSharpier` ##### Support for ignoring files via a .gitignore [#&#8203;631](https://github.com/belav/csharpier/issues/631) CSharpier now works as follows when determining if a file should be ignored. - .gitignore files are considered when determining if a file will be ignored. A .gitignore file at the same level as a given file will take priority over a .gitignore file above it in the directory tree. - If a .csharpierignore file is present at the same level or anywhere above the given file in the tree and it contains a pattern for a given file, that will take priority. - The patterns within .csharpierignore work the same as a .gitignore, with patterns lower in the file taking priority over patterns above - CSharpier does not currently look further up the directory tree for additional .csharpierignore files if it finds one. But it does look for .gitignore files. If there is demand this could be added later. #### What's Changed ##### Add logging format argument and support for msbuild logs [#&#8203;1517](https://github.com/belav/csharpier/pull/1517) CSharpier now supports a `--log-format` argument. By default it will log with a console format. \ With `--log-format MsBuild` CSharpier will produce logs in a format that allow jumping to files in the VisualStudio error list. Thanks go to [@&#8203;moormaster](https://github.com/moormaster) for the contribution ##### Allow passing an `.editorconfig` file path into `--config-path` [#&#8203;1456](https://github.com/belav/csharpier/issues/1456) CSharpier now supports passing a path to an `.editorconfig` file when using the `--config-path` argument. ##### Always ignore any files in .git folder [#&#8203;1438](https://github.com/belav/csharpier/pull/1438) CSharpier will now ignore any files that are in a `.git` folder. Previously if the `.git` folder happened to contain an invalid c# file CSharpier would attempt to format it and report an error. ##### Avoid excessive file system watches for --server [#&#8203;1465](https://github.com/belav/csharpier/pull/1465) When CSharpier server was started, it would create file watches for all of the files within the directory the tool existed in. This can lead to some systems running out of the ability to monitor more files. CSharpier server now uses a temporary empty content root to avoid creating all file watches. Thanks go to [@&#8203;chklauser](https://github.com/chklauser) for the contribution ##### Smarter EditorConfig parsing [#&#8203;1228](https://github.com/belav/csharpier/issues/1228) Previously CSharpier was eagerly loading all `.editorconfig` files within a directory that it was asked to format. It now lazy loads them in a way that is performant and avoids loading and parsing editorconfigs that aren't needed. ##### Extra blank line before local scope block in global statement [#&#8203;1566](https://github.com/belav/csharpier/issues/1566) ```c# // input & expected output int x = 1; { int x = 2; } // 0.30.6 int x = 1; { int x = 2; } ``` ##### Inconsistent indentation for parenthesis expression [#&#8203;1562](https://github.com/belav/csharpier/issues/1562) A statement being surrounded by parentheses affected the indentation in an inconsistent way. ```c# // input & expected output var b2 = System.Environment.SpecialFolder.AdminTools is System.Environment.SpecialFolder.AdminTools or System.Environment.SpecialFolder.AdminTools or System.Environment.SpecialFolder.AdminTools; var b2 = ( System.Environment.SpecialFolder.AdminTools is System.Environment.SpecialFolder.AdminTools or System.Environment.SpecialFolder.AdminTools or System.Environment.SpecialFolder.AdminTools ); // 0.30.6 var b2 = System.Environment.SpecialFolder.AdminTools is System.Environment.SpecialFolder.AdminTools or System.Environment.SpecialFolder.AdminTools or System.Environment.SpecialFolder.AdminTools; var b2 = ( System.Environment.SpecialFolder.AdminTools is System.Environment.SpecialFolder.AdminTools or System.Environment.SpecialFolder.AdminTools or System.Environment.SpecialFolder.AdminTools ); ``` ##### Attribute on property accessor causes unnecessary newlines in formatting [#&#8203;1558](https://github.com/belav/csharpier/issues/1558) The logic around when to break properties with attributes has been adjusted. See the example for more details ```c# public class ClassName { [Obsolete] public string Property { [Obsolete] get; [Obsolete] set; } public int ShortProperty { get; [SomeAttribute] init; } = 20; public int CommandTimeout { get; [SomeAttribute] [SomeOtherAttribute] set; } public int CommandTimeout { [SomeAttribute(someValue)] get; } } ``` ##### Fluent multiline with comment re-formats incorrectly. [#&#8203;1556](https://github.com/belav/csharpier/issues/1556) When a single method in a fluent chain was commented out, csharpier would try to collapse the chain to a single line. ```c# // input & expected output builder .CallMethod() .CallMethod() .CallMethod() //.CallMethod() ; // 0.30.6 builder.CallMethod().CallMethod().CallMethod() //.CallMethod() ; ``` ##### Comments on an invocation chain that began with a generic where breaking when they should not [#&#8203;1555](https://github.com/belav/csharpier/issues/1555) In some cases CSharpier was breaking an invocation chain when it should not. ```c# // input & expected output // CommentOnGenericDoesNotBreakChain SomeObject<SomeThing>.SomeProperty.SomeOtherProperty = 1; // CommentOnGenericDoesNotBreakChain SomeObject<SomeThing>.SomeProperty.CallMethod(); // 0.30.6 // CommentOnGenericDoesNotBreakChain SomeObject<SomeThing> .SomeProperty .SomeOtherProperty = 1; // CommentOnGenericDoesNotBreakChain SomeObject<SomeThing>.SomeProperty.CallMethod(); ``` ##### Comment in line before attribute causes unexpected line break after attribute [#&#8203;1553](https://github.com/belav/csharpier/issues/1553) CSharpier was breaking and indenting a parameter when it had a comment ```c# // input & expected output public void SomeMethod( // Some Comment does not indent parameter [SomeAttribute] string someParameter ) { } // 0.30.6 public void SomeMethod( // Some Comment does not indent parameter [SomeAttribute] string someParameter ) { } ``` ##### Huge oneliner with switch expression followed my method invocations [#&#8203;1546](https://github.com/belav/csharpier/issues/1546) CSharpier was keeping a method chain on a single line if it was invoked on a switch expression within parentheses. ```c# // input & expected output ( someValue switch { someValue => 1, _ => 2, } ) .SomeLongMethodCall______________________________() .SomeLongMethodCall______________________________() .SomeLongMethodCall______________________________(); // 0.30.6 ( someValue switch { someValue => 1, _ => 2, } ).SomeLongMethodCall______________________________().SomeLongMethodCall______________________________().SomeLongMethodCall______________________________(); ``` ##### Inconsistent Formatting of Single Parameter Lambda Expressions [#&#8203;1522](https://github.com/belav/csharpier/issues/1522) CSharpier was not formatting all lambda expressions consistently when they were the single argument to a method call. ```c# // input & expected output CallMethod(() => CallOtherMethod___________________________________________________________() ); CallMethod(() => CallLongMethod_________________________________() .ThenAnotherMethod_____________________________________() ); // 0.30.6 CallMethod(() => CallOtherMethod___________________________________________________________() ); CallMethod( () => CallLongMethod_________________________________() .ThenAnotherMethod_____________________________________() ); ``` ##### Empty lines after XmlComments should be removed [#&#8203;1521](https://github.com/belav/csharpier/issues/1521) When a member has documentation comments, any empty lines after those comments and before the member are now removed. ```c# // input /// <summary>Remove the lines after the summary</summary> public bool SomeField1; // output /// <summary>Remove the lines after the summary</summary> public bool SomeField1; ``` ##### CSharpier always includes indentation whitespace on non-content lines [#&#8203;1455](https://github.com/belav/csharpier/issues/1455) CSharpier was indenting the final non-content line within a raw string. It now leaves them dedented to keep it consistent with other non-content lines. ```c# MakeSureBothNonContentLinesHereStayTrimmed( $""" """ ); ``` **Full Changelog**: <https://github.com/belav/csharpier/compare/0.30.6...1.0.0> </details> --- ### 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. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yMzguMiIsInVwZGF0ZWRJblZlciI6IjQxLjgzLjAiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbIktpbmQvUmVub3ZhdGUiXX0=-->
Renovate bot requested review from Developers 2025-04-22 09:13:01 -04:00
Renovate bot force-pushed renovate/csharpier-1.x from eb09bde20d to 2344669e33 2025-04-25 22:12:15 -04:00 Compare
Renovate bot force-pushed renovate/csharpier-1.x from b5acfd0b13 to 8c026b6b1a 2025-05-24 12:35:38 -04:00 Compare
Renovate bot force-pushed renovate/csharpier-1.x from 8c026b6b1a to 74fff3f1e8 2025-06-29 13:27:32 -04:00 Compare
Renovate bot force-pushed renovate/csharpier-1.x from 74fff3f1e8 to aef492443c 2025-07-14 18:38:35 -04:00 Compare
Renovate bot force-pushed renovate/csharpier-1.x from aef492443c to 4378d5e125 2025-08-03 13:03:46 -04:00 Compare
Renovate bot force-pushed renovate/csharpier-1.x from 4378d5e125 to a71b67a288 2025-08-03 22:26:28 -04:00 Compare
Renovate bot force-pushed renovate/csharpier-1.x from a71b67a288 to ec2c35b104 2025-08-16 16:04:40 -04:00 Compare
Renovate bot force-pushed renovate/csharpier-1.x from ec2c35b104 to a75c24a7ef 2025-08-20 21:46:47 -04:00 Compare
Renovate bot force-pushed renovate/csharpier-1.x from a75c24a7ef to ce0f3a6248 2025-08-20 22:07:46 -04:00 Compare
This pull request doesn't have enough approvals yet. 0 of 1 approvals granted.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin renovate/csharpier-1.x:renovate/csharpier-1.x
git switch renovate/csharpier-1.x
Sign in to join this conversation.
No reviewers
Zenith/Developers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Zenith/ZenithInfo-Legacy!12
No description provided.