Skip to content

fix: drop redundant else in feature cache check - #963

Merged
skevetter merged 1 commit into
mainfrom
fix/codefactor/feature-cache-drop-else
Aug 9, 2026
Merged

skevetter merged 1 commit into
mainfrom
fix/codefactor/feature-cache-drop-else

Conversation

@devsy-app

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

Copy link
Copy Markdown
Contributor

Codefactor issue fix

Codefactor issue key: 6a77b13d5b1ec0b4ee20c456
File:line: pkg/devcontainer/feature/features.go L159-167 (checkFeatureCache)
Category: Maintainability — "If block ends with return, drop else and outdent"

Problem

Codefactor flagged a redundant else block in checkFeatureCache: the if err == nil branch already returns, so the trailing else { ... } wrapping the empty-cache cleanup is unnecessary.

Change

Dropped the else wrapper and outdented the two cleanup statements (log.Debugf + os.RemoveAll) so they run on the fall-through path. No behavioral change — the logic is identical, only the control flow is simplified.

                if err == nil {
                        log.Debugf("feature already cached: folder=%s", featureExtractedFolder)
                        return featureExtractedFolder, true
-               } else {
-                       log.Debugf("feature folder exists but seems empty: folder=%s", featureExtractedFolder)
-                       _ = os.RemoveAll(featureFolder)
                }
+               log.Debugf("feature folder exists but seems empty: folder=%s", featureExtractedFolder)
+               _ = os.RemoveAll(featureFolder)

Verification

  • task cli:format — passed (no formatting issues)
  • task cli:lint:ci — 0 new issues (mirrors CI's only-new-issues: true)
  • task cli:test — pkg/devcontainer/feature passes; only the known pre-existing pkg/git TestRepoClone* failures remain (unrelated to this change, present on origin/main)

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

Drops the trailing else block in checkFeatureCache where the if branch already returns, outdenting the cleanup statements. Resolves Codefactor Maintainability issue 6a77b13d5b1ec0b4ee20c456 in pkg/devcontainer/feature/features.go.
@netlify

netlify Bot commented Aug 9, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit 89a3abb
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6a787b5a5e39110008ac15f8

@netlify

netlify Bot commented Aug 9, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for images-devsy-sh canceled.

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

@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 9, 2026 17:01
@skevetter
skevetter merged commit 7ee8273 into main Aug 9, 2026
67 checks passed
@skevetter
skevetter deleted the fix/codefactor/feature-cache-drop-else branch August 9, 2026 17:01
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