Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
sharwell authored Jun 21, 2023
1 parent 6cae4cf commit 280b11a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ namespace StyleCop.Analyzers.Test.CSharp9.OrderingRules
{
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Testing;
using StyleCop.Analyzers.Test.CSharp8.OrderingRules;
using StyleCop.Analyzers.Test.Verifiers;
using Xunit;
using static StyleCop.Analyzers.Test.Verifiers.StyleCopCodeFixVerifier<
StyleCop.Analyzers.OrderingRules.SA1212PropertyAccessorsMustFollowOrder,
Expand All @@ -30,13 +30,12 @@ public class Foo
public int Prop { get; init; }
}";

var test = new CSharpTest
await new CSharpTest
{
TestCode = testCode,
FixedCode = fixedCode,
ReferenceAssemblies = GenericAnalyzerTest.ReferenceAssembliesNet50,
};
await test.RunAsync(CancellationToken.None).ConfigureAwait(false);
ReferenceAssemblies = ReferenceAssemblies.Net.Net50,
}.RunAsync(CancellationToken.None).ConfigureAwait(false);
}

[Fact]
Expand Down Expand Up @@ -81,13 +80,12 @@ public int Prop
}
}";

var test = new CSharpTest
await new CSharpTest
{
TestCode = testCode,
FixedCode = fixedCode,
ReferenceAssemblies = GenericAnalyzerTest.ReferenceAssembliesNet50,
};
await test.RunAsync(CancellationToken.None).ConfigureAwait(false);
ReferenceAssemblies = ReferenceAssemblies.Net.Net50,
}.RunAsync(CancellationToken.None).ConfigureAwait(false);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private static void AnalyzeProperty(SyntaxNodeAnalysisContext context, BasePrope
return;
}

if ((accessors[0].Kind() == SyntaxKind.SetAccessorDeclaration || accessors[0].Kind() == SyntaxKindEx.InitAccessorDeclaration) &&
if ((accessors[0].Kind() is SyntaxKind.SetAccessorDeclaration or SyntaxKindEx.InitAccessorDeclaration) &&
accessors[1].Kind() == SyntaxKind.GetAccessorDeclaration)
{
context.ReportDiagnostic(Diagnostic.Create(Descriptor, accessors[0].GetLocation()));
Expand Down

0 comments on commit 280b11a

Please sign in to comment.