Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Fix analyzer [RCS0049](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0049) ([PR](https://github.com/dotnet/roslynator/pull/1386))
- Fix analyzer [RCS1159](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1159) ([PR](https://github.com/dotnet/roslynator/pull/1390))
- Fix analyzer [RCS1019](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1019) ([PR](https://github.com/dotnet/roslynator/pull/1402))
- Fix code fix for [CS8600](https://josefpihrt.github.io/docs/roslynator/fixes/CS8600) changing the wrong type when casts or `var` are involved ([PR](https://github.com/dotnet/roslynator/pull/1393) by @jroessel)

## [4.10.0] - 2024-01-24
Expand Down
46 changes: 25 additions & 21 deletions src/CSharp/CSharp/ModifierKindComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,47 +22,51 @@ public virtual int GetRank(SyntaxKind kind)
case SyntaxKind.NewKeyword:
return 0;
case SyntaxKind.PublicKeyword:
return 1;
return 10;
case SyntaxKind.PrivateKeyword:
return 2;
return 20;
case SyntaxKind.ProtectedKeyword:
return 3;
return 30;
case SyntaxKind.InternalKeyword:
return 4;
return 40;
#if ROSLYN_4_4
case SyntaxKind.FileKeyword:
return 50;
#endif
case SyntaxKind.ConstKeyword:
return 5;
return 60;
case SyntaxKind.StaticKeyword:
return 6;
return 70;
case SyntaxKind.VirtualKeyword:
return 7;
return 80;
case SyntaxKind.SealedKeyword:
return 8;
return 90;
case SyntaxKind.OverrideKeyword:
return 9;
return 100;
case SyntaxKind.AbstractKeyword:
return 10;
return 110;
case SyntaxKind.ReadOnlyKeyword:
return 11;
return 120;
case SyntaxKind.ExternKeyword:
return 12;
return 130;
case SyntaxKind.UnsafeKeyword:
return 13;
return 140;
case SyntaxKind.FixedKeyword:
return 14;
return 150;
case SyntaxKind.VolatileKeyword:
return 15;
return 160;
case SyntaxKind.AsyncKeyword:
return 16;
return 170;
case SyntaxKind.PartialKeyword:
return 17;
return 180;
case SyntaxKind.ThisKeyword:
return 18;
return 190;
case SyntaxKind.RefKeyword:
return 19;
return 200;
case SyntaxKind.OutKeyword:
return 20;
return 210;
case SyntaxKind.InKeyword:
return 21;
return 220;
default:
{
Debug.Fail($"unknown modifier '{kind}'");
Expand Down
24 changes: 24 additions & 0 deletions src/Tests/Analyzers.Tests/RCS1019OrderModifiersTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright (c) .NET Foundation and Contributors. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Roslynator.CSharp.CodeFixes;
using Roslynator.Testing.CSharp;
using Xunit;

namespace Roslynator.CSharp.Analysis.Tests;

public class RCS1019OrderModifiersTests : AbstractCSharpDiagnosticVerifier<OrderModifiersAnalyzer, MemberDeclarationCodeFixProvider>
{
public override DiagnosticDescriptor Descriptor { get; } = DiagnosticRules.OrderModifiers;

[Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.OrderModifiers)]
public async Task Test()
{
await VerifyNoDiagnosticAsync("""
file static class C
{
}
""");
}
}