feat: auto fix common review issues#2355
Conversation
Greptile SummaryThis PR introduces a
Confidence Score: 3/5Safe to merge as a non-production utility, but the error-coloring bug means failures look identical to success in terminal output. The err() function emits text in the same green color as log(), making every failure path visually indistinguishable from a successful step. The deprecated git filter-branch and the broken backtick span in the scan template are lower-priority but also worth addressing. misc/auto-fixes/auto-fix.sh — the error-color and filter-branch issues are both here. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A([auto-fix.sh branch]) --> B[fetch origin main + branch]
B --> C[create git worktree detached at origin/branch]
C --> D[uv sync]
D --> E[run scan agent]
E --> F{issues.ignore.md non-empty?}
F -- No --> G([exit 0: nothing to do])
F -- Yes --> H[pick fresh AUTOFIX_BRANCH name]
H --> I[checkout -b AUTOFIX_BRANCH]
I --> J[run fix agent]
J --> K{any new commits?}
K -- No --> L([exit 0: no fixes committed])
K -- Yes --> M[git filter-branch: strip attribution]
M --> N{attribution still present?}
N -- Yes --> O([exit 1: abort])
N -- No --> P{all commits use default git user?}
P -- No --> Q([exit 1: abort])
P -- Yes --> R[git push AUTOFIX_BRANCH]
R --> S[gh pr create]
S --> T([cleanup worktree + local branch])
Reviews (1): Last reviewed commit: "auto-fixes" | Re-trigger Greptile |
| GREEN=$'\033[0;32m' | ||
| RESET=$'\033[0m' | ||
| log() { echo "${GREEN}$*${RESET}"; } # stdout (progress) | ||
| err() { echo "${GREEN}$*${RESET}" >&2; } # stderr (errors) |
There was a problem hiding this comment.
Error messages printed in green (same as progress)
Both log and err emit text in GREEN, so error output is visually identical to normal progress output. When the script calls err "scan agent failed" or err "refusing to push: non-default author detected." and exits non-zero, the operator has no visual cue that something went wrong. Error messages should use a distinct color (e.g. red) so they stand out, especially in CI/terminal logs where the exit code may not be immediately visible.
| GREEN=$'\033[0;32m' | |
| RESET=$'\033[0m' | |
| log() { echo "${GREEN}$*${RESET}"; } # stdout (progress) | |
| err() { echo "${GREEN}$*${RESET}" >&2; } # stderr (errors) | |
| GREEN=$'\033[0;32m' | |
| RED=$'\033[0;31m' | |
| RESET=$'\033[0m' | |
| log() { echo "${GREEN}$*${RESET}"; } # stdout (progress) | |
| err() { echo "${RED}$*${RESET}" >&2; } # stderr (errors) |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| FILTER_BRANCH_SQUELCH_WARNING=1 git -C "$WORKTREE" filter-branch -f --msg-filter \ | ||
| 'grep -viE "^(Co-authored-by:|Generated with \[Claude Code\])|🤖"' \ | ||
| -- "$BASE_SHA"..HEAD |
|
|
||
| The branch is $$BRANCH$$. You can perform a diff with `git diff main...$$BRANCH$$ -- . ':(exclude)*.lock' ':(exclude)uv.lock' ':(exclude)package-lock.json' ':(exclude)yarn.lock' ':(exclude)pnpm-lock.yaml' ':(exclude)Cargo.lock' ':(exclude)*.pdf' ':(exclude)*.png' ':(exclude)*.jpg' |
There was a problem hiding this comment.
Broken inline-code span across newline
The backtick opening the code span for the git diff command is on line 2, but the closing backtick is on line 3 (its own line). In CommonMark, a single-backtick code span cannot contain a newline, so the command renders as plain text followed by a stray backtick.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Problem
Reviewing takes a long time. Some issues come up multiple times, so we can automate them.
Closes DIM-978
Solution
Contributor License Agreement