Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions ci/sembr/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ static REGEX_IGNORE: LazyLock<Regex> =
static REGEX_IGNORE_END: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"(\.|\?|;|!)$").unwrap());
static REGEX_IGNORE_LINK_TARGETS: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r"^\[.+\]: ").unwrap());
static REGEX_SPLIT: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"(\.|\?|;|!)\s+").unwrap());
static REGEX_SPLIT: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"(\.|[^r]\?|;|!)\s+").unwrap());

fn main() -> Result<()> {
let cli = Cli::parse();
Expand Down Expand Up @@ -92,7 +92,7 @@ fn display(header: &str, paths: &[PathBuf]) {

fn ignore(line: &str, in_code_block: bool) -> bool {
in_code_block
|| line.contains("e.g.")
|| line.to_lowercase().contains("e.g.")
|| line.contains("i.e.")
|| line.contains('|')
|| line.trim_start().starts_with('>')
Expand Down Expand Up @@ -174,7 +174,9 @@ fn test_sembr() {
must! be; split? and. normalizes space
1. ignore numbered
ignore | tables
ignore e.g. and i.e.
ignore e.g. and
ignore i.e. and
ignore E.g. too
- ignore. list
* ignore. list
```
Expand All @@ -191,7 +193,9 @@ and.
normalizes space
1. ignore numbered
ignore | tables
ignore e.g. and i.e.
ignore e.g. and
ignore i.e. and
ignore E.g. too
- ignore. list
* ignore. list
```
Expand Down Expand Up @@ -269,3 +273,19 @@ hi again.
let processed = lengthen_lines(&processed, 50);
assert_eq!(expected, processed);
}

#[test]
fn test_sembr_question_mark() {
let original = "\
o? whatever
r? @reviewer
r? @reviewer
";
let expected = "\
o?
whatever
r? @reviewer
r? @reviewer
";
assert_eq!(expected, comply(original));
}
Loading
Loading