Skip to content

Commit fb95ae4

Browse files
committed
Reformat and cleanup
1 parent 6ef6a21 commit fb95ae4

File tree

9 files changed

+44
-55
lines changed

9 files changed

+44
-55
lines changed

Roslyn.Testing/Analyzer/CSharpDiagnosticAnalyzerTest.cs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,11 @@ public abstract class CSharpDiagnosticAnalyzerTest<T> : FileReaderTest
3333
/// DiagnosticResults that should appear after the analyzer
3434
/// is run on the source
3535
/// </param>
36-
protected void VerifyDiagnostic(string source, DiagnosticResult[] expected) => VerifyDiagnostic([
37-
source
38-
], expected);
36+
protected void VerifyDiagnostic(string source, DiagnosticResult[] expected) => VerifyDiagnostic([source], expected);
3937

40-
protected void VerifyDiagnostic(string source, DiagnosticResult expected) => VerifyDiagnostic([
41-
source
42-
], [
43-
expected
44-
]);
38+
protected void VerifyDiagnostic(string source, DiagnosticResult expected) => VerifyDiagnostic([source], [expected]);
4539

46-
protected void VerifyNoDiagnosticTriggered(string source) => VerifyDiagnostic([
47-
source
48-
], []);
40+
protected void VerifyNoDiagnosticTriggered(string source) => VerifyDiagnostic([source], []);
4941

5042
/// <summary>
5143
/// Called to test a C# DiagnosticAnalyzer when applied on the inputted strings as

Roslyn.Testing/Analyzer/DiagnosticVerifier.Helpers.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,9 @@ private static Document[] GetDocuments(string[] sources, string language, IEnume
172172
/// <param name="references"></param>
173173
/// <returns> A Document created from the source string </returns>
174174
protected static Document CreateDocument(string source, string language = LanguageNames.CSharp,
175-
IEnumerable<MetadataReference> references = null) => CreateProject([
176-
source
177-
], language, references)
178-
.Documents.First();
175+
IEnumerable<MetadataReference> references = null) =>
176+
CreateProject([source], language, references)
177+
.Documents.First();
179178

180179
/// <summary>
181180
/// Create a project using the inputted strings as sources.

Roslyn.Testing/Analyzer/DiagnosticVerifier.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,7 @@ private static Document[] GetDocuments(string[] sources, string language, IEnume
171171
/// <param name="references"></param>
172172
/// <returns> A Document created from the source string </returns>
173173
public static Document CreateDocument(string source, string language, IEnumerable<MetadataReference> references = null) =>
174-
CreateProject([
175-
source
176-
], language, references)
174+
CreateProject([source], language, references)
177175
.Documents.First();
178176

179177
/// <summary>

Roslyn.Testing/CodeFix/CodeFixProviderTestExtensions.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,7 @@ public static VerifyCodeFixProviderResult VerifyFix(this CodeFixProvider codeFix
8181
{
8282
var document = DiagnosticAnalyzerTestExtensions.CreateDocument(oldSource, language, additionalReferences);
8383

84-
var analyzerDiagnostics = analyzer.GetSortedDiagnosticsFromDocuments([
85-
document
86-
]);
84+
var analyzerDiagnostics = analyzer.GetSortedDiagnosticsFromDocuments([document]);
8785

8886
var compilerDiagnostics = document.GetCompilerDiagnostics();
8987
var attempts = analyzerDiagnostics.Length;
@@ -111,9 +109,7 @@ public static VerifyCodeFixProviderResult VerifyFix(this CodeFixProvider codeFix
111109

112110
document = document.ApplyFix(actions.ElementAt(0));
113111

114-
analyzerDiagnostics = analyzer.GetSortedDiagnosticsFromDocuments([
115-
document
116-
]);
112+
analyzerDiagnostics = analyzer.GetSortedDiagnosticsFromDocuments([document]);
117113

118114
var newCompilerDiagnostics = GetNewDiagnostics(compilerDiagnostics, document.GetCompilerDiagnostics());
119115

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<PropertyGroup>
4-
<TargetFramework>netstandard2.0</TargetFramework>
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.0</TargetFramework>
55
<LangVersion>latest</LangVersion>
6-
</PropertyGroup>
6+
</PropertyGroup>
77

8-
<ItemGroup>
9-
<PackageReference Include="JetBrains.Annotations" Version="2025.2.2" />
10-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.14.0" />
11-
<PackageReference Include="Shouldly" Version="4.3.0" />
12-
</ItemGroup>
8+
<ItemGroup>
9+
<PackageReference Include="JetBrains.Annotations" Version="2025.2.2"/>
10+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.14.0"/>
11+
<PackageReference Include="Shouldly" Version="4.3.0"/>
12+
</ItemGroup>
1313

1414
</Project>

System.IO.Abstractions.Analyzers.Tests/System.IO.Abstractions.Analyzers.Tests.csproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
11-
<PackageReference Include="System.IO.Abstractions" Version="22.0.16" />
12-
<PackageReference Include="xunit" Version="2.9.3" />
10+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1"/>
11+
<PackageReference Include="System.IO.Abstractions" Version="22.0.16"/>
12+
<PackageReference Include="xunit" Version="2.9.3"/>
1313
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4">
14-
<PrivateAssets>all</PrivateAssets>
15-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
14+
<PrivateAssets>all</PrivateAssets>
15+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1616
</PackageReference>
1717
</ItemGroup>
1818

1919
<ItemGroup>
20-
<ProjectReference Include="..\Roslyn.Testing\Roslyn.Testing.csproj" />
21-
<ProjectReference Include="..\System.IO.Abstractions.Analyzers\System.IO.Abstractions.Analyzers.csproj" />
20+
<ProjectReference Include="..\Roslyn.Testing\Roslyn.Testing.csproj"/>
21+
<ProjectReference Include="..\System.IO.Abstractions.Analyzers\System.IO.Abstractions.Analyzers.csproj"/>
2222
</ItemGroup>
2323
<ItemGroup>
24-
<None Update="TestData\**\*.*" CopyToOutputDirectory="Always" />
24+
<None Update="TestData\**\*.*" CopyToOutputDirectory="Always"/>
2525
</ItemGroup>
2626

2727
</Project>

System.IO.Abstractions.Analyzers/Analyzers/BaseFileSystemNodeAnalyzer.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ protected override void AnalyzeCompilation(CompilationStartAnalysisContext compi
1515
{
1616
var invocationOperation = (IInvocationOperation) operationContext.Operation;
1717

18-
if (IsFileSystemType(invocationOperation.TargetMethod.ContainingType, GetFileSystemTypeSymbol(compilationStartContext.Compilation)))
18+
if (IsFileSystemType(invocationOperation.TargetMethod.ContainingType,
19+
GetFileSystemTypeSymbol(compilationStartContext.Compilation)))
1920
{
2021
Analyze(operationContext, invocationOperation);
2122
}
@@ -38,7 +39,8 @@ protected override void AnalyzeCompilation(CompilationStartAnalysisContext compi
3839

3940
protected abstract Type GetFileSystemType();
4041

41-
private INamedTypeSymbol GetFileSystemTypeSymbol(Compilation compilation) => compilation.GetTypeByMetadataName(GetFileSystemType().FullName);
42+
private INamedTypeSymbol GetFileSystemTypeSymbol(Compilation compilation) => compilation.GetTypeByMetadataName(GetFileSystemType()
43+
.FullName);
4244

4345
private static bool IsFileSystemType(ITypeSymbol typeSymbol, INamedTypeSymbol fileSystemType)
4446
{
@@ -53,6 +55,9 @@ private static bool IsFileSystemType(ITypeSymbol typeSymbol, INamedTypeSymbol fi
5355
protected static bool IsFirstConstructorParameterOfType<T>(OperationAnalysisContext context, IOperation operation)
5456
{
5557
var parameterTypeSymbol = context.Compilation.GetTypeByMetadataName(typeof(T).FullName);
56-
return (operation as IObjectCreationOperation)?.Arguments.FirstOrDefault()?.Parameter?.Type?.Equals(parameterTypeSymbol, SymbolEqualityComparer.Default) ?? false;
58+
59+
return (operation as IObjectCreationOperation)?.Arguments.FirstOrDefault()
60+
?.Parameter?.Type?.Equals(parameterTypeSymbol, SymbolEqualityComparer.Default)
61+
?? false;
5762
}
5863
}

System.IO.Abstractions.Analyzers/CodeActions/DirectoryInfoCodeAction.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ protected override async Task<Document> GetChangedDocumentAsync(CancellationToke
5050
var arguments = _creationExpressionSyntax.ArgumentList.Arguments.Select(x => x.ToFullString());
5151

5252
editor.ReplaceNode(_creationExpressionSyntax,
53-
SF.ParseExpression(
54-
$"{_field.Declaration.Variables.ToFullString()}.DirectoryInfo.New({string.Join(",", arguments)})"));
53+
SF.ParseExpression($"{_field.Declaration.Variables.ToFullString()}.DirectoryInfo.New({string.Join(",", arguments)})"));
5554

5655
return await Formatter.FormatAsync(editor.GetChangedDocument(), cancellationToken: cancellationToken)
5756
.ConfigureAwait(false);

System.IO.Abstractions.Analyzers/System.IO.Abstractions.Analyzers.csproj

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,21 @@
2727
<PackageIcon>icon_256x256.png</PackageIcon>
2828
</PropertyGroup>
2929
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
30-
<Optimize>false</Optimize>
30+
<Optimize>false</Optimize>
3131
</PropertyGroup>
3232
<ItemGroup>
33-
<PackageReference Include="JetBrains.Annotations" Version="2025.2.2" PrivateAssets="all" />
34-
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0" PrivateAssets="all" />
35-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.14.0" PrivateAssets="all" />
36-
<PackageReference Update="NETStandard.Library" PrivateAssets="all" />
37-
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="9.0.0" PrivateAssets="all" />
38-
<PackageReference Include="Roslyn.Diagnostics.Analyzers" Version="3.3.4" PrivateAssets="all" />
33+
<PackageReference Include="JetBrains.Annotations" Version="2025.2.2" PrivateAssets="all"/>
34+
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0" PrivateAssets="all"/>
35+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.14.0" PrivateAssets="all"/>
36+
<PackageReference Update="NETStandard.Library" PrivateAssets="all"/>
37+
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="9.0.0" PrivateAssets="all"/>
38+
<PackageReference Include="Roslyn.Diagnostics.Analyzers" Version="3.3.4" PrivateAssets="all"/>
3939
</ItemGroup>
4040
<ItemGroup>
41-
<None Update="tools\*.ps1" CopyToOutputDirectory="Always" Pack="true" PackagePath="" />
42-
<None Include="$(OutputPath)\$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
41+
<None Update="tools\*.ps1" CopyToOutputDirectory="Always" Pack="true" PackagePath=""/>
42+
<None Include="$(OutputPath)\$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false"/>
4343
</ItemGroup>
4444
<ItemGroup>
45-
<None Include="..\icon_256x256.png" Pack="true" PackagePath="\" />
45+
<None Include="..\icon_256x256.png" Pack="true" PackagePath="\"/>
4646
</ItemGroup>
4747
</Project>

0 commit comments

Comments
 (0)