Skip to content

fix: drop redundant else in getIngressHost - #1018

Merged
skevetter merged 1 commit into
mainfrom
fix/codefactor/drop-else-ingress-host
Aug 12, 2026
Merged

skevetter merged 1 commit into
mainfrom
fix/codefactor/drop-else-ingress-host

Conversation

@devsy-app

@devsy-app devsy-app Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Codefactor issue

  • Key: 6a77b13d5b1ec0b4ee20c436
  • File:Line: cmd/pro/start.go:1941
  • Category / Severity: Maintainability / Minor
  • Message: "If block ends with a return statement, so drop this else and outdent its block."

Problem

In getIngressHost, the if err != nil { return "", err } block is followed by an
else { ... } whose body only runs when the if did not return. Since the if branch
always returns on the error path, the else is redundant and forces the success-path
body one indentation level deeper. Codefactor flags this as a maintainability issue.

Fix

Dropped the redundant else and outdented its block (the // find host for-loop that
returns rule.Host). Behavior is unchanged: the success path still runs only when
err == nil.

                if err != nil {
                        return "", err
-               } else {
-                       // find host
-                       for _, rule := range ingress.Spec.Rules {
-                               return rule.Host, nil
-                       }
+               }
+               // find host
+               for _, rule := range ingress.Spec.Rules {
+                       return rule.Host, nil
                }

Only this one block was changed; the sibling branch in the same function is out of scope
(one issue per run).

Verification

  • go build ./cmd/pro/ — compiles cleanly.
  • task cli:format — clean.
  • task cli:lint:ci — 0 new issues (new-from-patch against origin/main).
  • task cli:test — passes except the known pre-existing pkg/git failures
    (TestRepoCloneArgsThroughRunner, TestRepoCloneFromInfoBranch,
    TestRepoCloneFromInfoHelper) that fail on origin/main already and are unrelated to
    this change (this PR does not touch pkg/git).

This PR was created by an AI agent as part of an automated daily Codefactor issue fix job.

@netlify

netlify Bot commented Aug 12, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit d5aace9
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6a7c70a257b0d70008bb30db

@netlify

netlify Bot commented Aug 12, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for images-devsy-sh canceled.

Name Link
🔨 Latest commit d5aace9
🔍 Latest deploy log https://app.netlify.com/projects/images-devsy-sh/deploys/6a7c70a2f823910008164a43

@devsy-app devsy-app Bot added the codefactor label Aug 12, 2026
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

AI Reviewer: run a review on demand. To trigger the first review automatically, go to your organization or repository integration settings. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@skevetter
skevetter marked this pull request as ready for review August 12, 2026 14:31
@skevetter
skevetter merged commit 1d0ba52 into main Aug 12, 2026
67 checks passed
@skevetter
skevetter deleted the fix/codefactor/drop-else-ingress-host branch August 12, 2026 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant