@@ -7,6 +7,26 @@ namespace Dolittle.SDK.Analyzers;
77
88static class DescriptorRules
99{
10+ internal static readonly DiagnosticDescriptor InvalidTimestamp =
11+ new (
12+ DiagnosticIds . InvalidTimestampParameter ,
13+ title : "Invalid DateTimeOffset format" ,
14+ messageFormat : "Value '{0}' should be a valid DateTimeOffset" ,
15+ DiagnosticCategories . Sdk ,
16+ DiagnosticSeverity . Error ,
17+ isEnabledByDefault : true ,
18+ description : "The value should be a valid DateTimeOffset." ) ;
19+
20+ internal static readonly DiagnosticDescriptor InvalidStartStopTimestamp =
21+ new (
22+ DiagnosticIds . InvalidStartStopTime ,
23+ title : "Start is not before stop" ,
24+ messageFormat : "'{0}' should be before '{1}'" ,
25+ DiagnosticCategories . Sdk ,
26+ DiagnosticSeverity . Error ,
27+ isEnabledByDefault : true ,
28+ description : "Start timestamp should be before stop timestamp." ) ;
29+
1030 internal static readonly DiagnosticDescriptor InvalidIdentity =
1131 new (
1232 DiagnosticIds . AttributeInvalidIdentityRuleId ,
@@ -26,7 +46,17 @@ static class DescriptorRules
2646 DiagnosticSeverity . Error ,
2747 isEnabledByDefault : true ,
2848 description : "Assign a unique identity in the attribute" ) ;
29-
49+
50+ internal static readonly DiagnosticDescriptor InvalidAccessibility =
51+ new (
52+ DiagnosticIds . InvalidAccessibility ,
53+ title : "Invalid accessibility level" ,
54+ messageFormat : "{0} needs to be '{1}'" ,
55+ DiagnosticCategories . Sdk ,
56+ DiagnosticSeverity . Warning ,
57+ isEnabledByDefault : true ,
58+ description : "Change the accessibility level to '{1}'." ) ;
59+
3060 internal static class Events
3161 {
3262 internal static readonly DiagnosticDescriptor MissingAttribute =
@@ -38,6 +68,16 @@ internal static class Events
3868 DiagnosticSeverity . Error ,
3969 isEnabledByDefault : true ,
4070 description : "Mark the event with an EventTypeAttribute and assign an identifier to it" ) ;
71+
72+ internal static readonly DiagnosticDescriptor MissingEventContext =
73+ new (
74+ DiagnosticIds . EventHandlerMissingEventContext ,
75+ title : "Handle method does not take EventContext as the second parameter" ,
76+ messageFormat : "{0} is missing EventContext argument" ,
77+ DiagnosticCategories . Sdk ,
78+ DiagnosticSeverity . Error ,
79+ isEnabledByDefault : true ,
80+ description : "Add the EventContext as the second parameter to the Handle method" ) ;
4181 }
4282
4383 internal static class Aggregate
@@ -90,5 +130,14 @@ internal static class Aggregate
90130 DiagnosticSeverity . Error ,
91131 isEnabledByDefault : true
92132 ) ;
133+
134+ internal static readonly DiagnosticDescriptor PublicMethodsCannotMutateAggregateState = new (
135+ DiagnosticIds . PublicMethodsCannotMutateAggregateState ,
136+ "Aggregates should only be mutated with events" ,
137+ "Public methods can not mutate the state of an aggregate. All mutations needs to be done via events." ,
138+ DiagnosticCategories . Sdk ,
139+ DiagnosticSeverity . Warning ,
140+ isEnabledByDefault : true
141+ ) ;
93142 }
94143}
0 commit comments