Skip to content

Commit

Permalink
refactor: apply codacy suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Guilherme Ferreira committed Dec 19, 2023
1 parent 22aef8c commit 7e49ea2
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void Navigate(Action<TDomain> action, Predicate<TDbo> navigatingCondition
Guard.Argument(action).NotNull();
Guard.Argument(navigatingCondition).NotNull();

Navigate((domain, dbo) => action(domain), navigatingCondition);
Navigate((domain, _) => action(domain), navigatingCondition);
}

public void Navigate(Action<TDomain, TDbo> action, Predicate<TDbo> navigatingCondition)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public GetQueuesInput(RetryQueueStatus status,
{
Guard.Argument(itemsStatuses, nameof(itemsStatuses))
.DoesNotContain(stuckStatusFilter.ItemStatus,
(statuses, stuckStatus) =>
(_, _) =>
"The status list can't contain the status that can be considered as stuck.");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ public async Task<AddIfQueueExistsResult> AddIfQueueExistsAsync(IMessageContext
async () =>
{
return await AddIfQueueExistsAsync(
context,
new SaveToQueueInput(
new RetryQueueItemMessage(
context.ConsumerContext.Topic,
Expand Down Expand Up @@ -240,8 +239,7 @@ await Policy
throw new ArgumentException($"None of the handlers is able to update the input {updateItemInput.GetType()}");
}

private async Task<AddIfQueueExistsResult> AddIfQueueExistsAsync(IMessageContext context,
SaveToQueueInput saveToQueueInput)
private async Task<AddIfQueueExistsResult> AddIfQueueExistsAsync(SaveToQueueInput saveToQueueInput)
{
try
{
Expand Down
2 changes: 1 addition & 1 deletion src/KafkaFlow.Retry/Durable/RetryDurableMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public async Task Invoke(IMessageContext context, MiddlewareDelegate next)
.Handle<Exception>(exception => _retryDurableDefinition.ShouldRetry(new RetryContext(exception)))
.WaitAndRetryAsync(
_retryDurableDefinition.RetryDurableRetryPlanBeforeDefinition.NumberOfRetries,
(retryNumber, c) =>
(retryNumber, _) =>
_retryDurableDefinition.RetryDurableRetryPlanBeforeDefinition.TimeBetweenTriesPlan(retryNumber),
(exception, waitTime, attemptNumber, c) =>
{
Expand Down
4 changes: 2 additions & 2 deletions src/KafkaFlow.Retry/Forever/RetryForeverMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public async Task Invoke(IMessageContext context, MiddlewareDelegate next)
var policy = Policy
.Handle<Exception>(exception => _retryForeverDefinition.ShouldRetry(new RetryContext(exception)))
.WaitAndRetryForeverAsync(
(retryNumber, c) => _retryForeverDefinition.TimeBetweenTriesPlan(retryNumber),
(exception, attemptNumber, waitTime, c) =>
(retryNumber, _) => _retryForeverDefinition.TimeBetweenTriesPlan(retryNumber),
(exception, attemptNumber, waitTime, _) =>
{
if (!_controlWorkerId.HasValue)
{
Expand Down
4 changes: 2 additions & 2 deletions src/KafkaFlow.Retry/Simple/RetrySimpleMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public async Task Invoke(IMessageContext context, MiddlewareDelegate next)
.Handle<Exception>(exception => _retrySimpleDefinition.ShouldRetry(new RetryContext(exception)))
.WaitAndRetryAsync(
_retrySimpleDefinition.NumberOfRetries,
(retryNumber, c) => _retrySimpleDefinition.TimeBetweenTriesPlan(retryNumber),
(exception, waitTime, attemptNumber, c) =>
(retryNumber, _) => _retrySimpleDefinition.TimeBetweenTriesPlan(retryNumber),
(exception, waitTime, attemptNumber, _) =>
{
if (_retrySimpleDefinition.PauseConsumer && !_controlWorkerId.HasValue)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace KafkaFlow.Retry.IntegrationTests.Core.Storages;

internal static class InMemoryAuxiliarStorage<T> where T : ITestMessage
{
private const int TimeoutSec = 60;
private const int TimeoutSec = 90;
private static readonly ConcurrentBag<T> s_message = new();

public static bool ThrowException { get; set; }

Check warning on line 15 in tests/KafkaFlow.Retry.IntegrationTests/Core/Storages/InMemoryAuxiliarStorage.cs

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

tests/KafkaFlow.Retry.IntegrationTests/Core/Storages/InMemoryAuxiliarStorage.cs#L15

A static field in a generic type is not shared among instances of different close constructed types.
Expand Down

0 comments on commit 7e49ea2

Please sign in to comment.