Skip to content

fix(lint): resolve all nestif findings - #876

Merged
skevetter merged 3 commits into
mainfrom
lint/nestif
Aug 3, 2026
Merged

fix(lint): resolve all nestif findings#876
skevetter merged 3 commits into
mainfrom
lint/nestif

Conversation

@skevetter

@skevetter skevetter commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Like funcorder and cyclop, nestif is already fully active once enabled -- no separate opt-in setting exists, so all 5 pre-existing findings are fixed here in one PR.

Each fix extracts the deeply-nested block into a well-named helper:

  • pkg/daemon/platform/local_server.go: watchPlatform's nested if err != nil -> updatePlatformAuthStatus
  • pkg/devcontainer/delete.go: Delete's non-compose stop-then-delete branch -> stopAndDeleteContainer
  • pkg/provider/workspace.go: ParseWorkspaceSource's git-prefix branch -> parseGitWorkspaceSource
  • pkg/ssh/server/ssh.go: getCommand's su/shell argv construction -> buildSuArgs, buildShellArgs
  • pkg/workspace/id.go: ToID's two top-level branches -> idFromPROrBranch, idFromRepoPath (preserves a pre-existing dead len(splitted)==2 check inside the repo-path branch -- unreachable in both the old and new code, unrelated to this fix)

No behavior changes. Verified against existing test coverage: pkg/workspace/id_test.go's TestToID exercises every branch (PR reference, branch name, repo URL, local dir, truncation), and pkg/provider's TestParseWorkspaceSource_GitURLs covers the git path.

Summary by CodeRabbit

  • Refactor
    • Improved consistency across platform authentication updates, container deletion, workspace source parsing, SSH command construction, and workspace identifier handling.
    • Preserved existing behavior for authentication states, container cleanup options, Git sources, SSH sessions, pull requests, branches, and repository paths.
    • Improved handling of repository references and removal of unnecessary processing paths.
    • No user-facing configuration or workflow changes are required.

nestif is on by default once enabled, same as funcorder/cyclop -- no
separate opt-in setting. Fixes all 5 pre-existing violations by
extracting the deeply-nested block into a well-named helper:

- pkg/daemon/platform/local_server.go: watchPlatform's nested
  if err != nil -> updatePlatformAuthStatus
- pkg/devcontainer/delete.go: Delete's non-compose branch ->
  stopAndDeleteContainer
- pkg/provider/workspace.go: ParseWorkspaceSource's git-prefix branch ->
  parseGitWorkspaceSource
- pkg/ssh/server/ssh.go: getCommand's su/shell argv construction ->
  buildSuArgs, buildShellArgs
- pkg/workspace/id.go: ToID's two top-level branches -> idFromPROrBranch,
  idFromRepoPath (preserves the pre-existing dead len(splitted)==2 check
  inside idFromRepoPath -- that branch is unreachable in both the old
  and new code, unrelated to this fix)

All extractions are behavior-preserving; verified against existing
test coverage (pkg/workspace/id_test.go's TestToID exercises every
branch, pkg/provider's TestParseWorkspaceSource_GitURLs covers the git
path). No logic changes.
@netlify

netlify Bot commented Aug 3, 2026

Copy link
Copy Markdown

Deploy Preview for images-devsy-sh canceled.

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

@netlify

netlify Bot commented Aug 3, 2026

Copy link
Copy Markdown

Deploy Preview for devsydev canceled.

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

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@skevetter, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 56 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 09e44315-777b-409e-b224-66faf8e27aef

📥 Commits

Reviewing files that changed from the base of the PR and between deb7b34 and 89dfd99.

📒 Files selected for processing (4)
  • pkg/daemon/platform/local_server.go
  • pkg/devcontainer/delete.go
  • pkg/ssh/server/ssh.go
  • pkg/workspace/id.go
📝 Walkthrough

Walkthrough

The change extracts existing authentication, deletion, Git parsing, SSH argument, and workspace ID logic into focused helper methods. Existing behavior remains unchanged, including error handling, argument construction, and identifier normalization.

Changes

Helper-based control-flow refactors

Layer / File(s) Summary
Platform authentication status handling
pkg/daemon/platform/local_server.go
watchPlatform delegates authentication-state updates to a mutex-protected helper.
Container deletion flow
pkg/devcontainer/delete.go
Delete separates Compose deletion from regular-container stopping and deletion.
Git workspace source parsing
pkg/provider/workspace.go
Git source normalization, validation, and WorkspaceSource construction move into parseGitWorkspaceSource.
SSH command argument construction
pkg/ssh/server/ssh.go
getCommand uses dedicated helpers for su and configured-shell arguments.
Workspace ID parsing
pkg/workspace/id.go
ToID delegates pull-request, branch, and repository-path parsing to separate helpers.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • devsy-org/devsy#765: Refactors SSH command construction in pkg/ssh/server/ssh.go while preserving behavior.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the primary change: resolving all existing nestif lint findings.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the size/l label Aug 3, 2026
idFromRepoPath is only reached from ToID's else branch (len(splitted)
!= 2), so its len(splitted) == 2 check could never be true. Drop the
dead branch and the now-unused splitted parameter.
@skevetter
skevetter marked this pull request as draft August 3, 2026 22:23
@skevetter
skevetter marked this pull request as ready for review August 3, 2026 23:02
@skevetter
skevetter enabled auto-merge (squash) August 3, 2026 23:07
@skevetter
skevetter merged commit 7028ed0 into main Aug 3, 2026
67 checks passed
@skevetter
skevetter deleted the lint/nestif branch August 3, 2026 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant