Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changing descriptor codes from Akka to AK #27

Merged
merged 1 commit into from
Jan 2, 2024
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
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

}