Skip to content
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 #2530

Closed
3 tasks done
rohanKanojia opened this issue Jan 10, 2024 · 4 comments · Fixed by #2605 or #2610
Closed
3 tasks done
Assignees
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Milestone

Comments

@rohanKanojia
Copy link
Member

rohanKanojia commented Jan 10, 2024

Component

JKube Kit

Task description

Description

SecretEnricher has this private method which returns null that is reported by Sonar as a code smell:
https://github.com/eclipse/jkube/blob/275dc11e9bd0a268aac94f112ac2c443960d957b/jkube-kit/enricher/generic/src/main/java/org/eclipse/jkube/enricher/generic/SecretEnricher.java#L130-L135

We should refactor this method so that it always returns a list. We should return Collections.emptyList() instead of null. It would be nice to get rid of if block using Java'a Optional.ofNullable.

Expected Behavior

getSecretsFromXmlConfig is refactored to return a non-null list always

Acceptance Criteria

  • getSecretsFromXmlConfig is refactored to return a non null value
  • getSecretsFromXmlConfig uses Optional.ofNullable instead of if conditional to handle null case
  • Remove null check from the caller that receives list from getSecretsFromXmlConfig

Before you start 🔴

👇 👇 👇 👇 👇 👇 👇 👇 👇 👇👇👇👇👇👇👇
Make sure you read the contributing guide first. Pay special attention to the ECA agreement section and the requirement to sign-off your commit.

How to manually test my changes

Kubernetes

If you don't have a real Kubernetes cluster available (most probably), you can use Minikube or Kind to test with a local cluster.

OpenShift

If you don't have a real OpenShift cluster available (most probably), you can use Red Hat's developer Sandbox for Red Hat OpenShift. The only requirement is to have a Red Hat account.

Once you have your Sandbox environment, you'll need to download the oc tool from the cluster console.
(Press the ? icon and from the context menu select Command line tools, you'll be redirected to https://$subdomain.openshiftapps.com/command-lines-tools where you'll be able to download the CLI for your platform)

@rohanKanojia rohanKanojia added the good first issue Good for newcomers label Jan 10, 2024
@manusa manusa added the help wanted Extra attention is needed label Jan 10, 2024
@l3002
Copy link
Contributor

l3002 commented Jan 12, 2024

Hi @rohanKanojia, I'm willing to pick this issue. Please assign this issue to me.

@rohanKanojia
Copy link
Member Author

@l3002 : This is a slightly involved issue. It's not recommended for beginners. You can pick this once you get a PR merged with first-timers-only .

@l3002
Copy link
Contributor

l3002 commented Jan 12, 2024

@rohanKanojia, Sure, I'm working on one right now.

@sankritimishra
Copy link
Contributor

Could you please assign this to me?

sankritimishra added a commit to sankritimishra/jkube that referenced this issue Feb 1, 2024
sankritimishra added a commit to sankritimishra/jkube that referenced this issue Feb 1, 2024
@manusa manusa added this to the 1.16.0 milestone Feb 2, 2024
manusa pushed a commit that referenced this issue Feb 2, 2024
@manusa manusa reopened this Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment