Skip to content

Commit

Permalink
refactor: sonar suggestions
Browse files Browse the repository at this point in the history
BREAKING CHANGE: EventTag is now sealed
  • Loading branch information
ArneD committed Nov 18, 2024
1 parent 95062c7 commit 59e8a17
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ public EventHandlingModule(Assembly eventsAssembly, JsonSerializerSettings jsonS
_eventMapping = new EventMapping(EventMapping.DiscoverEventNamesInAssembly(eventsAssembly));
}

protected override void Load(ContainerBuilder containerBuilder)
protected override void Load(ContainerBuilder builder)
{
containerBuilder
builder
.RegisterInstance(_eventMapping)
.As<EventMapping>();

containerBuilder
builder
.RegisterInstance(_eventDeserializer)
.As<EventDeserializer>();

containerBuilder
builder
.RegisterInstance(_eventSerializer)
.As<EventSerializer>();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,9 @@ private static Func<Type, bool> HasEventTags(IReadOnlyList<EventTag> requestedTa
throw new ArgumentNullException(nameof(requestedTags));

return requestedTags.Count == 0
? (Func<Type, bool>) AllowAllEvents
? _ => true
: HasAnyRequestedEventTag;

static bool AllowAllEvents(Type eventType) => true;

bool HasAnyRequestedEventTag(Type eventType)
{
var eventTags = eventType
Expand Down
6 changes: 3 additions & 3 deletions src/Be.Vlaanderen.Basisregisters.EventHandling/EventTag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ namespace Be.Vlaanderen.Basisregisters.EventHandling
{
using System;

public class EventTag
public sealed class EventTag
{
public class For
public static class For
{
public const string Sync = "sync";
public const string Crab = "crab";
Expand Down Expand Up @@ -35,7 +35,7 @@ public static EventTag Create(string tagType)
public override bool Equals(object? obj)
=> obj is EventTag tag && Equals(tag);

protected bool Equals(EventTag other)
private bool Equals(EventTag other)
=> _tagType == other._tagType;

public override int GetHashCode()
Expand Down

0 comments on commit 59e8a17

Please sign in to comment.