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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,4 @@ jobs:
continue-on-error: true
run: |
# using split_inclusive that uses regex feature that uses an unstable feature
RUSTC_BOOTSTRAP=true cargo run --manifest-path ci/sembr/Cargo.toml src
RUSTC_BOOTSTRAP=1 cargo run --manifest-path ci/sembr/Cargo.toml src
12 changes: 12 additions & 0 deletions ci/sembr/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ struct Cli {
static REGEX_IGNORE: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r"^\s*(\d\.|\-|\*)\s+").unwrap());
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());

fn main() -> Result<()> {
Expand Down Expand Up @@ -94,6 +96,7 @@ fn ignore(line: &str, in_code_block: bool) -> bool {
|| line.starts_with('#')
|| line.trim().is_empty()
|| REGEX_IGNORE.is_match(line)
|| REGEX_IGNORE_LINK_TARGETS.is_match(line)
}

fn comply(content: &str) -> String {
Expand Down Expand Up @@ -221,6 +224,15 @@ fn test_prettify_prefix_spaces() {
assert_eq!(expected, lengthen_lines(original, 50));
}

#[test]
fn test_prettify_ignore_link_targets() {
let original = "\
[a target]: https://example.com
[another target]: https://example.com
";
assert_eq!(original, lengthen_lines(original, 100));
}

#[test]
fn test_sembr_then_prettify() {
let original = "\
Expand Down
Loading
Loading