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

refactor: invert conditionals for less nesting in includeScriptOutput #12146

Merged

Conversation

agilgur5
Copy link

@agilgur5 agilgur5 commented Nov 4, 2023

Motivation

Modifications

Verification

  • other than the tiny semantic change above to expose more errors, this is semantically equivalent to the previous behavior

- I didn't get a chance to review e5d8c53 before it was merged in, but it added more nesting when there was already some unnecessary nesting

- invert the `boundaryID` conditional from there for less nesting
- and invert the `boundaryNode` conditional as well for less nesting

- less nesting = less code complexity

- **NOTE**: there is a small semantic difference here from the previous code from 1f6b19f
  - when there is an error retrieving `boundaryNode`, the error will now be returned
  - previously it was not returned, but the purpose of the PR was to expose these errors as they are indicative of an underlying logic bug
    - so I think this is still within the intent of the PR, but tagging the author just in case

Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
@agilgur5 agilgur5 added the area/controller Controller issues, panics label Nov 4, 2023
boundaryNode, err := woc.wf.Status.Nodes.Get(boundaryID)
if err != nil {
woc.log.Errorf("was unable to obtain node for %s", boundaryID)
return false, err
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would've returned false, nil before

@juliev0 juliev0 merged commit 64ee6ae into argoproj:main Dec 6, 2023
@agilgur5 agilgur5 deleted the refactor-includeScriptOutput-less-nesting branch December 18, 2023 04:44
tczhao pushed a commit to tczhao/argo that referenced this pull request Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/controller Controller issues, panics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants