Skip to content

chore: remove decorative comments for minimal style#28

Merged
alexandreafj merged 1 commit into
masterfrom
chore/minimal-comment-style
May 2, 2026
Merged

chore: remove decorative comments for minimal style#28
alexandreafj merged 1 commit into
masterfrom
chore/minimal-comment-style

Conversation

@alexandreafj
Copy link
Copy Markdown
Owner

Summary

  • Remove all decorative section banners (====, ----, ───)
  • Remove all phase headers (// Phase X:)
  • Remove redundant comments that repeat test/function names
  • Keep only comments that explain non-obvious context, safety rationale, or constraints
  • Update AGENTS.md rule feat: add --repo/-r flag to gitm commit #10 on minimal comment style

Scope

32 files across e2e tests, unit tests, internal packages, and CLI code cleaned.

Changes

  • Removed: 385 comment lines of decorative/redundant text
  • Added: 7 lines to AGENTS.md documenting new rule
  • Net: ~378 lines reduced

Validation

  • go test ./... -v -race -timeout 60s ✅ (406 passing)
  • make lint
  • gofmt applied

Rationale

Decorative comments (banners, phase labels, line repetition) add visual clutter without explaining why code exists. Per new AGENTS.md rule #10, we keep only comments that add context—safety rationale, algorithm explanation, TTY limitations, etc. This improves code readability and makes meaningful comments stand out.

- Remove all decorative section banners (====, ----, ───)
- Remove all phase headers (// Phase X:)
- Remove redundant comments that repeat test/function names
- Keep only comments that explain non-obvious context, safety rationale, or constraints
- Update AGENTS.md with new 'Comments must be minimal' rule (rule #10)
- Improves code readability by reducing noise in test files and implementation

Test coverage: 406 passing with race detection, lint clean
Copilot AI review requested due to automatic review settings May 2, 2026 05:49
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 2, 2026

✅ All checks passed (Go 1.26)

Coverage: 68.4%

@alexandreafj alexandreafj merged commit b85c580 into master May 2, 2026
3 checks passed
@alexandreafj alexandreafj deleted the chore/minimal-comment-style branch May 2, 2026 05:52
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR standardizes comment style across the codebase by removing decorative/duplicative comment banners (especially in tests) and documenting the new minimal-comment rule in AGENTS.md, aiming to improve signal-to-noise and keep only explanatory rationale.

Changes:

  • Removed decorative section banners and phase headers across e2e/unit tests and some CLI implementation files.
  • Removed redundant comments that simply restate test/function intent.
  • Added AGENTS.md Landmine #10 defining the new minimal, non-decorative comment policy.

Reviewed changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
internal/runner/parallel_test.go Removed decorative test section banners/redundant verification comments.
internal/git/git_test.go Removed decorative section banners and some inline explanatory comments in git integration tests.
internal/git/git_more_test.go Removed decorative banners and some scenario setup comments in extended git tests.
internal/e2e/update_test.go Removed phase headers and “should …” comments that restate assertions.
internal/e2e/track_test.go Removed decorative phase banner; kept TUI limitation context.
internal/e2e/status_test.go Removed phase header and decorative helper separators.
internal/e2e/repo_test.go Removed phase header and redundant “verify …” comments in repo e2e flows.
internal/e2e/interactive_test.go Removed phase banners while retaining non-TTY/TUI constraints via notes/skips.
internal/e2e/helpers_test.go Removed decorative separators and a redundant build comment in shared e2e helpers.
internal/e2e/help_test.go Removed phase headers and redundant “should …” comments for help/version/unknown cmd tests.
internal/e2e/checkout_test.go Removed phase header and redundant branch expectation comments.
internal/e2e/branch_test.go Removed phase header and redundant “verify …” comments in branch e2e tests.
internal/db/db_test.go Removed decorative banners and redundant comments in DB unit tests.
internal/config/config_test.go Removed redundant “verify …” comments that restate assertions.
internal/cli/upgrade_test.go Removed some explanatory headers around HTTP download boundary tests.
internal/cli/upgrade_bundle_compat_test.go Removed redundant “verify …” comments while retaining in-test rationale where present.
internal/cli/update_test.go Removed redundant test doc comments that restate test names.
internal/cli/update_run_test.go Removed redundant “Finding #…” and setup comments in update runner tests.
internal/cli/status_test.go Removed redundant test doc comments that restate test names.
internal/cli/stash_test.go Removed redundant test doc comments and verification headings.
internal/cli/stash.go Removed decorative section header comments between subcommand implementations.
internal/cli/root_test.go Removed redundant test doc comments that restate test names.
internal/cli/reset_test.go Removed decorative section banners between test groups.
internal/cli/reset.go Removed “Phase X” header comments within runResetWithUI.
internal/cli/repo_test.go Removed decorative banners and redundant preface comments in repo CLI tests.
internal/cli/discard_test.go Removed redundant test doc comments that restate test names.
internal/cli/discard_run_test.go Removed redundant scenario comments that restate code/test intent.
internal/cli/commit_test.go Removed redundant test doc comments that restate test names.
internal/cli/commit_run_test.go Removed redundant “should not error …” comments that restate assertions.
internal/cli/checkout_test.go Removed redundant test doc comments that restate test names.
internal/cli/checkout_run_test.go Removed redundant “Finding #…” and setup comments in checkout runner tests.
internal/cli/branch_test.go Removed redundant test doc comments and subcommand verification headings.
AGENTS.md Added Landmine #10 documenting minimal, non-decorative comment expectations.
Comments suppressed due to low confidence (2)

internal/git/git_more_test.go:669

  • A short rationale comment here would help preserve the non-obvious constraint this test covers: untracked directories from git status --porcelain (e.g., ?? newdir/) require the git clean code path to include directory removal (the -d behavior). Without that context, it’s easy to regress the implementation while still thinking “untracked files” are covered.
    internal/cli/upgrade_test.go:706
  • The removed header comment here explained why these tests call httpUpgradeClient.downloadBytes via a real httptest.Server (to exercise the real io.LimitReader / max-size enforcement path rather than the fake client). That rationale is non-obvious and worth keeping as a short comment so future changes don’t accidentally weaken the coverage.
func TestHTTPDownloadBytesOversizedRejected(t *testing.T) {
	oversized := bytes.Repeat([]byte("x"), int(maxBundleSize)+1)

	srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		w.WriteHeader(http.StatusOK)
		if _, err := w.Write(oversized); err != nil {
			t.Errorf("write oversized payload: %v", err)
		}
	}))
	defer srv.Close()

	uc := &httpUpgradeClient{client: newTestHTTPClient(srv)}

	_, err := uc.downloadBytes(srv.URL + "/bundle")

Comment thread internal/git/git_test.go
Comment on lines 345 to 350
func TestForcePush(t *testing.T) {
// Create a bare repo to act as origin.
bareDir := t.TempDir()
mustRunGit(t, bareDir, "init", "--bare", "--initial-branch=main")

// Create a working repo and push an initial commit.
workDir := initRepo(t)
mustRunGit(t, workDir, "config", "user.email", "test@example.com")
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.

2 participants