Skip to content

Commit a8a6683

Browse files
authored
Bumping up to 0.26.0 (#990)
1 parent 9f2673f commit a8a6683

29 files changed

+171
-119
lines changed

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"isRoot": true,
44
"tools": {
55
"csharpier": {
6-
"version": "0.25.0",
6+
"version": "0.26.0",
77
"commands": [
88
"dotnet-csharpier"
99
]

Src/CSharpier.Cli.Tests/CliTests.cs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ public async Task Should_Return_Error_When_No_DirectoryOrFile_And_Not_Piping_Std
131131
var result = await new CsharpierProcess().ExecuteAsync();
132132

133133
result.ExitCode.Should().Be(1);
134-
result.ErrorOutput
134+
result
135+
.ErrorOutput
135136
.Should()
136137
.Contain("directoryOrFile is required when not piping stdin to CSharpier");
137138
}
@@ -170,7 +171,8 @@ public async Task Should_Print_NotFound()
170171
var result = await new CsharpierProcess().WithArguments("/BasicFile.cs").ExecuteAsync();
171172

172173
result.Output.Should().BeEmpty();
173-
result.ErrorOutput
174+
result
175+
.ErrorOutput
174176
.Should()
175177
.StartWith("There was no file or directory found at /BasicFile.cs");
176178
result.ExitCode.Should().Be(1);
@@ -199,7 +201,8 @@ public async Task With_Check_Should_Write_Unformatted_File()
199201
.WithArguments("CheckUnformatted.cs --check")
200202
.ExecuteAsync();
201203

202-
result.ErrorOutput
204+
result
205+
.ErrorOutput
203206
.Replace("\\", "/")
204207
.Should()
205208
.StartWith("Error ./CheckUnformatted.cs - Was not formatted.");
@@ -242,7 +245,8 @@ public async Task Should_Write_Error_With_Multiple_Piped_Files(string input, str
242245
.WithPipedInput($"{input}{'\u0003'}{invalidFile}{'\u0003'}")
243246
.ExecuteAsync();
244247

245-
result.ErrorOutput
248+
result
249+
.ErrorOutput
246250
.Should()
247251
.Be(
248252
$"Error {output} - Failed to compile so was not formatted.{Environment.NewLine} (1,26): error CS1513: }} expected{Environment.NewLine}"
@@ -341,7 +345,8 @@ await this.WriteFileAsync(
341345

342346
var result = await new CsharpierProcess().WithArguments(".").ExecuteAsync();
343347

344-
result.ErrorOutput
348+
result
349+
.ErrorOutput
345350
.Should()
346351
.Contain("uses version 99 of CSharpier.MsBuild which is a mismatch with version");
347352
result.ExitCode.Should().Be(1);
@@ -504,7 +509,8 @@ public CsharpierProcess()
504509
{
505510
var path = Path.Combine(Directory.GetCurrentDirectory(), "dotnet-csharpier.dll");
506511

507-
this.command = CliWrap.Cli
512+
this.command = CliWrap
513+
.Cli
508514
.Wrap("dotnet")
509515
.WithArguments(path)
510516
.WithWorkingDirectory(testFileDirectory)

Src/CSharpier.Cli/CommandLineFormatter.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
using System.Text;
2-
using CSharpier.Cli.Options;
31
using System.Diagnostics;
42
using System.IO.Abstractions;
3+
using System.Text;
4+
using CSharpier.Cli.Options;
55
using CSharpier.Utilities;
66
using Microsoft.Extensions.Logging;
77

@@ -153,9 +153,9 @@ CancellationToken cancellationToken
153153
cancellationToken
154154
);
155155

156-
var originalDirectoryOrFile = commandLineOptions.OriginalDirectoryOrFilePaths[
157-
x
158-
].Replace("\\", "/");
156+
var originalDirectoryOrFile = commandLineOptions
157+
.OriginalDirectoryOrFilePaths[x]
158+
.Replace("\\", "/");
159159

160160
var formattingCache = await FormattingCacheFactory.InitializeAsync(
161161
commandLineOptions,
@@ -215,7 +215,8 @@ await FormatPhysicalFile(
215215
return 1;
216216
}
217217

218-
var tasks = fileSystem.Directory
218+
var tasks = fileSystem
219+
.Directory
219220
.EnumerateFiles(directoryOrFilePath, "*.cs", SearchOption.AllDirectories)
220221
.Select(o =>
221222
{

Src/CSharpier.Cli/EditorConfig/EditorConfigParser.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ IFileSystem fileSystem
2525

2626
while (directoryInfo is not null)
2727
{
28-
var file = fileSystem.FileInfo.FromFileName(
29-
fileSystem.Path.Combine(directoryInfo.FullName, ".editorconfig")
30-
);
28+
var file = fileSystem
29+
.FileInfo
30+
.FromFileName(fileSystem.Path.Combine(directoryInfo.FullName, ".editorconfig"));
3131
if (file.Exists)
3232
{
3333
editorConfigFiles.Add(file);

Src/CSharpier.Cli/FormattingCache.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,14 @@ public async Task ResolveAsync(CancellationToken cancellationToken)
148148

149149
async Task WriteFile()
150150
{
151-
await using var fileStream = this.fileSystem.File.Open(
152-
this.cacheFile,
153-
FileMode.OpenOrCreate,
154-
FileAccess.ReadWrite,
155-
FileShare.None
156-
);
151+
await using var fileStream = this.fileSystem
152+
.File
153+
.Open(
154+
this.cacheFile,
155+
FileMode.OpenOrCreate,
156+
FileAccess.ReadWrite,
157+
FileShare.None
158+
);
157159
await using var streamWriter = new StreamWriter(fileStream);
158160
await streamWriter.WriteAsync(
159161
JsonSerializer.Serialize(

Src/CSharpier.Cli/HasMismatchedCliAndMsBuildVersions.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,16 @@ public static class HasMismatchedCliAndMsBuildVersions
99
{
1010
public static bool Check(string directoryName, IFileSystem fileSystem, ILogger logger)
1111
{
12-
var csProjPaths = fileSystem.Directory
12+
var csProjPaths = fileSystem
13+
.Directory
1314
.EnumerateFiles(directoryName, "*.csproj", SearchOption.AllDirectories)
1415
.ToArray();
1516

16-
var versionOfDotnetTool = typeof(CommandLineFormatter).Assembly
17+
var versionOfDotnetTool = typeof(CommandLineFormatter)
18+
.Assembly
1719
.GetName()
18-
.Version!.ToString(3);
20+
.Version!
21+
.ToString(3);
1922

2023
string? GetPackagesVersion(string pathToCsProj)
2124
{

Src/CSharpier.Cli/IgnoreFile.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,9 @@ var line in await fileSystem.File.ReadAllLinesAsync(ignoreFilePath, cancellation
8686
var directoryInfo = fileSystem.DirectoryInfo.FromDirectoryName(baseDirectoryPath);
8787
while (directoryInfo != null)
8888
{
89-
var ignoreFilePath = fileSystem.Path.Combine(
90-
directoryInfo.FullName,
91-
".csharpierignore"
92-
);
89+
var ignoreFilePath = fileSystem
90+
.Path
91+
.Combine(directoryInfo.FullName, ".csharpierignore");
9392
if (fileSystem.File.Exists(ignoreFilePath))
9493
{
9594
return ignoreFilePath;

Src/CSharpier.Cli/PhysicalFileInfoAndWriter.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@ public void WriteResult(CodeFormatterResult result, FileToFormatInfo fileToForma
1515
{
1616
if (result.Code != fileToFormatInfo.FileContents)
1717
{
18-
this.FileSystem.File.WriteAllText(
19-
fileToFormatInfo.Path,
20-
result.Code,
21-
fileToFormatInfo.Encoding
22-
);
18+
this.FileSystem
19+
.File
20+
.WriteAllText(fileToFormatInfo.Path, result.Code, fileToFormatInfo.Encoding);
2321
}
2422
}
2523
}

Src/CSharpier.FakeGenerators/ValidNodeTypes.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ public static class ValidNodeTypes
77
{
88
public static IList<Type> Get()
99
{
10-
return typeof(CompilationUnitSyntax).Assembly
10+
return typeof(CompilationUnitSyntax)
11+
.Assembly
1112
.GetTypes()
1213
.Where(
1314
o =>

Src/CSharpier.Generators/NodePrinterGenerator.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ public class NodePrinterGenerator : TemplatedGenerator
1212

1313
protected override object GetModel(GeneratorExecutionContext context)
1414
{
15-
var nodeTypes = context.Compilation.SyntaxTrees
15+
var nodeTypes = context
16+
.Compilation
17+
.SyntaxTrees
1618
.Where(o => o.FilePath.Contains("SyntaxNodePrinters"))
1719
.Select(o => Path.GetFileNameWithoutExtension(o.FilePath))
1820
.Select(

0 commit comments

Comments
 (0)