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

KubernetesClientUtil : Refactor loop to get rid of nested if statements #3030

Closed
2 tasks
rohanKanojia opened this issue May 8, 2024 · 8 comments · Fixed by #3072
Closed
2 tasks

KubernetesClientUtil : Refactor loop to get rid of nested if statements #3030

rohanKanojia opened this issue May 8, 2024 · 8 comments · Fixed by #3072
Assignees
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Milestone

Comments

@rohanKanojia
Copy link
Member

rohanKanojia commented May 8, 2024

Component

JKube Kit

Task description

Description

This loop in KubernetesClientUtil seems to have a lot of nested statements:

for (PodCondition condition : conditions) {
String type = condition.getType();
if (StringUtils.isNotBlank(type)) {
if ("ready".equalsIgnoreCase(type)) {
String statusText = condition.getStatus();
if (StringUtils.isNotBlank(statusText)) {
if (Boolean.parseBoolean(statusText)) {
return type;

We should refactor it. I think we can make use of Java Stream API here to get the desired result quite easily.

Expected Behavior

Nested if statements are removed from for loop

Acceptance Criteria

  • Nested if statements are removed from for loop
  • Project compiles cleanly after running mvn clean install
@rohanKanojia rohanKanojia added good first issue Good for newcomers help wanted Extra attention is needed labels May 8, 2024
@l3002
Copy link
Contributor

l3002 commented May 8, 2024

Hi @rohanKanojia : I can work on this. Could you please assign this issue to me?

@rohanKanojia
Copy link
Member Author

@l3002: You already have 2 issues assigned to you at the moment. It's generally advised to not work on multiple things at a time. Will you be okay with picking up this one as well (considering your existing work priorities) ?

@rohit-satya
Copy link
Contributor

@rohanKanojia Please assign this to me

@rohanKanojia
Copy link
Member Author

@rohit-satya : You've commented on multiple issues. Which one should I assign?

@l3002
Copy link
Contributor

l3002 commented May 9, 2024

@rohanKanojia : I'll be delivering the a PR for #2665 today, so I'm sure I'll be able to work on this issue as well. For #2841, I will try to close this one by this week only. Therefore, If multiple issue assignation complies with the existing policy for this repo, then I'll be glad to work on this.

@manusa
Copy link
Member

manusa commented May 9, 2024

Note that we create new issues every week.

@rohit-satya
Copy link
Contributor

@rohit-satya : You've commented on multiple issues. Which one should I assign?

@rohanKanojia In such a case please assign any one and you can reject me for others if you think I won't be able to deliver in time

@l3002
Copy link
Contributor

l3002 commented May 23, 2024

Hi @rohanKanojia, Please go ahead and assign this issue to @rohit-satya, he as already created a pull request for this.

@rohit-satya: Thanks Rohit, I was quite busy last week, couldn't get to this.

@manusa manusa assigned rohit-satya and unassigned l3002 May 28, 2024
@manusa manusa added this to the 1.17.0 milestone Jul 18, 2024 — with automated-tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
4 participants