Skip to content

Commit babd7ba

Browse files
authored
style: fix linting errors (#726)
1 parent 2d17bff commit babd7ba

File tree

4 files changed

+16
-19
lines changed

4 files changed

+16
-19
lines changed

src/KubeOps.KubernetesClient/KubernetesClient.cs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,9 @@ public KubernetesClient(KubernetesClientConfiguration clientConfig, IKubernetes
5959
/// <inheritdoc />
6060
public Uri BaseUri => _client.BaseUri;
6161

62-
[DebuggerHidden]
63-
private void ThrowIfDisposed()
64-
{
65-
if (!_disposed)
66-
{
67-
return;
68-
}
69-
70-
throw new ObjectDisposedException(nameof(KubernetesClient));
71-
}
72-
62+
/// <summary>
63+
/// Clears the metadata cache.
64+
/// </summary>
7365
public static void ClearMetadataCache() => MetadataCache.Clear();
7466

7567
/// <inheritdoc />
@@ -382,7 +374,7 @@ public Watcher<TEntity> Watch<TEntity>(
382374
timeoutSeconds: timeout switch
383375
{
384376
null => null,
385-
_ => (int?)timeout.Value.TotalSeconds,
377+
_ => (int?)timeout.Value.TotalSeconds,
386378
},
387379
watch: true,
388380
cancellationToken: cancellationToken),
@@ -456,6 +448,17 @@ private static EntityMetadata GetMetadata<TEntity>()
456448
return MetadataCache.GetOrAdd(type, t => Entities.ToEntityMetadata(t).Metadata);
457449
}
458450

451+
[DebuggerHidden]
452+
private void ThrowIfDisposed()
453+
{
454+
if (!_disposed)
455+
{
456+
return;
457+
}
458+
459+
throw new ObjectDisposedException(nameof(KubernetesClient));
460+
}
461+
459462
private GenericClient CreateGenericClient<TEntity>()
460463
{
461464
ThrowIfDisposed();

src/KubeOps.Operator/Events/KubeOpsEventPublisherFactory.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ internal sealed class KubeOpsEventPublisherFactory(
1818
OperatorSettings settings,
1919
ILogger<EventPublisher> logger) : IEventPublisherFactory
2020
{
21-
public void Dispose() => client.Dispose();
22-
2321
public EventPublisher Create() => async (entity, reason, message, type, token) =>
2422
{
2523
var @namespace = entity.Namespace() ?? "default";

src/KubeOps.Operator/LeaderElection/KubernetesLeaderElectorFactory.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ internal sealed class KubernetesLeaderElectorFactory(
1313
OperatorSettings settings)
1414
: ILeaderElectorFactory
1515
{
16-
public void Dispose()
17-
{
18-
}
19-
2016
public LeaderElector CreateElector() => new(new LeaderElectionConfig(new LeaseLock(
2117
kubernetes,
2218
client.GetCurrentNamespace(),

test/KubeOps.Operator.Test/Events/EventPublisher.Integration.Test.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ private class TestController(
8888
{
8989
public async Task ReconcileAsync(V1OperatorIntegrationTestEntity entity, CancellationToken cancellationToken)
9090
{
91-
await eventPublisher(entity, "REASON", "message");
91+
await eventPublisher(entity, "REASON", "message", cancellationToken: cancellationToken);
9292
svc.Invocation(entity);
9393

9494
if (svc.Invocations.Count < svc.TargetInvocationCount)

0 commit comments

Comments
 (0)