-
Notifications
You must be signed in to change notification settings - Fork 541
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SecretEnricher getSecretsFromXmlConfig should return Collections.emptyList() instead of null #2554
Conversation
Eclipse JKube CI ReportStarted new GH workflow run for #2554 (2024-01-29T07:21:46Z) ⚙️ JKube E2E Tests (7692436999)
|
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #2554 +/- ##
=============================================
+ Coverage 59.36% 69.70% +10.34%
- Complexity 4586 4892 +306
=============================================
Files 500 474 -26
Lines 21211 19169 -2042
Branches 2830 2479 -351
=============================================
+ Hits 12591 13362 +771
+ Misses 7370 4586 -2784
+ Partials 1250 1221 -29 ☔ View full report in Codecov by Sentry. |
ResourceConfig resourceConfig = getConfiguration().getResource(); | ||
if(resourceConfig != null && resourceConfig.getSecrets() != null) { | ||
return resourceConfig.getSecrets(); | ||
} | ||
return null; | ||
return Optional.ofNullable(resourceConfig).map(resourceConfig1 -> Optional.ofNullable(resourceConfig1.getSecrets()).orElse(Collections.emptyList())).orElse(Collections.emptyList()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor suggestion regarding formatting
ResourceConfig resourceConfig = getConfiguration().getResource(); | |
if(resourceConfig != null && resourceConfig.getSecrets() != null) { | |
return resourceConfig.getSecrets(); | |
} | |
return null; | |
return Optional.ofNullable(resourceConfig).map(resourceConfig1 -> Optional.ofNullable(resourceConfig1.getSecrets()).orElse(Collections.emptyList())).orElse(Collections.emptyList()); | |
return Optional.ofNullable(getConfiguration().getResource()) | |
.map(rc -> Optional.ofNullable(rc.getSecrets()) | |
.orElse(Collections.emptyList())) | |
.orElse(Collections.emptyList()); |
|
jkube-kit/enricher/generic/src/main/java/org/eclipse/jkube/enricher/generic/SecretEnricher.java
Outdated
Show resolved
Hide resolved
…icher/generic/SecretEnricher.java Co-authored-by: Rohan Kumar <rohan.kumar.kanojia@gmail.com>
} | ||
return null; | ||
return Optional.ofNullable(getConfiguration()) | ||
.map(Configuration::getResource) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're missing the required import for org.eclipse.jkube.kit.enricher.api.model.Configuration
, the project won't compile unless you add it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @sankritimishra
This PR is getting really messy.
I suggest you start from scratch in a new branch (preferably named different to master
).
Keep only these changes:
private List<SecretConfig> getSecretsFromXmlConfig() {
return Optional.ofNullable(getConfiguration())
.map(Configuration::getResource)
.map(ResourceConfig::getSecrets)
.orElse(Collections.emptyList());
}
And try to open it on an IDE so that it can automatically fix the imports for you. At the moment I'm worried you're not even trying to compile the changed module in your local machine.
Description
SecretEnricher getSecretsFromXmlConfig should return Collections.emptyList() instead of nullFixes #2530
Type of change
test, version modification, documentation, etc.)
Checklist