Skip to content

Commit

Permalink
Merge branch 'main' into feature/867_nested_loops
Browse files Browse the repository at this point in the history
  • Loading branch information
shocklateboy92 committed Jul 6, 2023
2 parents b141898 + c80bab8 commit ff73179
Show file tree
Hide file tree
Showing 22 changed files with 449 additions and 278 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"csharpier": {
"version": "0.22.0",
"version": "0.25.0",
"commands": [
"dotnet-csharpier"
]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
name: publish nuget
needs: test
env:
VERSION_FILE_PATH: /Nuget/Build.props
VERSION_FILE_PATH: Nuget/Build.props
NUGET_KEY: ${{secrets.NUGET_API_KEY}}
steps:
- uses: actions/checkout@v2
Expand Down
153 changes: 153 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,155 @@
# 0.25.0
## Breaking Changes
#### Improve if directive formatting [#404](https://github.com/belav/csharpier/issues/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](https://github.com/belav/csharpier/issues/725)
CSharpier will now sort modifiers according to the defaults for [IDE0036](https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0036#csharp_preferred_modifier_order)
```c#
// 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](https://github.com/belav/csharpier/issues/883)
CSharpier now supports formatting
[Primary Constructors](https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-12#primary-constructors),
[Alias any typ](https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-12#alias-any-type), and
[Default lambda parameters](https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-12#default-lambda-parameters)

#### Support for log levels [#875](https://github.com/belav/csharpier/issues/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](https://github.com/belav/csharpier/issues/917)
CSharpier was not honoring lines that appeared before `unsafe`
```c#
// 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](https://github.com/belav/csharpier/issues/914)
In some instances it is desirable to completely bypass CSharpier.MsBuild, this can now be done with the `CSharpier_Bypass` property.
```bash
dotnet publish -c release -o /app --no-restore /p:CSharpier_Bypass=true
```

Thanks go to @OneCyrus for the suggestion

#### Strong Name Sign Assemblies [#911](https://github.com/belav/csharpier/issues/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](https://github.com/goelhardik/ignore)

#### Don't format files in obj folders [#910](https://github.com/belav/csharpier/pull/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](https://github.com/belav/csharpier/issues/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](https://github.com/belav/csharpier/issues/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](https://github.com/belav/csharpier/issues/891)
With `useTabs: true`, CSharpier was formatting multiline comments with a space instead of a tab.
```c#
// 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](https://github.com/belav/csharpier/issues/861)
CSharpier now adds an empty line after file scoped namespaces if there is not already one
```c#
// input
namespace Namespace;
using System;

// 0.25.0
namespace Namespace;

using System;
```

**Full Changelog**: https://github.com/belav/csharpier/compare/0.24.2...0.25.0
# 0.24.2
## What's Changed
#### csharpier-ignore comments force CRLF line endings [#884](https://github.com/belav/csharpier/issues/884)
Expand Down Expand Up @@ -1072,3 +1224,4 @@ Thanks go to @pingzing
- Implement Formatting Options with Configuration File [#10](https://github.com/belav/csharpier/issues/10)
**Full Changelog**: https://github.com/belav/csharpier/compare/0.9.0...0.9.1
21 changes: 21 additions & 0 deletions CSharpier.sln
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MsBuild", "Src\CSharpier.Ms
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpier.FakeGenerators", "Src\CSharpier.FakeGenerators\CSharpier.FakeGenerators.csproj", "{BD5D6F99-E1F8-4764-AE15-E70EF3F5CC43}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shell", "Shell\Shell.csproj", "{497B849B-044C-4350-BDE8-13CA3E6C7845}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Src", "Src", "{0D12A95B-A237-4181-937C-DF6D0265975E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -101,11 +105,28 @@ Global
{BD5D6F99-E1F8-4764-AE15-E70EF3F5CC43}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BD5D6F99-E1F8-4764-AE15-E70EF3F5CC43}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BD5D6F99-E1F8-4764-AE15-E70EF3F5CC43}.Release|Any CPU.Build.0 = Release|Any CPU
{497B849B-044C-4350-BDE8-13CA3E6C7845}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{497B849B-044C-4350-BDE8-13CA3E6C7845}.Debug|Any CPU.Build.0 = Debug|Any CPU
{497B849B-044C-4350-BDE8-13CA3E6C7845}.Release|Any CPU.ActiveCfg = Release|Any CPU
{497B849B-044C-4350-BDE8-13CA3E6C7845}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {00B535B6-778C-44D7-8DEC-0429BAAE4DC2}
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{F1DE8719-9961-4F83-8BE6-34639C96DA5E} = {0D12A95B-A237-4181-937C-DF6D0265975E}
{A338903F-69AD-4950-B827-8EE75F98B620} = {0D12A95B-A237-4181-937C-DF6D0265975E}
{F2BF106F-BB0A-44AC-8249-91BC53FFC83A} = {0D12A95B-A237-4181-937C-DF6D0265975E}
{FDCC2871-9003-4EB8-B714-5C7E50FD5D04} = {0D12A95B-A237-4181-937C-DF6D0265975E}
{BD5D6F99-E1F8-4764-AE15-E70EF3F5CC43} = {0D12A95B-A237-4181-937C-DF6D0265975E}
{D846F494-57FC-4315-A2A8-357343175D2E} = {0D12A95B-A237-4181-937C-DF6D0265975E}
{E7F03E73-82C7-4DB2-AF20-F25C45231A72} = {0D12A95B-A237-4181-937C-DF6D0265975E}
{A77E4297-FAA5-40AB-9856-ECF72AF5D859} = {0D12A95B-A237-4181-937C-DF6D0265975E}
{3E1D074B-A4F3-4010-84E7-820459214202} = {0D12A95B-A237-4181-937C-DF6D0265975E}
{19874634-1A44-4831-BB43-6E2B864AB3ED} = {0D12A95B-A237-4181-937C-DF6D0265975E}
{0B075DD3-1FEE-483E-8665-43C226188287} = {0D12A95B-A237-4181-937C-DF6D0265975E}
EndGlobalSection
EndGlobal
9 changes: 3 additions & 6 deletions Docs/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,14 @@ JSON
{
"printWidth": 100,
"useTabs": false,
"tabWidth": 4,
"preprocessorSymbolSets": ["", "DEBUG", "DEBUG,CODE_STYLE"]
"tabWidth": 4
}
```
YAML
```yaml
printWidth: 100
useTabs: false
tabWidth: 4
preprocessorSymbolSets:
- ""
- "DEBUG"
- "DEBUG,CODE_STYLE"
```
#### Print Width
Expand All @@ -47,6 +42,8 @@ Specify the number of spaces used per indentation level.
Default 4
#### Preprocessor Symbol Sets
**Removed in 0.25.0**
Currently CSharpier only has basic support for understanding how to format code inside of `#if` directives.
It will attempt to determine which sets of preprocessor symbols are needed for roslyn to parse all the code in each file.

Expand Down
6 changes: 3 additions & 3 deletions Nuget/Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>0.24.2</Version>
<Version>0.25.0</Version>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryUrl>https://github.com/belav/csharpier</RepositoryUrl>
<RepositoryType>git</RepositoryType>
Expand All @@ -9,6 +9,6 @@
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)\README.md" Pack="true" PackagePath="\"/>
<None Include="$(MSBuildThisFileDirectory)\README.md" Pack="true" PackagePath="\" />
</ItemGroup>
</Project>
</Project>
11 changes: 0 additions & 11 deletions Scripts/BuildPackages.ps1

This file was deleted.

45 changes: 0 additions & 45 deletions Scripts/ChangeLog.ps1

This file was deleted.

70 changes: 0 additions & 70 deletions Scripts/FormatForkedReposWithVersion.ps1

This file was deleted.

Loading

0 comments on commit ff73179

Please sign in to comment.