Skip to content

chore: replace redundant boolean closure in makeAppStageStatus with id > 0#6993

Open
deepak0x wants to merge 1 commit into
devtron-labs:mainfrom
deepak0x:fix/appstagestatus-redundant-boolean
Open

chore: replace redundant boolean closure in makeAppStageStatus with id > 0#6993
deepak0x wants to merge 1 commit into
devtron-labs:mainfrom
deepak0x:fix/appstagestatus-redundant-boolean

Conversation

@deepak0x

@deepak0x deepak0x commented Jul 20, 2026

Copy link
Copy Markdown

Description

makeAppStageStatus in pkg/app/appDetails/read/AppDetailsReadService.go built the Status field with an inline anonymous function that returned true/false from an if id > 0 block. AppStageStatus.Status is a bool, so the closure is equivalent to the expression id > 0. This replaces it with Status: id > 0. Behavior is unchanged.

Fixes #6992

How Has This Been Tested?

Verified locally with a table test for makeAppStageStatus covering id = 5, 1, 0 and -1, asserting the resulting Status along with the Stage, StageName and Required fields. It passes against both the original closure and the simplified expression, confirming the two are equivalent. gofmt and go vet are clean. The test is kept out of the change to match how the same redundant-branch cleanups were merged in this repo (for example #6668 and #6670 were source-only).

Checklist:

  • The title of the PR states what changed and the related issues number (used for the release note).
  • Does this PR requires documentation updates?
  • I have updated documentation as required by this PR.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have tested it for all user roles.
  • I have added all the required unit/api test cases.

Does this PR introduce a user-facing change?


@bito-code-review

Copy link
Copy Markdown

Bito Review Skipped - Source Branch Not Found

Bito didn't review this change because the pull request is no longer valid. It may have been merged, or the source/target branch may no longer exist.

…d > 0

makeAppStageStatus built the Status field with an inline anonymous
function returning true/false from an if id > 0 block. Status is a bool,
so the closure is equivalent to the expression id > 0. Replace it with
Status: id > 0.

Signed-off-by: Deepak Bhagat <deepak988088@gmail.com>
@deepak0x
deepak0x force-pushed the fix/appstagestatus-redundant-boolean branch from d33a5d3 to 47e8584 Compare July 20, 2026 09:29
@sonarqubecloud

Copy link
Copy Markdown

@deepak0x

Copy link
Copy Markdown
Author

@prakarsh-dt @nishant-d @vikramdevtron @vivek-devtron this is a small self-contained cleanup in pkg/app/appDetails/read (a CODEOWNERS path), fixing #6992. It replaces a redundant if id > 0 { return true } else { return false } closure with Status: id > 0, the same class already merged in #6668 and #6670. Could one of you take a look when you get a chance? Happy to adjust if you'd prefer any change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor: replace redundant boolean closure in makeAppStageStatus with id > 0

1 participant