Skip to content

feat: add --fix flag to autofix lint and formatting issues - #140

Merged
dclong merged 1 commit into
mainfrom
push-yvvsnxwzusov
Sep 27, 2026
Merged

dclong merged 1 commit into
mainfrom
push-yvvsnxwzusov

Conversation

@dclong

@dclong dclong commented Sep 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • feat(lint_repo): add --fix flag to autofix lint and formatting issues

Changed files

Modified

  • github_rest_api/scripts/lint_repo.py (+153/-41)
  • tests/test_lint_repo.py (+136/-0)

Commits

  • 2778093 feat(lint_repo): add --fix flag to autofix lint and formatting issues

@dclong

dclong commented Sep 27, 2026 •

Copy link
Copy Markdown
Collaborator Author

Claude finished @dclong's task in 2m 4s —— View job


Review of PR #140 — feat: add --fix flag to autofix lint and formatting issues

  • Gather context (PR diff, changed files, CLAUDE.md)
  • Run code review on the PR
  • Post review findings
  • Decide on auto-merge eligibility

Summary

This PR adds a --fix flag to lint_repo.py that switches each tool's check-only invocation to its corresponding autofix/write invocation, with a small _cmd() helper (github_rest_api/scripts/lint_repo.py:106-113) picking the right command list per builder.

Findings

I went through every builder (build_python_project_checks, build_python_scripts_checks, build_rust_project_checks, build_rust_scripts_checks, build_golang_checks, build_bash_checks, build_fish_checks, build_lua_checks, build_markdown_checks) and verified each --fix ↔ check-mode flag swap against the real tool semantics:

Tool check flag fix flag Correct?
pyproject-fmt --check (write) ✅
ruff format --check (write) ✅
ruff check (report) --fix ✅
cargo fmt -- --check (write) ✅
rustfmt --check (write) ✅
golangci-lint fmt -d (diff) (write) ✅
golangci-lint run (report) --fix ✅
shfmt -d (diff) -w (write) ✅
fish_indent -c (check) -w (write) ✅
stylua --check (write) ✅
mdformat --check (write) ✅
codespell (report) -w (write) ✅
shellcheck / selene / fish -n / lychee no autofix — correctly left unchanged in --fix mode, with comments explaining why ✅

No correctness bugs found. build_checks, lint_repo, and main/parse_args all thread fix through correctly, and Check.fatal semantics (e.g. lychee staying non-fatal) are preserved.

Test coverage (tests/test_lint_repo.py) is thorough: every builder has a _fix_mode test asserting the exact fixed command, plus tests confirming fix threads through build_checks, lint_repo, parse_args, and main. This matches the project's existing test style.

CI status: all test_code and lint_code jobs (including lint-python-project, lint-markdown, and Python 3.12.7/3.13/3.14 on Ubuntu/macOS) passed on this PR's branch, confirming formatting/type/lint compliance.

Minor, non-blocking notes

  • _cmd() (github_rest_api/scripts/lint_repo.py:106) is a small, well-documented helper — no issue, just noting it's the only new piece of shared logic.
  • The module docstring and per-flag help text were updated consistently and clearly explain the three configurable behaviors (--fix, --on-missing-tool, --fail-fast).

Nothing here rises to a blocking issue — this is a clean, well-tested addition that mirrors the existing code style closely.

AUTO_MERGE_APPROVED

@dclong
dclong merged commit 0fc5064 into main Sep 27, 2026
22 checks passed
@dclong
dclong deleted the push-yvvsnxwzusov branch September 28, 2026 18:01
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.

1 participant