Skip to content

feat: add automatic per-extension whitespace comparison - #729

Merged
agavra merged 2 commits into
agavra:mainfrom
mvanhorn:fix/700-smart-whitespace-tuicr
Sep 19, 2026
Merged

agavra merged 2 commits into
agavra:mainfrom
mvanhorn:fix/700-smart-whitespace-tuicr

Conversation

@mvanhorn

Copy link
Copy Markdown
Contributor

Extend configuration to accept the existing booleans plus the opt-in string ignore_whitespace = "auto", keeping omitted/false as Normal and true as IgnoreAll, and add an ignore_whitespace_overrides TOML table mapping extensions to explicit booleans used only in auto mode. Supply a small documented built-in auto table (json, js, jsx, mjs, cjs, ts, tsx, rs ignore whitespace; unknown extensions, extensionless files, Python and YAML compare normally); user entries replace the decision for an extension, never invert their meaning, and describe this as a review heuristic rather than language-semantic equivalence. Issue #700 requests automatic whitespace comparison by file type, retaining whitespace changes for Python/YAML while allowing formatting noise to be ignored for JSON/JavaScript/Rust. Owner agavra explicitly welcomes a default configuration with user overrides; the reporter proposes extension-based configuration and warns that an exception list whose meaning reverses with another boolean would be confusing.

Config tests in src/config/mod.rs: omitted/true/false compatibility, auto defaults, explicit true and false overrides, empty table, inactive-table warning, invalid strings/types, malformed extension keys and normalized collisions. Existing invalid-boolean expectations must be updated deliberately for the expanded accepted syntax; Policy/selection tests in the new production module: uppercase extensions, multi-dot names, extensionless/dotfiles, non-UTF-8 paths where supported, destination-versus-source choice for renames/deletions, and reordered/missing ignored records. Verify original file order and that selected hunk coordinates/content hashes survive unchanged.

Fixes #700

AI was used for assistance.

@agavra agavra left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Reviewed leniently; no remaining actionable findings. Integrated current main, added the missing pr_comments_visibility field to the test initializer, and moved the detailed whitespace configuration documentation from README.md to docs/CONFIG.md. Validation: cargo fmt, cargo clippy, and cargo test passed (1,785 tests passed, 4 ignored); documentation TOML examples also parse.

@agavra
agavra merged commit 61767fb into agavra:main Sep 19, 2026
2 checks passed
@jokeyrhyme

Copy link
Copy Markdown

wow thanks!

@mvanhorn

Copy link
Copy Markdown
Contributor Author

Thanks for the merge, @agavra. Omitted and false still map to Normal, so this stays opt-in for anyone who does not want auto mode.

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.

smart/auto ignore whitespace

3 participants