Skip to content

Commit

Permalink
Improve is_match_path for ignore match at latest 2 chars.
Browse files Browse the repository at this point in the history
  • Loading branch information
huacnlee committed Sep 7, 2023
1 parent 0d7fcf7 commit 6411680
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions autocorrect/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ mod tests {
"来自Yahoo!的文档" => "来自 Yahoo! 的文档",
"规则后面是否跟随者!import以及规则的来源" => "规则后面是否跟随者!import 以及规则的来源",
"对比C++的差别,结果有2+差别" => "对比 C++ 的差别,结果有 2+ 差别",
"交叉编译的 C/C++编译" => "交叉编译的 C/C++ 编译",
];

assert_cases(cases);
Expand Down
3 changes: 2 additions & 1 deletion autocorrect/src/rule/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ lazy_static! {
/// /foo/bar/dar
/// ignore //foo/bar/dar
/// ```
static ref PATH_RE: Regex = regexp!(r"(^[a-zA-Z\d]+://)|(^/?[a-zA-Z\d\-_\.]+/)");
static ref PATH_RE: Regex = regexp!(r"(^[a-zA-Z\d]+://)|(^/?[a-zA-Z\d\-_\.]{2,}/)");
/// Match string is path with hash, e.g.: `foo-a_01.html#测试test`
static ref PATH_HASH_RE: Regex = regexp!(r"[a-zA-Z0-9\-_.]+#[\w\-_.]*[\p{Han}]+[a-zA-Z0-9\-_.]*");
}
Expand Down Expand Up @@ -295,6 +295,7 @@ mod tests {
hello world
你好啊
逐步改善你的C/C++/Zig代码库
测试 C/C++代码
"#};
for case in no_match_cases {
assert!(
Expand Down

0 comments on commit 6411680

Please sign in to comment.