Skip to content

Commit

Permalink
Merge branch 'main' into sort-usings
Browse files Browse the repository at this point in the history
  • Loading branch information
belav committed Oct 26, 2023
2 parents c7d7165 + 4e4bb4d commit 6802f6f
Show file tree
Hide file tree
Showing 22 changed files with 406 additions and 176 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/format_repositories.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ jobs:
- uses: actions/checkout@v2
with:
path: csharpier
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0.304'
- uses: actions/setup-dotnet@v3
- uses: actions/checkout@v2
with:
repository: belav/csharpier-repos
Expand Down
12 changes: 2 additions & 10 deletions .github/workflows/publish_nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ jobs:
name: test
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: |
7.0.304
6.0.300
- uses: actions/setup-dotnet@v3
- run: >
dotnet test Src/CSharpier.Tests/CSharpier.Tests.csproj
--configuration Release
Expand All @@ -29,11 +25,7 @@ jobs:
NUGET_KEY: ${{secrets.NUGET_API_KEY}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: |
7.0.304
6.0.300
- uses: actions/setup-dotnet@v3
- name: Publish CSharpier.Core library on version change
uses: alirezanet/publish-nuget@v3.0.4
with:
Expand Down
18 changes: 3 additions & 15 deletions .github/workflows/validate_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ jobs:
name: Run Tests
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: |
7.0.304
6.0.300
- uses: actions/setup-dotnet@v3
- run: >
dotnet test CSharpier.sln
--configuration Release
Expand All @@ -25,11 +21,7 @@ jobs:
name: Check Formatting
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: |
7.0.304
6.0.300
- uses: actions/setup-dotnet@v3
- run: |
dotnet tool restore
dotnet csharpier . --check
Expand All @@ -38,10 +30,6 @@ jobs:
name: Build CSharpier.MSBuild
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: |
7.0.304
6.0.300
- uses: actions/setup-dotnet@v3
- run: |
dotnet build Src/CSharpier.MsBuild/CSharpier.MsBuild.csproj
10 changes: 5 additions & 5 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
<PackageVersion Include="Ignore" Version="0.1.48" />
<PackageVersion Include="ini-parser-netstandard" Version="2.5.2" />
<PackageVersion Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="5.0.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="4.6.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.6.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="4.7.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.7.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="3.3.4" />
<PackageVersion Include="Microsoft.CSharp" Version="4.5.0" />
<PackageVersion Include="Microsoft.CSharp" Version="4.7.0" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="5.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageVersion Include="NUnit" Version="3.12.0" />
Expand All @@ -29,8 +29,8 @@
<PackageVersion Include="System.IO.Abstractions.TestingHelpers" Version="13.2.29" />
<PackageVersion Include="System.IO.Hashing" Version="7.0.0-preview.7.22375.6" />
<PackageVersion Include="System.Text.Encoding.CodePages" Version="7.0.0" />
<PackageVersion Include="System.Text.Json" Version="7.0.0" />
<PackageVersion Include="System.Text.Json" Version="7.0.3" />
<PackageVersion Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
<PackageVersion Include="YamlDotNet" Version="11.1.1" />
<PackageVersion Include="YamlDotNet" Version="13.4.0" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:7.0.304 AS build
FROM mcr.microsoft.com/dotnet/sdk:7.0.400 AS build

RUN apt-get update && \
apt-get install curl gnupg -yq && \
Expand Down
65 changes: 0 additions & 65 deletions Scripts/UpdateCSharpierRepos.ps1

This file was deleted.

93 changes: 93 additions & 0 deletions Shell/UpdateCSharpierRepos.psm1
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
function CSH-UpdateCSharpierRepos()
{

$repositories = @()
$repositories += "https://github.com/dotnet/aspnetcore.git"
$repositories += "https://github.com/aspnet/AspNetWebStack.git"
$repositories += "https://github.com/AutoMapper/AutoMapper.git"
$repositories += "https://github.com/castleproject/Core.git"
$repositories += "https://github.com/dotnet/command-line-api.git"
$repositories += "https://github.com/dotnet/format.git"
$repositories += "https://github.com/dotnet/efcore.git"
$repositories += "https://github.com/moq/moq4.git"
$repositories += "https://github.com/JamesNK/Newtonsoft.Json.git"
$repositories += "https://github.com/dotnet/roslyn.git"
$repositories += "https://github.com/dotnet/runtime.git"
$repositories += "https://github.com/mono/mono.git"
$repositories += "https://github.com/increase-POS/Res-Server.git"

$tempLocation = "c:\temp\UpdateRepos"

if (-not(Test-Path $tempLocation))
{
New-Item $tempLocation -Force -ItemType Directory
}

Set-Location $tempLocation

$ErrorActionPreference = "Continue"

foreach ($repository in $repositories)
{
$repoFolder = $tempLocation + "/" + (Split-Path $repositories -Leaf).Replace(".git", "")
if (Test-Path $repoFolder)
{
Set-Location $repoFolder
& git pull origin
Set-Location $tempLocation
}
else
{
& git clone $repository
}
}

$destination = "C:\projects\csharpier-repos\"
Set-Location $destination
& git checkout main

Get-ChildItem $tempLocation | Copy-Item -Destination $destination -Filter *.cs -Recurse -Force

$items = Get-ChildItem -Recurse C:\projects\csharpier-repos -File
$count = 0
foreach ($item in $items)
{
if ($item.Name -eq ".git")
{
Remove-Item -Force -Recurse $item.FullName
}
elseif ($item.Extension -ne ".cs")
{
if ($item.Name -ne ".csharpierignore")
{
Remove-Item $item.FullName
}
}
else
{
# we don't really need all of these files, let's just cut out every other one
if ($count % 2 -eq 0)
{
Remove-Item $item.FullName
}
$count++
}
}

$items = Get-ChildItem C:\projects\csharpier-repos -Directory -Recurse
foreach ($item in $items)
{
if ($item.Name -eq ".git")
{
Remove-Item -Force -Recurse $item.FullName
}
}

Set-Location $destination

& git add .
& git commit -m "Updating repos"
& git push origin
}

Export-ModuleMember -Function CSH-*
1 change: 0 additions & 1 deletion Src/CSharpier.Cli/EditorConfig/EditorConfigParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ IFileSystem fileSystem
{
var configFile = ConfigFileParser.Parse(potentialPath, fileSystem);

DebugLogger.Log(potentialPath);
yield return configFile;
if (configFile.IsRoot)
{
Expand Down
1 change: 0 additions & 1 deletion Src/CSharpier.Cli/FormattingCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ public bool CanSkipFormatting(FileToFormatInfo fileToFormatInfo)
var currentHash = Hash(fileToFormatInfo.FileContents) + this.optionsHash;
if (this.cacheDictionary.TryGetValue(fileToFormatInfo.Path, out var cachedHash))
{
DebugLogger.Log(fileToFormatInfo.Path + " " + currentHash + " " + cachedHash);
if (currentHash == cachedHash)
{
return true;
Expand Down
2 changes: 0 additions & 2 deletions Src/CSharpier.Cli/IgnoreFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ public static async Task<IgnoreFile> Create(
CancellationToken cancellationToken
)
{
DebugLogger.Log("Creating ignore file for " + baseDirectoryPath);

var ignore = new Ignore.Ignore();

foreach (var name in alwaysIgnored)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
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]
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
var x = someLongNameField
.CallMethod____________________________________()
.AccessArray[1]
.Property_______________;

var x = someLongNameField
.CallMethod____________________________________()
.CallMethod(1)
.Property_______________;

new Action(AssertConfigurationIsValid)
.ShouldThrow<AutoMapperConfigurationException>()
.Errors[0]
.UnmappedPropertyNames[0]
.ShouldBe(nameof(Destination.Count));
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
var someVariable = someObject
.Property
.CallMethod(someValue => someValue.SomeProperty == someOtherValue___________________________);

var someVariable = someObject
.Property()
.CallMethod(someValue => someValue.SomeProperty == someOtherValue___________________________);

var someVariable = someObject
.Property
.CallMethod(someValue => someValue.SomeProperty == someOtherValue___________________________)
.CallMethod();

var someVariable = someObject
.Property()
.CallMethod(someValue => someValue.SomeProperty == someOtherValue___________________________)
.CallMethod();

// TODO too hard to change this for now, will do it in https://github.com/belav/csharpier/issues/451
var someVariable = this.Property.CallMethod(
someValue => someValue.SomeProperty == someOtherValue___________________________
);

var someVariable = this.Property()
.CallMethod(someValue => someValue.SomeProperty == someOtherValue___________________________);

var someVariable = this.Property
.CallMethod(someValue => someValue.SomeProperty == someOtherValue___________________________)
.CallMethod();

var someVariable = this.Property()
.CallMethod(someValue => someValue.SomeProperty == someOtherValue___________________________)
.CallMethod();
Loading

0 comments on commit 6802f6f

Please sign in to comment.