Fix audit-ignore rule scoping - #777
Conversation
Adjust the audit-translations parser so `# audit-ignore` markers immediately above a rule apply to that rule, while still supporting existing inline markers inside a rule block. This also clarifies the documented behavior and adds regression tests for leading, inline, and first-item ignore cases.
|
logic looks correct, tests make sense and cover the important parts. |
on a side-note, I'm not really happy with how the formatting of the first vs. second line of these YAML strings looks. Or is there anything else I'm missing here? |
|
Numbers for the trailing-comment case, measured on There are 1,140 comment runs between consecutive rules. Splitting them by whether a blank line sits above the run:
The middle group is worth calling out: - # intervals are controlled by a ClearSpeak Preference ...
name: ClearSpeak-intervals
The third group is the one flagged in #742. A predicate that keeps it with the previous rule, while still fixing the other two, is three branches when walking up from I ran that over the tree and it yields exactly the same set of ignored rules as this PR — 0 differences — both differing from One more shape, whichever way this goes: a marker written on the dash line itself ( |
This change fixes how audit_translations YAML blocks are split when comments or blank lines appear around list items. It keeps introductory comments with the correct rule, preserves explicit audit-ignore markers inside a rule, and avoids incorrectly attaching comment-only lines to neighboring items.
|
thanks for your work. merged! |
|
Thanks for merging. I measured the merged The corpus is the 174 non- The attribution moves by exactly one pair, and it moves where it should. Rules whose block satisfies
The marker itself reads "parity placeholder for English tag list without changing the existing Russian none-specific rule above", so the rule below it is the one it was written for. End to end, The dash-line form is fixed as well. With the marker on the item's own dash line - # audit-ignore
name: secondthe merge base attributes it to the preceding rule and main now attributes it to One boundary worth writing down, with no action needed today: a marker on an indented line under the dash line, with no blank above it, still goes to the preceding rule. -
# audit-ignore
name: second(the same if the dash line already carries a comment). In |
Adjust the audit-translations parser so
# audit-ignoremarkers immediately above a rule apply to that rule, while still supporting existing inline markers inside a rule block. This also clarifies the documented behavior and adds regression tests for leading, inline, and first-item ignore cases.• Closes #742