From 9e01ccbd3ebadd1ee3993e580808d27ad371fc71 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 19 May 2023 08:11:14 -0500 Subject: [PATCH 1/3] test(cli): Prevent false-positive regressions --- .../typos-cli/tests/cmd/false-positives.in/README.md | 1 + crates/typos-cli/tests/cmd/false-positives.toml | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 crates/typos-cli/tests/cmd/false-positives.in/README.md create mode 100644 crates/typos-cli/tests/cmd/false-positives.toml diff --git a/crates/typos-cli/tests/cmd/false-positives.in/README.md b/crates/typos-cli/tests/cmd/false-positives.in/README.md new file mode 100644 index 0000000..f16cfc8 --- /dev/null +++ b/crates/typos-cli/tests/cmd/false-positives.in/README.md @@ -0,0 +1 @@ +add-ons should not be corrected to add-owns diff --git a/crates/typos-cli/tests/cmd/false-positives.toml b/crates/typos-cli/tests/cmd/false-positives.toml new file mode 100644 index 0000000..8f1381e --- /dev/null +++ b/crates/typos-cli/tests/cmd/false-positives.toml @@ -0,0 +1,12 @@ +bin.name = "typos" +stdin = "" +stdout = """ +error: `ons` should be `owns` + --> ./README.md:1:5 + | +1 | add-ons should not be corrected to add-owns + | ^^^ + | +""" +stderr = "" +status = "failed" From 641e734fe7f55a5413bdcef16c870f3e308f9687 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 19 May 2023 08:13:01 -0500 Subject: [PATCH 2/3] fix(dict): Dont correct add-ons Fixes #721 --- crates/typos-cli/tests/cmd/false-positives.toml | 10 +--------- crates/typos-dict/assets/words.csv | 1 - crates/typos-dict/src/dict_codegen.rs | 2 -- 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/crates/typos-cli/tests/cmd/false-positives.toml b/crates/typos-cli/tests/cmd/false-positives.toml index 8f1381e..324f41d 100644 --- a/crates/typos-cli/tests/cmd/false-positives.toml +++ b/crates/typos-cli/tests/cmd/false-positives.toml @@ -1,12 +1,4 @@ bin.name = "typos" stdin = "" -stdout = """ -error: `ons` should be `owns` - --> ./README.md:1:5 - | -1 | add-ons should not be corrected to add-owns - | ^^^ - | -""" +stdout = "" stderr = "" -status = "failed" diff --git a/crates/typos-dict/assets/words.csv b/crates/typos-dict/assets/words.csv index 9ea43d6..b8b7253 100644 --- a/crates/typos-dict/assets/words.csv +++ b/crates/typos-dict/assets/words.csv @@ -33765,7 +33765,6 @@ onmipotent,omnipotent onmiscient,omniscient onoly,only onot,note,not -ons,owns onsalught,onslaught onself,oneself onservation,conservation,observation diff --git a/crates/typos-dict/src/dict_codegen.rs b/crates/typos-dict/src/dict_codegen.rs index 37b1815..7b3bbe9 100644 --- a/crates/typos-dict/src/dict_codegen.rs +++ b/crates/typos-dict/src/dict_codegen.rs @@ -66466,7 +66466,6 @@ pub static WORD_ON_CHILDREN: dictgen::DictTable<&'static [&'static str]> = dictg dictgen::InsensitiveStr::Ascii("miscient"), dictgen::InsensitiveStr::Ascii("oly"), dictgen::InsensitiveStr::Ascii("ot"), - dictgen::InsensitiveStr::Ascii("s"), dictgen::InsensitiveStr::Ascii("salught"), dictgen::InsensitiveStr::Ascii("self"), dictgen::InsensitiveStr::Ascii("servation"), @@ -66511,7 +66510,6 @@ pub static WORD_ON_CHILDREN: dictgen::DictTable<&'static [&'static str]> = dictg &["omniscient"], &["only"], &["note", "not"], - &["owns"], &["onslaught"], &["oneself"], &["conservation", "observation"], From adfd866ed9bb4537b83903c24e3a6ae79fd3ff6d Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 19 May 2023 08:18:25 -0500 Subject: [PATCH 3/3] test(cli): Check more former false positives --- crates/typos-cli/tests/cmd/false-positives.in/README.md | 6 ++++++ crates/typos-cli/tests/cmd/false-positives.in/sample.py | 1 + crates/typos-cli/tests/cmd/false-positives.in/sample.rs | 3 +++ 3 files changed, 10 insertions(+) create mode 100644 crates/typos-cli/tests/cmd/false-positives.in/sample.py create mode 100644 crates/typos-cli/tests/cmd/false-positives.in/sample.rs diff --git a/crates/typos-cli/tests/cmd/false-positives.in/README.md b/crates/typos-cli/tests/cmd/false-positives.in/README.md index f16cfc8..5871723 100644 --- a/crates/typos-cli/tests/cmd/false-positives.in/README.md +++ b/crates/typos-cli/tests/cmd/false-positives.in/README.md @@ -1 +1,7 @@ add-ons should not be corrected to add-owns + +git glossary has both commitish and committish, so don't correct them + +HTTP_REFERER is a valid HTTP header field + +It should be reasonable to talk about `` diff --git a/crates/typos-cli/tests/cmd/false-positives.in/sample.py b/crates/typos-cli/tests/cmd/false-positives.in/sample.py new file mode 100644 index 0000000..dcf674d --- /dev/null +++ b/crates/typos-cli/tests/cmd/false-positives.in/sample.py @@ -0,0 +1 @@ +from numpy.typing import NDArray # should work diff --git a/crates/typos-cli/tests/cmd/false-positives.in/sample.rs b/crates/typos-cli/tests/cmd/false-positives.in/sample.rs new file mode 100644 index 0000000..de110f9 --- /dev/null +++ b/crates/typos-cli/tests/cmd/false-positives.in/sample.rs @@ -0,0 +1,3 @@ +use serde::ser; + +use flate2::*;