Re: [PATCH v2] ws: add new tab-between-non-ws check
- From
Adrian Ratiu <adrian.ratiu@collabora.com>
- Date
- Jan 9, 2026, 13:33 UTC
- Message-ID
- <87h5sux64k.fsf@collabora.com>
- In-Reply-To
- <dcd87fc4-6514-4146-9e44-1276bd739d2f@kdbg.org>
On Thu, 08 Jan 2026, Johannes Sixt <j6t@kdbg.org> wrote:
Show 32 quoted lines
> Am 07.01.26 um 18:33 schrieb Johannes Sixt: >> Am 07.01.26 um 02:30 schrieb Adrian Ratiu: >>> The check is a bit complex because we want to detect places where >>> a SP was intended (HT can expand to more than one display column), >>> so we need to count both the display columns (col) and the string >>> character columns (i) to determine if a HT looks identical to a SP >>> or can cause confusion. >>> >>> Highlighting support for tools like git diff/show/log is added, as >>> well as git apply --whitespace=fix capability. >>> >>> The middle section of the line used to be assumed non-highlighted, >>> which is obviously not true anymore, so we split its logic into a >>> separate function named emit_middle_section(). >>> >>> The new check is enabled for Documentation/**/*.adoc, where these >>> kinds of mistakes were seen in practice. It can also be enabled in >>> other locations where it can be useful, by adding to the relevant >>> attributes file. > > This makes me wonder how useful this check is. Yes, I has happened that > I didn't spot at TAB that should have been a SP, but perhaps a handful > of times in my career. Compare this to the many times that the other > kinds of whitespace errors happened. > > Applying the rule to all documentation files is questionable: I can't > format a table with TAB characters between columns reliably, because if > a column happens to be 7 characters wide, the TAB at the 8th position > would be diagnosed, but I certainly do *not* want it to be replaced by a > SP. Yet, I might want legitimate cases outside tables to be diagnosed, so... > > Maybe I'm too much of a devil's advocate here...
I'll let Junio decide on the usefulness of this check since he's the one who asked for it. :)
Maybe we could improve the heuristic to detect tables, for example patterns like a\tb\tc.
I'm ok either way, just let me know if I should pursue this further.