Skip to content

feat: group output by file to reduce noise#10

Merged
mit-d merged 3 commits intomainfrom
feat/grouped-output
Mar 11, 2026
Merged

feat: group output by file to reduce noise#10
mit-d merged 3 commits intomainfrom
feat/grouped-output

Conversation

@mit-d
Copy link
Copy Markdown
Owner

@mit-d mit-d commented Mar 11, 2026

Summary

  • Findings are now grouped per file with a compact line range header (e.g. file.txt:1,4-80,90:)
  • Context lines shown once with multi-caret markers (^ normal, ! dangerous, ? confusable)
  • Identical context lines deduplicated (e.g. repeated box-drawing rows shown once)
  • Codepoint listing collapsed with (xN) counts, same codepoint found by both check_file and check_confusables merged to the more informative label

Before (100-char box-drawing line): 300+ lines of output

After: 6 lines

file.txt:1:
  └──────────────────────────────────────────────────────────────────────────────────────────────────┘
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  U+2500 BOX DRAWINGS LIGHT HORIZONTAL [So] (x98)
  U+2514 BOX DRAWINGS LIGHT UP AND RIGHT [So]
  U+2518 BOX DRAWINGS LIGHT UP AND LEFT [So]

Found 100 non-ASCII characters in 1 file

Test plan

  • All 235 existing tests pass
  • New tests for _compact_ranges, _build_caret_line, _format_codepoint_entry
  • Manual verification with box-drawing, smart quotes, dangerous, and confusable characters
  • Quiet mode, no-color, and file-read-failure edge cases covered

mit-d added 3 commits March 10, 2026 19:18
Instead of printing one block per character (300+ lines for 100 box-drawing
chars), findings are now grouped per file with:
- Compact line range header (e.g. file.txt:1,4-80,90:)
- Context lines shown once with multi-caret markers (^, ! dangerous, ? confusable)
- Deduplicated identical context lines
- Collapsed codepoint listing with (xN) counts
…ct_codepoints

- Extract _is_more_severe() to deduplicate severity-priority logic
  used in both _build_caret_line and _collect_codepoints
- Replace _rendered_width() with inline len(_render_invisible(ch))
- Move stderr side effect out of _collect_codepoints into
  _print_file_findings for better separation of concerns
@mit-d mit-d merged commit 0327e18 into main Mar 11, 2026
4 checks passed
@mit-d mit-d deleted the feat/grouped-output branch March 11, 2026 01:27
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