Skip to content

Commit

Permalink
style: fix linting errors (#726)
Browse files Browse the repository at this point in the history
  • Loading branch information
buehler committed Mar 7, 2024
1 parent 2d17bff commit babd7ba
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 19 deletions.
27 changes: 15 additions & 12 deletions src/KubeOps.KubernetesClient/KubernetesClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,9 @@ public KubernetesClient(KubernetesClientConfiguration clientConfig, IKubernetes
/// <inheritdoc />
public Uri BaseUri => _client.BaseUri;

[DebuggerHidden]
private void ThrowIfDisposed()
{
if (!_disposed)
{
return;
}

throw new ObjectDisposedException(nameof(KubernetesClient));
}

/// <summary>
/// Clears the metadata cache.
/// </summary>
public static void ClearMetadataCache() => MetadataCache.Clear();

/// <inheritdoc />
Expand Down Expand Up @@ -382,7 +374,7 @@ public TEntity UpdateStatus<TEntity>(TEntity entity)
timeoutSeconds: timeout switch
{
null => null,
_ => (int?)timeout.Value.TotalSeconds,
_ => (int?)timeout.Value.TotalSeconds,
},
watch: true,
cancellationToken: cancellationToken),
Expand Down Expand Up @@ -456,6 +448,17 @@ private static EntityMetadata GetMetadata<TEntity>()
return MetadataCache.GetOrAdd(type, t => Entities.ToEntityMetadata(t).Metadata);
}

[DebuggerHidden]
private void ThrowIfDisposed()
{
if (!_disposed)
{
return;
}

throw new ObjectDisposedException(nameof(KubernetesClient));
}

private GenericClient CreateGenericClient<TEntity>()
{
ThrowIfDisposed();
Expand Down
2 changes: 0 additions & 2 deletions src/KubeOps.Operator/Events/KubeOpsEventPublisherFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ internal sealed class KubeOpsEventPublisherFactory(
OperatorSettings settings,
ILogger<EventPublisher> logger) : IEventPublisherFactory
{
public void Dispose() => client.Dispose();

public EventPublisher Create() => async (entity, reason, message, type, token) =>
{
var @namespace = entity.Namespace() ?? "default";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ internal sealed class KubernetesLeaderElectorFactory(
OperatorSettings settings)
: ILeaderElectorFactory
{
public void Dispose()
{
}

public LeaderElector CreateElector() => new(new LeaderElectionConfig(new LeaseLock(
kubernetes,
client.GetCurrentNamespace(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private class TestController(
{
public async Task ReconcileAsync(V1OperatorIntegrationTestEntity entity, CancellationToken cancellationToken)
{
await eventPublisher(entity, "REASON", "message");
await eventPublisher(entity, "REASON", "message", cancellationToken: cancellationToken);
svc.Invocation(entity);

if (svc.Invocations.Count < svc.TargetInvocationCount)
Expand Down

0 comments on commit babd7ba

Please sign in to comment.