fix sembr tool corner case

This commit is contained in:
Tshepang Mbambo 2026-01-29 23:13:39 +02:00
parent dd8ae230c7
commit dd4870d0cc
2 changed files with 5 additions and 4 deletions

View file

@ -24,7 +24,7 @@ static REGEX_IGNORE_END: LazyLock<Regex> =
static REGEX_IGNORE_LINK_TARGETS: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r"^\[.+\]: ").unwrap());
static REGEX_SPLIT: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r"([^\.\d\-\*]\.|[^r]\?|!)\s").unwrap());
LazyLock::new(|| Regex::new(r"([^\.\d\-\*]\.|[^r\~]\?|!)\s").unwrap());
// list elements, numbered (1.) or not (- and *)
static REGEX_LIST_ENTRY: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r"^\s*(\d\.|\-|\*|\d\))\s+").unwrap());
@ -205,6 +205,7 @@ git log main.. compiler
o? whatever
r? @reviewer
r? @reviewer
~? diagnostic
";
let expected = "
# some. heading
@ -237,6 +238,7 @@ o?
whatever
r? @reviewer
r? @reviewer
~? diagnostic
";
assert_eq!(expected, comply(original));
}

View file

@ -232,9 +232,8 @@ The space character between `//~` (or other variants) and the subsequent text is
negligible (i.e. there is no semantic difference between `//~ ERROR` and
`//~ERROR` although the former is more common in the codebase).
`~?
<diagnostic kind>` (example being `~?
ERROR`) is used to match diagnostics _without_ line info at all,
`~? <diagnostic kind>` (example being `~? ERROR`)
is used to match diagnostics _without_ line info at all,
or where the line info is outside the main test file[^main test file].
These annotations can be placed on any line in the test file.