Skip to content

linter: whitespace, modernize, ineffassign, wastedassign - #833

Merged
mzihlmann merged 4 commits into
mainfrom
lint-whitespace
Jul 14, 2026
Merged

linter: whitespace, modernize, ineffassign, wastedassign#833
mzihlmann merged 4 commits into
mainfrom
lint-whitespace

Conversation

@mzihlmann

@mzihlmann mzihlmann commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Bundles four small, mechanical, easy-to-review linter cleanups carved from #539 (kept together since each is trivial):

  • whitespace: drop unnecessary leading/trailing blank lines in function bodies
  • modernize: strings.Split range loop becomes strings.SplitSeq
  • ineffassign / wastedassign: remove assignments overwritten before use (uid, gid := -1, -1, val = "", r := "" become plain var or are removed)

All behaviour-preserving and generated/derived from golangci-lint. The linters themselves are not enabled in the config here, that stays in #539.

Summary by CodeRabbit

  • Bug Fixes

    • Missing environment variables referenced by secret mounts now produce a clear error instead of creating an empty secret.
    • Errors encountered while unpacking build contexts are now correctly propagated.
    • Improved handling of assertion configuration and file extraction edge cases.
  • Tests

    • Corrected test control flow and variable initialization to improve reliability.

@mzihlmann
mzihlmann requested review from 0hlov3, BobDu, babs and nejch June 26, 2026 10:04
@mzihlmann mzihlmann changed the title linter: whitespace linter: whitespace, modernize, ineffassign, wastedassign Jun 26, 2026
This was referenced Jun 26, 2026
@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/util/assert.go 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@mzihlmann mzihlmann added standardization Aligning behavior with Docker/BuildKit/OCI linter Pull requests that improve linting or code cleanup easy-review Mechanical or self-contained change needing little domain reasoning to approve and removed standardization Aligning behavior with Docker/BuildKit/OCI labels Jul 7, 2026
@osscontainertools osscontainertools deleted a comment from coderabbitai Bot Jul 13, 2026
@osscontainertools osscontainertools deleted a comment from coderabbitai Bot Jul 13, 2026
@mzihlmann

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 50134914-11c9-47a3-8b00-69a07c2317b7

📥 Commits

Reviewing files that changed from the base of the PR and between f8e626b and b4d2413.

📒 Files selected for processing (11)
  • integration/images.go
  • pkg/buildcontext/tar.go
  • pkg/commands/copy.go
  • pkg/commands/run.go
  • pkg/commands/workdir.go
  • pkg/image/remote/remote.go
  • pkg/util/assert.go
  • pkg/util/command_util_test.go
  • pkg/util/fs_util.go
  • pkg/util/fs_util_test.go
  • pkg/util/transport_util_test.go
💤 Files with no reviewable changes (8)
  • pkg/commands/run.go
  • pkg/util/transport_util_test.go
  • integration/images.go
  • pkg/util/fs_util.go
  • pkg/commands/workdir.go
  • pkg/image/remote/remote.go
  • pkg/util/command_util_test.go
  • pkg/buildcontext/tar.go

📝 Walkthrough

Walkthrough

The changes adjust secret environment validation, untar error propagation, copy identity initialization, assertion parsing, extraction setup, and several loop or test block structures.

Changes

Runtime and maintenance updates

Layer / File(s) Summary
Command error and value handling
pkg/buildcontext/tar.go, pkg/commands/run.go, pkg/commands/copy.go
Build-context untar errors are returned with the directory, unset secret environment variables now fail, and copy command identity locals use zero-value initialization.
Utility parsing and extraction updates
pkg/util/assert.go, pkg/util/fs_util.go, pkg/util/fs_util_test.go
Assertion parsing uses strings.SplitSeq, whiteout guard formatting changes without logic changes, and the extraction test declares its directory variable explicitly.
Loop and test structure adjustments
integration/images.go, pkg/image/remote/remote.go, pkg/commands/workdir.go, pkg/util/command_util_test.go, pkg/util/transport_util_test.go
Localized loop, workdir, and test-block boundaries were adjusted without additional observable behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: 0hlov3, babs, bobdu, nejch

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description summarizes the change, but it omits required template sections like issue links, checklist items, reviewer notes, and release notes. Add the template sections: Fixes #NNN, Submitter Checklist, Reviewer Notes, and Release Notes, or delete unused blocks if not applicable.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change set: mechanical linter-focused cleanup across whitespace, modernization, and wasted assignments.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch lint-whitespace

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

@mzihlmann
mzihlmann merged commit 736ae49 into main Jul 14, 2026
15 checks passed
@mzihlmann
mzihlmann deleted the lint-whitespace branch July 14, 2026 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

easy-review Mechanical or self-contained change needing little domain reasoning to approve linter Pull requests that improve linting or code cleanup

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant