Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: DotNetAnalyzers/StyleCopAnalyzers
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.2.0-beta.507
Choose a base ref
...
head repository: DotNetAnalyzers/StyleCopAnalyzers
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1.2.0-beta.553
Choose a head ref

Commits on Jan 7, 2019

  1. Copy the full SHA
    df70004 View commit details

Commits on Mar 6, 2023

  1. Copy the full SHA
    f8f0b4b View commit details

Commits on Mar 29, 2023

  1. Generate IOperationWrapper

    sharwell committed Mar 29, 2023
    Copy the full SHA
    9b5db19 View commit details

Commits on Jun 24, 2023

  1. Copy the full SHA
    e098ddc View commit details

Commits on Jun 26, 2023

  1. Merge pull request #3674 from bjornhellander/feature/sa1011-case-list…

    …-pattern
    
    Update SA1011 to forbid trailing space before the end of a switch case
    sharwell authored Jun 26, 2023
    Copy the full SHA
    0f30141 View commit details

Commits on Jul 1, 2023

  1. Copy the full SHA
    58dbaed View commit details
  2. Copy the full SHA
    2406656 View commit details
  3. Improve coverage for SA1300 by changing a test to verify a property (…

    …instead of a field) in a native methods class, since this analyzer does not handle fields
    bjornhellander committed Jul 1, 2023
    Copy the full SHA
    487935c View commit details
  4. Copy the full SHA
    88cf7a1 View commit details
  5. Copy the full SHA
    db6febe View commit details
  6. Copy the full SHA
    eb324ac View commit details
  7. Copy the full SHA
    120a6a5 View commit details
  8. Copy the full SHA
    7885adb View commit details
  9. Copy the full SHA
    92d66c6 View commit details

Commits on Jul 6, 2023

  1. Merge pull request #3611 from sharwell/operation-wrapper

    Rewrite IOperationWrapper as a wrapper structure around IOperation
    sharwell authored Jul 6, 2023
    Copy the full SHA
    b209e4e View commit details

Commits on Aug 13, 2023

  1. Copy the full SHA
    551d825 View commit details

Commits on Sep 1, 2023

  1. Copy the full SHA
    8eb1db3 View commit details
  2. Copy the full SHA
    a6e0440 View commit details
  3. Copy the full SHA
    d45ce58 View commit details

Commits on Sep 11, 2023

  1. Copy the full SHA
    4ba311b View commit details

Commits on Sep 12, 2023

  1. Merge pull request #3694 from sharwell/sa1202-more-types

    Update SA1202 to support interfaces (C# 8) and records (C# 9, 10)
    sharwell authored Sep 12, 2023
    Copy the full SHA
    890236e View commit details

Commits on Sep 18, 2023

  1. Copy the full SHA
    fce493b View commit details
  2. Update SA1642 and its code fix to handle record structs correctly. Al…

    …so add tests for records and record classes.
    
    #3518
    bjornhellander committed Sep 18, 2023
    Copy the full SHA
    472780c View commit details
  3. Merge pull request #3697 from bjornhellander/feature/sa1308-doc

    Update documentation for SA1308 to also mention prefix "t_"
    sharwell authored Sep 18, 2023
    Copy the full SHA
    af76eb5 View commit details

Commits on Sep 27, 2023

  1. Merge pull request #3696 from bjornhellander/feature/sa1642-records

    Update SA1642 and its code fix to handle record structs correctly
    sharwell authored Sep 27, 2023
    Copy the full SHA
    d1c94ed View commit details

Commits on Sep 28, 2023

  1. Update analyzers

    sharwell committed Sep 28, 2023
    Copy the full SHA
    271f1d4 View commit details
  2. Copy the full SHA
    b00056d View commit details
  3. Mark several test classes as partial

    This mechanical change simplifies an upcoming review.
    sharwell committed Sep 28, 2023
    Copy the full SHA
    5f386bc View commit details
  4. Copy the full SHA
    dc41c13 View commit details

Commits on Sep 29, 2023

  1. Merge pull request #3700 from sharwell/update-deps

    Update dependencies
    sharwell authored Sep 29, 2023
    Copy the full SHA
    0685f19 View commit details
  2. Merge pull request #3702 from sharwell/partial-tests

    Mark several test classes as partial
    sharwell authored Sep 29, 2023
    Copy the full SHA
    6cfbc21 View commit details
  3. Merge pull request #3703 from sharwell/missing-tests

    Add missing test files and fix inheritance
    sharwell authored Sep 29, 2023
    Copy the full SHA
    57b15ad View commit details
  4. Copy the full SHA
    d1d8ee9 View commit details
  5. Merge pull request #3704 from sharwell/generate-tests

    Generate and validate derived test classes
    sharwell authored Sep 29, 2023
    Copy the full SHA
    0548969 View commit details

Commits on Oct 15, 2023

  1. Copy the full SHA
    dfd5ed2 View commit details
  2. Copy the full SHA
    b7e150a View commit details

Commits on Oct 16, 2023

  1. Copy the full SHA
    16c310e View commit details

Commits on Oct 17, 2023

  1. Copy the full SHA
    b5fd4b5 View commit details
  2. Merge pull request #3709 from bjornhellander/featur/sa1011-before-ran…

    …ge-operator
    
    Update SA1011 to not require space before a range operator
    sharwell authored Oct 17, 2023
    Copy the full SHA
    61aea88 View commit details
  3. Merge pull request #3710 from bjornhellander/feature/sa1131-methods-a…

    …s-constants
    
    Update SA1131 to treat methods as constants
    sharwell authored Oct 17, 2023
    Copy the full SHA
    3411684 View commit details
  4. Copy the full SHA
    3386603 View commit details
  5. Comments

    martin-strecker-sonarsource committed Oct 17, 2023
    Copy the full SHA
    12b6f93 View commit details

Commits on Oct 18, 2023

  1. Merge pull request #3711 from martin-strecker-sonarsource/Allocations…

    …InCanWrap
    
    Avoid allocations in CanWrap... methods
    sharwell authored Oct 18, 2023
    Copy the full SHA
    1dd5ced View commit details

Commits on Oct 21, 2023

  1. Update SA1648 to accept inheritdoc on members implemented from static…

    … abstract/virtual interface members. Also add tests for non-abstract/virtual interface members.
    
    #3595
    bjornhellander committed Oct 21, 2023
    Copy the full SHA
    a558a43 View commit details

Commits on Nov 3, 2023

  1. Copy the full SHA
    2d5a62f View commit details
  2. Fix

    MartyIX committed Nov 3, 2023
    Copy the full SHA
    7cd2b05 View commit details

Commits on Nov 7, 2023

  1. Another approach

    MartyIX committed Nov 7, 2023
    Copy the full SHA
    ef223ab View commit details
  2. Improve implementation

    MartyIX committed Nov 7, 2023
    Copy the full SHA
    d58dede View commit details

Commits on Nov 9, 2023

  1. Copy the full SHA
    393c5a1 View commit details

Commits on Nov 11, 2023

  1. Copy the full SHA
    836540c View commit details
Showing 2,043 changed files with 15,478 additions and 8,490 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -14,7 +14,6 @@ OpenCover.Symbols/
.nuget/NuGet.exe
build/nuget/
*.log
StyleCop.Analyzers/StyleCop.Analyzers/Lightup/.generated/Microsoft.CodeAnalysis.ResxSourceGenerator.CSharp/

# Visual Studio performance tools
*.psess
4 changes: 2 additions & 2 deletions .nuget/packages.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Codecov" version="1.9.0" />
<package id="CodecovUploader" version="0.7.1" />
<package id="OpenCover" version="4.6.519" />
<package id="ReportGenerator" version="2.3.5.0" targetFramework="net452" />
<package id="ReportGenerator" version="5.2.0" />
<package id="xunit.runner.console" version="2.4.1" />
</packages>
10 changes: 7 additions & 3 deletions StyleCop.Analyzers/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -40,6 +40,10 @@
<NoWarn>$(NoWarn),1573,1591,1712</NoWarn>
</PropertyGroup>

<PropertyGroup>
<SharedMicrosoftCodeAnalysisAnalyzersVersion>3.11.0-beta1.23472.1</SharedMicrosoftCodeAnalysisAnalyzersVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Version="2.2.13" PrivateAssets="all" />
</ItemGroup>
@@ -48,12 +52,12 @@
<PackageReference Include="AsyncUsageAnalyzers" Version="1.0.0-alpha003" PrivateAssets="all" />
<PackageReference Include="DotNetAnalyzers.DocumentationAnalyzers" Version="1.0.0-beta.46" PrivateAssets="all" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.435" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.5-beta1.23223.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="$(SharedMicrosoftCodeAnalysisAnalyzersVersion)" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeStyle" Version="4.0.1" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.ResxSourceGenerator" Version="3.3.5-beta1.23223.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.ResxSourceGenerator" Version="$(SharedMicrosoftCodeAnalysisAnalyzersVersion)" PrivateAssets="all" />
</ItemGroup>

<!-- C# Compiler -->
@@ -63,7 +67,7 @@

<!-- Public API -->
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="2.9.7" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="$(SharedMicrosoftCodeAnalysisAnalyzersVersion)" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ namespace StyleCop.Analyzers.DocumentationRules
using System;
using System.Collections.Immutable;
using System.Composition;
using System.Globalization;
using System.Diagnostics;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading;
@@ -20,6 +20,7 @@ namespace StyleCop.Analyzers.DocumentationRules
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Formatting;
using StyleCop.Analyzers.Helpers;
using StyleCop.Analyzers.Lightup;

/// <summary>
/// Implements a code fix for <see cref="SA1642ConstructorSummaryDocumentationMustBeginWithStandardText"/>
@@ -83,7 +84,7 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context)

internal static ImmutableArray<string> GenerateStandardText(Document document, BaseMethodDeclarationSyntax methodDeclaration, BaseTypeDeclarationSyntax typeDeclaration, CancellationToken cancellationToken)
{
bool isStruct = typeDeclaration.IsKind(SyntaxKind.StructDeclaration);
bool isStruct = typeDeclaration.IsKind(SyntaxKind.StructDeclaration) || typeDeclaration.IsKind(SyntaxKindEx.RecordStructDeclaration);
var settings = document.Project.AnalyzerOptions.GetStyleCopSettings(methodDeclaration.SyntaxTree, cancellationToken);
var culture = settings.DocumentationRules.DocumentationCultureInfo;
var resourceManager = DocumentationResources.ResourceManager;
@@ -147,7 +148,19 @@ private static TypeParameterListSyntax GetTypeParameterList(BaseTypeDeclarationS
return classDeclaration.TypeParameterList;
}

return (typeDeclaration as StructDeclarationSyntax)?.TypeParameterList;
if (typeDeclaration is StructDeclarationSyntax structDeclaration)
{
return structDeclaration.TypeParameterList;
}

if (RecordDeclarationSyntaxWrapper.IsInstance(typeDeclaration))
{
var recordDeclaration = (RecordDeclarationSyntaxWrapper)typeDeclaration;
return recordDeclaration.TypeParameterList;
}

Debug.Assert(false, $"Unhandled type {typeDeclaration.Kind()}");
return null;
}

private static Task<Document> GetTransformedDocumentAsync(Document document, SyntaxNode root, XmlElementSyntax node, CancellationToken cancellationToken)
@@ -202,21 +215,10 @@ private static bool IsMultiLine(XmlElementSyntax node)
private static Task<Document> GetTransformedDocumentAsync(Document document, SyntaxNode root, XmlEmptyElementSyntax node)
{
var typeDeclaration = node.FirstAncestorOrSelf<BaseTypeDeclarationSyntax>();

TypeParameterListSyntax typeParameterList;
if (typeDeclaration is ClassDeclarationSyntax classDeclaration)
{
typeParameterList = classDeclaration.TypeParameterList;
}
else
{
typeParameterList = (typeDeclaration as StructDeclarationSyntax)?.TypeParameterList;
}
var typeParameterList = GetTypeParameterList(typeDeclaration);

var newRoot = root.ReplaceNode(node, BuildSeeElement(typeDeclaration.Identifier, typeParameterList));

var newDocument = document.WithSyntaxRoot(newRoot);

return Task.FromResult(newDocument);
}

Original file line number Diff line number Diff line change
@@ -20,4 +20,5 @@
[assembly: InternalsVisibleTo("StyleCop.Analyzers.Test.CSharp9, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c36d40d996fcc95fb6a89754728616758f459026e31478ce93633b3e27a4af416f103aa3d7a9e7998f829f8715cc1240d30724fd662042550fa71357b19562622424267e9e4640c403edbe64709a9ca5918128a9b9020b0db6e770d0dd1eac888869c23a835b74bde00e171984b1d1c24636cf030f0b23106e73035a2be145a6")]
[assembly: InternalsVisibleTo("StyleCop.Analyzers.Test.CSharp10, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c36d40d996fcc95fb6a89754728616758f459026e31478ce93633b3e27a4af416f103aa3d7a9e7998f829f8715cc1240d30724fd662042550fa71357b19562622424267e9e4640c403edbe64709a9ca5918128a9b9020b0db6e770d0dd1eac888869c23a835b74bde00e171984b1d1c24636cf030f0b23106e73035a2be145a6")]
[assembly: InternalsVisibleTo("StyleCop.Analyzers.Test.CSharp11, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c36d40d996fcc95fb6a89754728616758f459026e31478ce93633b3e27a4af416f103aa3d7a9e7998f829f8715cc1240d30724fd662042550fa71357b19562622424267e9e4640c403edbe64709a9ca5918128a9b9020b0db6e770d0dd1eac888869c23a835b74bde00e171984b1d1c24636cf030f0b23106e73035a2be145a6")]
[assembly: InternalsVisibleTo("StyleCop.Analyzers.Test.CSharp12, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c36d40d996fcc95fb6a89754728616758f459026e31478ce93633b3e27a4af416f103aa3d7a9e7998f829f8715cc1240d30724fd662042550fa71357b19562622424267e9e4640c403edbe64709a9ca5918128a9b9020b0db6e770d0dd1eac888869c23a835b74bde00e171984b1d1c24636cf030f0b23106e73035a2be145a6")]
[assembly: InternalsVisibleTo("StyleCopTester, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c36d40d996fcc95fb6a89754728616758f459026e31478ce93633b3e27a4af416f103aa3d7a9e7998f829f8715cc1240d30724fd662042550fa71357b19562622424267e9e4640c403edbe64709a9ca5918128a9b9020b0db6e770d0dd1eac888869c23a835b74bde00e171984b1d1c24636cf030f0b23106e73035a2be145a6")]
Original file line number Diff line number Diff line change
@@ -214,6 +214,11 @@ private static bool IsEnumWithDefaultMember(INamedTypeSymbol namedTypeSymbol, ou
/// <returns>A new member access expression.</returns>
private static SyntaxNode ConstructMemberAccessSyntax(TypeSyntax typeSyntax, string memberName)
{
// NOTE: This creates the correct source code when applied, but these are not necessarily the syntax
// nodes that the compiler would create from that source code. For example, the type syntax can
// contain QualifiedName nodes, whereas the compiler would have created SimpleMemberAccessExpression instead.
// This means that the validation that happens in the tests need to be turned off for some tests.
// We could have transformed the nodes to match, but we keep the code simple instead.
return SyntaxFactory.MemberAccessExpression(
SyntaxKind.SimpleMemberAccessExpression,
typeSyntax,
Original file line number Diff line number Diff line change
@@ -66,33 +66,48 @@ private static async Task<Document> GetTransformedDocumentAsync(Document documen

private static BinaryExpressionSyntax TransformExpression(BinaryExpressionSyntax binaryExpression)
{
// NOTE: This code also changes the syntax node kind, besides the operator token. The modified source code would
// have been the same without this, but we do this to make tests pass with the default CodeActionValidationMode.
var newLeft = binaryExpression.Right.WithTriviaFrom(binaryExpression.Left);
var newRight = binaryExpression.Left.WithTriviaFrom(binaryExpression.Right);
return binaryExpression.WithLeft(newLeft).WithRight(newRight).WithOperatorToken(GetCorrectOperatorToken(binaryExpression.OperatorToken));
GetReplacementInfo(binaryExpression.OperatorToken, out var newOperatorToken, out var newNodeKind);
return SyntaxFactory.BinaryExpression(newNodeKind, newLeft, newOperatorToken, newRight);
}

private static SyntaxToken GetCorrectOperatorToken(SyntaxToken operatorToken)
private static void GetReplacementInfo(SyntaxToken operatorToken, out SyntaxToken newToken, out SyntaxKind newNodeKind)
{
switch (operatorToken.Kind())
{
case SyntaxKind.EqualsEqualsToken:
case SyntaxKind.ExclamationEqualsToken:
return operatorToken;
newToken = operatorToken;
newNodeKind = operatorToken.Parent.Kind();
break;

case SyntaxKind.GreaterThanToken:
return SyntaxFactory.Token(operatorToken.LeadingTrivia, SyntaxKind.LessThanToken, operatorToken.TrailingTrivia);
newToken = SyntaxFactory.Token(operatorToken.LeadingTrivia, SyntaxKind.LessThanToken, operatorToken.TrailingTrivia);
newNodeKind = SyntaxKind.LessThanExpression;
break;

case SyntaxKind.GreaterThanEqualsToken:
return SyntaxFactory.Token(operatorToken.LeadingTrivia, SyntaxKind.LessThanEqualsToken, operatorToken.TrailingTrivia);
newToken = SyntaxFactory.Token(operatorToken.LeadingTrivia, SyntaxKind.LessThanEqualsToken, operatorToken.TrailingTrivia);
newNodeKind = SyntaxKind.LessThanOrEqualExpression;
break;

case SyntaxKind.LessThanToken:
return SyntaxFactory.Token(operatorToken.LeadingTrivia, SyntaxKind.GreaterThanToken, operatorToken.TrailingTrivia);
newToken = SyntaxFactory.Token(operatorToken.LeadingTrivia, SyntaxKind.GreaterThanToken, operatorToken.TrailingTrivia);
newNodeKind = SyntaxKind.GreaterThanExpression;
break;

case SyntaxKind.LessThanEqualsToken:
return SyntaxFactory.Token(operatorToken.LeadingTrivia, SyntaxKind.GreaterThanEqualsToken, operatorToken.TrailingTrivia);
newToken = SyntaxFactory.Token(operatorToken.LeadingTrivia, SyntaxKind.GreaterThanEqualsToken, operatorToken.TrailingTrivia);
newNodeKind = SyntaxKind.GreaterThanOrEqualExpression;
break;

default:
return SyntaxFactory.Token(SyntaxKind.None);
newToken = SyntaxFactory.Token(SyntaxKind.None);
newNodeKind = (SyntaxKind)operatorToken.Parent.RawKind;
break;
}
}

Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@ namespace StyleCop.Analyzers.ReadabilityRules
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using StyleCop.Analyzers.Helpers;
using StyleCop.Analyzers.Settings.ObjectModel;

/// <summary>
/// Implements a code fix for <see cref="SA1134AttributesMustNotShareLine"/>.
@@ -31,7 +32,7 @@ internal class SA1134CodeFixProvider : CodeFixProvider
/// <inheritdoc/>
public override FixAllProvider GetFixAllProvider()
{
return CustomFixAllProviders.BatchFixer;
return FixAll.Instance;
}

/// <inheritdoc/>
@@ -58,16 +59,25 @@ private static async Task<Document> GetTransformedDocumentAsync(Document documen
{
var syntaxRoot = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
var settings = SettingsHelper.GetStyleCopSettings(document.Project.AnalyzerOptions, syntaxRoot.SyntaxTree, cancellationToken);
var tokensToReplace = new Dictionary<SyntaxToken, SyntaxToken>();

AddTokensToReplaceToMap(tokensToReplace, syntaxRoot, diagnostic, settings);

var newSyntaxRoot = syntaxRoot.ReplaceTokens(tokensToReplace.Keys, (original, rewritten) => tokensToReplace[original]);
var newDocument = document.WithSyntaxRoot(newSyntaxRoot.WithoutFormatting());

return newDocument;
}

private static void AddTokensToReplaceToMap(Dictionary<SyntaxToken, SyntaxToken> tokensToReplace, SyntaxNode syntaxRoot, Diagnostic diagnostic, StyleCopSettings settings)
{
var attributeListSyntax = (AttributeListSyntax)syntaxRoot.FindNode(diagnostic.Location.SourceSpan);

// use the containing type to determine the indentation level, anything else is less reliable.
var containingType = attributeListSyntax.Parent?.Parent;
var indentationSteps = (containingType != null) ? IndentationHelper.GetIndentationSteps(settings.Indentation, containingType) + 1 : 0;
var indentationTrivia = IndentationHelper.GenerateWhitespaceTrivia(settings.Indentation, indentationSteps);

var tokensToReplace = new Dictionary<SyntaxToken, SyntaxToken>();

if (diagnostic.Properties.ContainsKey(SA1134AttributesMustNotShareLine.FixWithNewLineBeforeKey))
{
var token = attributeListSyntax.OpenBracketToken;
@@ -89,11 +99,34 @@ private static async Task<Document> GetTransformedDocumentAsync(Document documen
var newLeadingTrivia = nextToken.LeadingTrivia.Insert(0, indentationTrivia);
tokensToReplace[nextToken] = nextToken.WithLeadingTrivia(newLeadingTrivia);
}
}

var newSyntaxRoot = syntaxRoot.ReplaceTokens(tokensToReplace.Keys, (original, rewritten) => tokensToReplace[original]);
var newDocument = document.WithSyntaxRoot(newSyntaxRoot.WithoutFormatting());
private class FixAll : DocumentBasedFixAllProvider
{
public static FixAllProvider Instance { get; } = new FixAll();

return newDocument;
protected override string CodeActionTitle => ReadabilityResources.SA1134CodeFix;

protected override async Task<SyntaxNode> FixAllInDocumentAsync(FixAllContext fixAllContext, Document document, ImmutableArray<Diagnostic> diagnostics)
{
if (diagnostics.IsEmpty)
{
return null;
}

var syntaxRoot = await document.GetSyntaxRootAsync(fixAllContext.CancellationToken).ConfigureAwait(false);
var settings = SettingsHelper.GetStyleCopSettings(document.Project.AnalyzerOptions, syntaxRoot.SyntaxTree, fixAllContext.CancellationToken);
var tokensToReplace = new Dictionary<SyntaxToken, SyntaxToken>();

foreach (var diagnostic in diagnostics)
{
AddTokensToReplaceToMap(tokensToReplace, syntaxRoot, diagnostic, settings);
}

var newSyntaxRoot = syntaxRoot.ReplaceTokens(tokensToReplace.Keys, (original, rewritten) => tokensToReplace[original]);

return newSyntaxRoot;
}
}
}
}
Loading