Skip to content

Commit

Permalink
changing descriptor codes from Akka to AK (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaronontheweb authored Jan 2, 2024
1 parent ca7c7a3 commit 0aefdfe
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// </copyright>
// -----------------------------------------------------------------------

using Verify = Akka.Analyzers.Tests.Utility.AkkaVerifier<Akka.Analyzers.AK2000.MustNotUseTimeSpanZeroWithAskAnalyzer>;
using Verify = Akka.Analyzers.Tests.Utility.AkkaVerifier<Akka.Analyzers.MustNotUseTimeSpanZeroWithAskAnalyzer>;

namespace Akka.Analyzers.Tests.Analyzers.AK2000;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Diagnostics;

namespace Akka.Analyzers.AK2000;
namespace Akka.Analyzers;

[DiagnosticAnalyzer(LanguageNames.CSharp)]
public class MustNotUseTimeSpanZeroWithAskAnalyzer()
Expand Down
21 changes: 11 additions & 10 deletions src/Akka.Analyzers/Utility/RuleDescriptors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ namespace Akka.Analyzers;

public static class RuleDescriptors
{
#region AK2000 Rules

public static DiagnosticDescriptor Ak2000DoNotUseZeroTimeoutWithAsk { get; } = Rule("Akka2000",
"Do not use `Ask` with `TimeSpan.Zero` for timeout.", AnalysisCategory.ApiUsage, DiagnosticSeverity.Error,
"When using `Ask`, you must always specify a timeout value greater than `TimeSpan.Zero`.");

#endregion

private static DiagnosticDescriptor Rule(
string id,
string title,
Expand All @@ -34,14 +26,23 @@ private static DiagnosticDescriptor Rule(

#region AK1000 Rules

public static DiagnosticDescriptor Ak1000DoNotNewActors { get; } = Rule("Akka1000",
public static DiagnosticDescriptor Ak1000DoNotNewActors { get; } = Rule("AK1000",
"Do not use `new` to create actors", AnalysisCategory.ActorDesign, DiagnosticSeverity.Error,
"Actors must be instantiated using `ActorOf` or `ActorOfAsTestActorRef` via a `Props` class.");

public static DiagnosticDescriptor Ak1001CloseOverSenderUsingPipeTo { get; } = Rule("Akka1001",
public static DiagnosticDescriptor Ak1001CloseOverSenderUsingPipeTo { get; } = Rule("Ak1001",
"Should always close over `Sender` when using `PipeTo`", AnalysisCategory.ActorDesign, DiagnosticSeverity.Error,
"When using `PipeTo`, you must always close over `Sender` to ensure that the actor's `Sender` property " +
"is captured at the time you're scheduling the `PipeTo`, as this value may change asynchronously.");

#endregion

#region AK2000 Rules

public static DiagnosticDescriptor Ak2000DoNotUseZeroTimeoutWithAsk { get; } = Rule("Ak2000",
"Do not use `Ask` with `TimeSpan.Zero` for timeout.", AnalysisCategory.ApiUsage, DiagnosticSeverity.Error,
"When using `Ask`, you must always specify a timeout value greater than `TimeSpan.Zero`.");

#endregion

}

0 comments on commit 0aefdfe

Please sign in to comment.