Skip to content

Commit 577b9d8

Browse files
committed
CR for "Small refactorings" pull request
1 parent 482dccd commit 577b9d8

5 files changed

Lines changed: 6 additions & 6 deletions

File tree

StyleCop.Analyzers/StyleCop.Analyzers.Test/Settings/SettingsUnitTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ private static async Task<SyntaxTreeAnalysisContext> CreateAnalysisContextAsync(
157157
var additionalFiles = ImmutableArray.Create<AdditionalText>(stylecopJSONFile);
158158
var analyzerOptions = new AnalyzerOptions(additionalFiles);
159159

160-
return new SyntaxTreeAnalysisContext(syntaxTree, analyzerOptions, rd => { }, isd => true, CancellationToken.None);
160+
return new SyntaxTreeAnalysisContext(syntaxTree, analyzerOptions, rd => { }, isd => { return true; }, CancellationToken.None);
161161
}
162162

163163
private class AdditionalTextHelper : AdditionalText

StyleCop.Analyzers/StyleCop.Analyzers.Test/Verifiers/DiagnosticVerifier.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ private static string FormatDiagnostics(ImmutableArray<DiagnosticAnalyzer> analy
284284
{
285285
var diagnosticsId = diagnostics[i].Id;
286286

287-
builder.AppendLine("// " + diagnostics[i]);
287+
builder.Append("// ").AppendLine(diagnostics[i].ToString());
288288

289289
var applicableAnalyzer = analyzers.FirstOrDefault(a => a.SupportedDiagnostics.Any(dd => dd.Id == diagnosticsId));
290290
if (applicableAnalyzer != null)
@@ -300,7 +300,7 @@ private static string FormatDiagnostics(ImmutableArray<DiagnosticAnalyzer> analy
300300
{
301301
Assert.True(
302302
location.IsInSource,
303-
string.Format("Test base does not currently handle diagnostics in metadata locations. Diagnostic in metadata:{0}\r\n", diagnostics[i]));
303+
string.Format("Test base does not currently handle diagnostics in metadata locations. Diagnostic in metadata:\r\n{0}", diagnostics[i]));
304304

305305
string resultMethodName = diagnostics[i].Location.SourceTree.FilePath.EndsWith(".cs") ? "GetCSharpResultAt" : "GetBasicResultAt";
306306
var linePosition = diagnostics[i].Location.GetLineSpan().StartLinePosition;

StyleCop.Analyzers/StyleCop.Analyzers/Helpers/NamedTypeHelpers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ internal static bool IsImplementingAnInterfaceMember(ISymbol memberSymbol)
149149
return typeSymbol != null && typeSymbol.AllInterfaces
150150
.SelectMany(m => m.GetMembers(memberSymbol.Name))
151151
.Select(typeSymbol.FindImplementationForInterfaceMember)
152-
.Any(memberSymbol.Equals);
152+
.Any(x => memberSymbol.Equals(x));
153153
}
154154
}
155155
}

StyleCop.Analyzers/StyleCop.Analyzers/MaintainabilityRules/SA1407SA1408FixAllProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ protected override async Task<SyntaxNode> FixAllInDocumentAsync(FixAllContext fi
3838
nodes.Add(node);
3939
}
4040

41-
return root.ReplaceNodes(nodes, AddParentheses);
41+
return root.ReplaceNodes(nodes, (originalNode, rewrittenNode) => AddParentheses(originalNode, rewrittenNode));
4242
}
4343

4444
private static SyntaxNode AddParentheses(SyntaxNode originalNode, SyntaxNode rewrittenNode)

StyleCop.Analyzers/StyleCop.Analyzers/OrderingRules/UsingCodeFixProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ private List<UsingDirectiveSyntax> FilterRelevantUsings(Dictionary<DirectiveSpan
705705
return EmptyUsingsList;
706706
}
707707

708-
return groupList.Where(usingsList.Contains).ToList();
708+
return groupList.Where(u => usingsList.Contains(u)).ToList();
709709
}
710710
}
711711

0 commit comments

Comments
 (0)