-
Notifications
You must be signed in to change notification settings - Fork 1
feat(hygiene): lint check for git merge-conflict markers in committed files — Aaron 2026-04-26 ask #539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(hygiene): lint check for git merge-conflict markers in committed files — Aaron 2026-04-26 ask #539
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,119 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #!/usr/bin/env bash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # tools/hygiene/check-no-conflict-markers.sh — fails the build if | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # any committed file contains git merge-conflict markers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # (`<<<<<<<`, `=======`, `>>>>>>>`). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Why this exists (Aaron 2026-04-26): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Why this exists (Aaron 2026-04-26): | |
| # Why this exists (human contributor note, 2026-04-26): |
Copilot
AI
Apr 26, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: The doc says “Untracked files — only committed/staged matters”, but the implementation reads the working tree content of git ls-files paths (so it won’t necessarily reflect what’s staged in the index for partial stages). Suggest rewording to “tracked working tree files” or explicitly scanning the index if staged-only detection is intended.
Copilot
AI
Apr 26, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: ALLOWLIST contains a hard-coded path to a memory file that isn’t present in the repo. This dead entry makes it unclear what is actually exempt; either remove it until the file exists or replace it with the correct existing path that legitimately contains marker examples.
| # Substrate / research files documenting merge-conflict resolution | |
| # discipline. They legitimately contain the marker tokens as | |
| # examples. Allowed because the file body is meta-discussion not | |
| # accidental marker leakage. | |
| "memory/feedback_otto_341_lint_suppression_is_self_deception_noise_signal_or_underlying_fix_greenfield_large_refactors_welcome_training_data_human_shortcut_bias_2026_04_26.md" |
Copilot
AI
Apr 26, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: This runs grep separately for every tracked file, which will also scan large/binary tracked artifacts (e.g., the PDFs under docs/). Consider using git grep with binary ignored or otherwise skipping known-binary/large files so the check stays reliably fast under the 2-minute CI timeout.
| while IFS= read -r file; do | |
| if is_allowed "$file"; then | |
| continue | |
| fi | |
| if [[ ! -f "$file" ]]; then | |
| continue | |
| fi | |
| # Use grep -E with line numbers; binary files quietly skipped. | |
| if hits=$(grep -nE "$PATTERN" "$file" 2>/dev/null); then | |
| while IFS= read -r line; do | |
| violations=$((violations + 1)) | |
| if [[ -z "$first_hit" ]]; then | |
| first_hit="$file:$line" | |
| fi | |
| echo "VIOLATION: $file:$line" >&2 | |
| done <<< "$hits" | |
| fi | |
| done < <(git ls-files) | |
| git_grep_args=(git grep -nI -E "$PATTERN" -- .) | |
| for allowed in "${ALLOWLIST[@]}"; do | |
| git_grep_args+=(":(exclude)$allowed") | |
| done | |
| git_grep_args+=(":(exclude)references/**") | |
| # Search tracked text files in one pass; `-I` skips binary content. | |
| if hits="$("${git_grep_args[@]}" 2>/dev/null)"; then | |
| while IFS= read -r hit; do | |
| violations=$((violations + 1)) | |
| if [[ -z "$first_hit" ]]; then | |
| first_hit="$hit" | |
| fi | |
| echo "VIOLATION: $hit" >&2 | |
| done <<< "$hits" | |
| fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1 (repo convention): This workflow comment introduces direct contributor-name attribution (“Aaron …”) on a current-state CI surface. Per
docs/AGENT-BEST-PRACTICES.md“No name attribution…”, please rewrite to role-refs (e.g., “human maintainer request (2026-04-26)”) and keep names to the enumerated history surfaces only.