From d543202e5bd860941717ab90a3ca136658d7cb62 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 19 Jan 2024 10:16:01 -0600 Subject: [PATCH 1/2] fix(config): Remove confusing, redundant types --- crates/typos-cli/src/default_types.rs | 7 ------- crates/typos-cli/src/file_type_specifics.rs | 9 --------- 2 files changed, 16 deletions(-) diff --git a/crates/typos-cli/src/default_types.rs b/crates/typos-cli/src/default_types.rs index b869bb4c8..161fd0da2 100644 --- a/crates/typos-cli/src/default_types.rs +++ b/crates/typos-cli/src/default_types.rs @@ -39,7 +39,6 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[ "*.p7b", "*.p7c", "*.p7s", - "*.pem", // Keystore Files: "*.key", "*.keystore", @@ -61,7 +60,6 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[ ]), ("creole", &["*.creole"]), ("crystal", &["Projectfile", "*.cr", "*.ecr", "shard.yml"]), - ("cs", &["*.cs"]), ("csharp", &["*.cs"]), ("cshtml", &["*.cshtml"]), ("css", &["*.css", "*.scss"]), @@ -99,7 +97,6 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[ ("gzip", &["*.gz", "*.tgz"]), ("h", &["*.h", "*.hpp"]), ("haml", &["*.haml"]), - ("haskell", &["*.hs", "*.lhs", "*.cpphs", "*.c2hs", "*.hsc"]), ("hbs", &["*.hbs"]), ("hs", &["*.hs", "*.lhs"]), ("html", &["*.htm", "*.html", "*.ejs"]), @@ -159,7 +156,6 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[ ]), ("mako", &["*.mako", "*.mao"]), ("man", &["*.[0-9lnpx]", "*.[0-9][cEFMmpSx]"]), - ("markdown", &["*.markdown", "*.md", "*.mdown", "*.mkdn"]), ("matlab", &["*.m"]), ("md", &["*.markdown", "*.md", "*.mdown", "*.mkdn"]), ("meson", &["meson.build", "meson_options.txt"]), @@ -271,9 +267,6 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[ ("vcl", &["*.vcl"]), ("verilog", &["*.v", "*.vh", "*.sv", "*.svh"]), ("vhdl", &["*.vhd", "*.vhdl"]), - ("vim", &[ - "*.vim", ".vimrc", ".gvimrc", "vimrc", "gvimrc", "_vimrc", "_gvimrc", - ]), ("vimscript", &[ "*.vim", ".vimrc", ".gvimrc", "vimrc", "gvimrc", "_vimrc", "_gvimrc", ]), diff --git a/crates/typos-cli/src/file_type_specifics.rs b/crates/typos-cli/src/file_type_specifics.rs index 3a69e0f66..482b0d074 100644 --- a/crates/typos-cli/src/file_type_specifics.rs +++ b/crates/typos-cli/src/file_type_specifics.rs @@ -67,15 +67,6 @@ pub const TYPE_SPECIFIC_DICTS: &[(&str, StaticDictConfig)] = &[ ignore_words: &[], }, ), - ( - "vim", - StaticDictConfig { - ignore_idents: &[ - "windo", // https://vimdoc.sourceforge.net/htmldoc/windows.html#:windo - ], - ignore_words: &[], - }, - ), ( "vimscript", StaticDictConfig { From fe1a73ca8afd4ac3f62de1728af2264a9468d946 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 19 Jan 2024 10:26:22 -0600 Subject: [PATCH 2/2] fix(config): Don't treat ts as typoscript Fixes #911 --- crates/typos-cli/src/default_types.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/crates/typos-cli/src/default_types.rs b/crates/typos-cli/src/default_types.rs index 161fd0da2..db71bf58c 100644 --- a/crates/typos-cli/src/default_types.rs +++ b/crates/typos-cli/src/default_types.rs @@ -261,7 +261,7 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[ ("ts", &["*.ts", "*.tsx"]), ("twig", &["*.twig"]), ("txt", &["*.txt"]), - ("typoscript", &["*.typoscript", "*.ts"]), + ("typoscript", &["*.typoscript"]), ("vala", &["*.vala"]), ("vb", &["*.vb"]), ("vcl", &["*.vcl"]), @@ -292,3 +292,20 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[ ]), ("zstd", &["*.zst", "*.zstd"]), ]; + +// See `cargo test --lib -- --nocapture default_types::check_duplicates` +#[test] +fn check_duplicates() { + let mut reverse = std::collections::BTreeMap::new(); + for (name, exts) in DEFAULT_TYPES { + for ext in *exts { + reverse.entry(ext).or_insert(Vec::new()).push(name); + } + } + + for (ext, names) in reverse { + if 1 < names.len() { + println!("{ext} is under multiple names: {names:?}"); + } + } +}