Skip to content

Commit ceccdc8

Browse files
Run code cleanup
1 parent fd59d0f commit ceccdc8

15 files changed

Lines changed: 55 additions & 44 deletions

IntelliTect.Analyzer/IntelliTect.Analyzer.Integration.Tests/AnalyzerTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ static AnalyzerTests()
2323
[TestMethod]
2424
public async Task RunOnSelf()
2525
{
26-
await ProcessProject(new FileInfo(Path.Combine("..", "..", "..", "..", "IntelliTect.Analyzer","IntelliTect.Analyzer.csproj")))
26+
await ProcessProject(new FileInfo(Path.Combine("..", "..", "..", "..", "IntelliTect.Analyzer", "IntelliTect.Analyzer.csproj")))
2727
.ConfigureAwait(false);
2828
}
2929

IntelliTect.Analyzer/IntelliTect.Analyzer.Test/Helpers/CodeFixVerifier.Helper.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
using Microsoft.CodeAnalysis;
2-
using Microsoft.CodeAnalysis.CodeActions;
3-
using Microsoft.CodeAnalysis.Formatting;
4-
using Microsoft.CodeAnalysis.Simplification;
51
using System.Collections.Generic;
62
using System.Linq;
73
using System.Threading;
84
using System.Threading.Tasks;
5+
using Microsoft.CodeAnalysis;
6+
using Microsoft.CodeAnalysis.CodeActions;
7+
using Microsoft.CodeAnalysis.Formatting;
8+
using Microsoft.CodeAnalysis.Simplification;
99

1010
namespace TestHelper
1111
{

IntelliTect.Analyzer/IntelliTect.Analyzer.Test/Helpers/DiagnosticResult.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
using Microsoft.CodeAnalysis;
21
using System;
2+
using Microsoft.CodeAnalysis;
33

44
namespace TestHelper
55
{
@@ -36,9 +36,9 @@ public DiagnosticResultLocation(string path, int line, int column)
3636
public struct DiagnosticResult
3737
{
3838
private DiagnosticResultLocation[] _Locations;
39-
39+
4040
#pragma warning disable CA1819 // Properties should not return arrays
41-
41+
4242
public DiagnosticResultLocation[] Locations
4343
{
4444
get
@@ -52,7 +52,7 @@ public DiagnosticResultLocation[] Locations
5252
_Locations = value;
5353
}
5454
}
55-
55+
5656
#pragma warning restore CA1819 // Properties should not return arrays
5757

5858
public DiagnosticSeverity Severity { get; set; }

IntelliTect.Analyzer/IntelliTect.Analyzer.Test/Helpers/DiagnosticVerifier.Helper.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
using Microsoft.CodeAnalysis;
2-
using Microsoft.CodeAnalysis.CSharp;
3-
using Microsoft.CodeAnalysis.Diagnostics;
4-
using Microsoft.CodeAnalysis.Text;
51
using System;
62
using System.Collections.Generic;
73
using System.Collections.Immutable;
84
using System.Linq;
5+
using Microsoft.CodeAnalysis;
6+
using Microsoft.CodeAnalysis.CSharp;
7+
using Microsoft.CodeAnalysis.Diagnostics;
8+
using Microsoft.CodeAnalysis.Text;
99

1010
namespace TestHelper
1111
{
@@ -52,7 +52,7 @@ protected static Diagnostic[] GetSortedDiagnosticsFromDocuments(DiagnosticAnalyz
5252
{
5353
throw new ArgumentNullException(nameof(documents));
5454
}
55-
55+
5656
var projects = new HashSet<Project>();
5757
foreach (Document document in documents)
5858
{

IntelliTect.Analyzer/IntelliTect.Analyzer.Test/NamingFieldPascalUnderscoreTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class TypeName
118118

119119
VerifyCSharpDiagnostic(test, expected);
120120
}
121-
121+
122122
[TestMethod]
123123
public void FieldWithNamingViolation_FieldTwoLeadingUnderScores_Warning()
124124
{
@@ -224,7 +224,7 @@ class TypeName
224224
}";
225225
await VerifyCSharpFix(test, fixTest);
226226
}
227-
227+
228228
[TestMethod]
229229
public async Task FieldTwoLeadingUnderScores_CodeFix_FixNamingViolation_FieldIsNamedCorrectly()
230230
{
@@ -368,7 +368,7 @@ void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object
368368

369369
VerifyCSharpDiagnostic(test);
370370
}
371-
371+
372372
[TestMethod]
373373
[Description("Issue 14")]
374374
public void FieldWithNamingViolation_ClassHasGeneratedCodeAttribute_Ignored()
@@ -392,7 +392,7 @@ class TypeName
392392

393393
VerifyCSharpDiagnostic(test);
394394
}
395-
395+
396396
[TestMethod]
397397
[Description("Issue 14")]
398398
public void FieldWithNamingViolation_FieldHasGeneratedCodeAttribute_Ignored()

IntelliTect.Analyzer/IntelliTect.Analyzer.Test/UnusedLocalVariableTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public void Foo()
117117
var expected = new DiagnosticResult
118118
{
119119
Id = Analyzers.UnusedLocalVariable.DiagnosticId,
120-
Message = "Local variable 'foo' should be used",
120+
Message = "Local variable 'foo' should be used",
121121
Severity = DiagnosticSeverity.Info,
122122
Locations = new[]
123123
{

IntelliTect.Analyzer/IntelliTect.Analyzer.Test/Verifiers/CodeFixVerifier.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading;
5+
using System.Threading.Tasks;
26
using Microsoft.CodeAnalysis;
37
using Microsoft.CodeAnalysis.CodeActions;
48
using Microsoft.CodeAnalysis.CodeFixes;
59
using Microsoft.CodeAnalysis.Diagnostics;
610
using Microsoft.CodeAnalysis.Formatting;
711
using Microsoft.VisualStudio.TestTools.UnitTesting;
8-
using System.Collections.Generic;
9-
using System.Linq;
10-
using System.Threading;
11-
using System.Threading.Tasks;
1212

1313
namespace TestHelper
1414
{
@@ -109,7 +109,7 @@ private static async Task VerifyFix(string language, DiagnosticAnalyzer analyzer
109109
document = document.WithSyntaxRoot(Formatter.Format(document.GetSyntaxRootAsync().Result, Formatter.Annotation, document.Project.Solution.Workspace));
110110
newCompilerDiagnostics = GetNewDiagnostics(compilerDiagnostics, GetCompilerDiagnostics(document));
111111

112-
Assert.Fail($"Fix introduced new compiler diagnostics:{string.Join(Environment.NewLine, newCompilerDiagnostics.Select(d => d.ToString()))}" +
112+
Assert.Fail($"Fix introduced new compiler diagnostics:{string.Join(Environment.NewLine, newCompilerDiagnostics.Select(d => d.ToString()))}" +
113113
$"{Environment.NewLine}{Environment.NewLine}New document:{Environment.NewLine}{document.GetSyntaxRootAsync().Result.ToFullString()}{Environment.NewLine}");
114114
}
115115

@@ -123,7 +123,7 @@ private static async Task VerifyFix(string language, DiagnosticAnalyzer analyzer
123123
//after applying all of the code fixes, compare the resulting string to the inputted one
124124
string actual = GetStringFromDocument(document);
125125
Assert.AreEqual<string>(
126-
newSource?.Replace("\r","",StringComparison.InvariantCulture),
126+
newSource?.Replace("\r", "", StringComparison.InvariantCulture),
127127
actual?.Replace("\r", "", StringComparison.InvariantCulture));
128128
}
129129
}

IntelliTect.Analyzer/IntelliTect.Analyzer.Test/Verifiers/DiagnosticVerifier.cs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
using System;
2-
using Microsoft.CodeAnalysis;
2+
using System.Collections.Generic;
3+
4+
/* Unmerged change from project 'IntelliTect.Analyzer.Tests (net6.0)'
5+
Before:
36
using Microsoft.CodeAnalysis.CSharp;
47
using Microsoft.CodeAnalysis.Diagnostics;
58
using Microsoft.VisualStudio.TestTools.UnitTesting;
6-
using System.Collections.Generic;
9+
After:
10+
using Microsoft.Linq;
11+
using System.Text;
12+
using Microsoft.CodeAnalysis;
13+
using Microsoft.CodeAnalysis.CSharp;
14+
*/
715
using System.Linq;
816
using System.Text;
17+
using Microsoft.CodeAnalysis;
18+
using Microsoft.CodeAnalysis.Diagnostics;
19+
using Microsoft.VisualStudio.TestTools.UnitTesting;
920

1021
namespace TestHelper
1122
{
@@ -176,8 +187,8 @@ private static void VerifyDiagnosticLocation(DiagnosticAnalyzer analyzer, Diagno
176187
{
177188
FileLinePositionSpan actualSpan = actual.GetLineSpan();
178189

179-
Assert.IsTrue(actualSpan.Path == expected.Path || (actualSpan.Path != null
180-
&& actualSpan.Path.Contains("Test0.", StringComparison.Ordinal)
190+
Assert.IsTrue(actualSpan.Path == expected.Path || (actualSpan.Path != null
191+
&& actualSpan.Path.Contains("Test0.", StringComparison.Ordinal)
181192
&& expected.Path.Contains("Test.", StringComparison.Ordinal)),
182193
string.Format("Expected diagnostic to be in file \"{0}\" was actually in file \"{1}\"\r\n\r\nDiagnostic:\r\n {2}\r\n",
183194
expected.Path, actualSpan.Path, FormatDiagnostics(analyzer, diagnostic)));

IntelliTect.Analyzer/IntelliTect.Analyzer/AnalyzerBlockMixins.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ private static string GetEnumAttributeValue<TAttribute>(Enum value, Func<TAttrib
1010
{
1111
FieldInfo fi = value.GetType().GetRuntimeField(value.ToString());
1212

13-
var attributes = (TAttribute[]) fi?.GetCustomAttributes(typeof(TAttribute), false);
13+
var attributes = (TAttribute[])fi?.GetCustomAttributes(typeof(TAttribute), false);
1414

1515
return attributes?.Length > 0 ? valueAccessor(attributes[0]) : null;
1616
}

IntelliTect.Analyzer/IntelliTect.Analyzer/Analyzers/AsyncVoid.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class AsyncVoid : DiagnosticAnalyzer
1616
private static readonly string _HelpLinkUri = DiagnosticUrlBuilder.GetUrl(Title,
1717
DiagnosticId);
1818

19-
private static readonly DiagnosticDescriptor _Rule = new(DiagnosticId, Title, MessageFormat,
19+
private static readonly DiagnosticDescriptor _Rule = new(DiagnosticId, Title, MessageFormat,
2020
Category, DiagnosticSeverity.Warning, isEnabledByDefault: true, description: Description, _HelpLinkUri);
2121

2222
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(_Rule);
@@ -27,7 +27,7 @@ public override void Initialize(AnalysisContext context)
2727
{
2828
throw new ArgumentNullException(nameof(context));
2929
}
30-
30+
3131
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.Analyze | GeneratedCodeAnalysisFlags.ReportDiagnostics);
3232
context.EnableConcurrentExecution();
3333
context.RegisterSymbolAction(AnalyzeSymbol, SymbolKind.Method);

0 commit comments

Comments
 (0)