Fix CS9124: avoid double-storing primary-constructor log parameter#2018
Merged
Conversation
KubernetesDiscovererBase captured the 'log' primary-constructor parameter (via LogDeserialisationError) while also storing it in an explicit 'protected readonly ILog Log' field, so the value was held twice (CS9124). Remove the redundant base field; the base now relies on the captured parameter. AwsKubernetesDiscoverer keeps its own 'readonly ILog log = log' field and uses it for TryGetCredentials, with the remaining Log.Verbose calls binding to the static logger. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Jtango18
approved these changes
Jun 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Resolves CS9124 in
KubernetesDiscovererBase.Why
KubernetesDiscovererBase(ILog log)captured thelogprimary-constructor parameter (it's used inLogDeserialisationError) and also stored it in an explicitprotected readonly ILog Logfield. That holds the same value twice — the compiler's synthesised capture field plus the explicit field — which is what CS9124 flags.Change
KubernetesDiscovererBase: removed the redundantprotected readonly ILog Log = log;field. The base now relies solely on the capturedlogparameter.AwsKubernetesDiscoverer: it previously used the inheritedLogfield, so it now keeps its ownreadonly ILog log = log;and uses it forTryGetCredentials(log, …). The remainingLog.Verbose(…)calls bind to the staticCalamari.Common.Plumbing.Logging.Loglogger.Impact
Calamari.Aws(andCalamari.Common) build clean.🤖 Generated with Claude Code