From 560de68f5810748ce5635794d8b007648583521f Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 9 Mar 2022 08:37:22 -0600 Subject: [PATCH] refactor: Move default config to default types --- src/config.rs | 35 ++++------------------------------- src/default_types.rs | 30 ++++++++++++++++++++++++++++-- 2 files changed, 32 insertions(+), 33 deletions(-) diff --git a/src/config.rs b/src/config.rs index f7b64a1..3094eea 100644 --- a/src/config.rs +++ b/src/config.rs @@ -182,8 +182,7 @@ impl TypeEngineConfig { patterns .entry("rust".into()) .or_insert_with(|| GlobEngineConfig { - // From a spell-check perspective, these are more closely related to Rust than Toml - extend_glob: vec!["Cargo.toml".into()], + extend_glob: Vec::new(), engine: EngineConfig { dict: Some(DictConfig { extend_words: maplit::hashmap! { @@ -196,40 +195,14 @@ impl TypeEngineConfig { }, }); patterns - .entry("python".into()) + .entry("cert".into()) .or_insert_with(|| GlobEngineConfig { - // From a spell-check perspective, these are more closely related to Python than Toml - extend_glob: vec!["pyproject.toml".into()], - engine: EngineConfig { - ..Default::default() - }, - }); - patterns.entry("cert".into()).or_insert_with(|| { - GlobEngineConfig { - extend_glob: vec![ - // Certificate files: - "*.crt".into(), - "*.cer".into(), - "*.ca-bundle".into(), - "*.p7b".into(), - "*.p7c".into(), - "*.p7s".into(), - "*.pem".into(), - // Keystore Files: - "*.key".into(), - "*.keystore".into(), - "*.jks".into(), - // Combined certificate and key files: - "*.p12".into(), - "*.pfx".into(), - "*.pem".into(), - ], + extend_glob: Vec::new(), engine: EngineConfig { check_file: Some(false), ..Default::default() }, - } - }); + }); patterns.into_iter() } } diff --git a/src/default_types.rs b/src/default_types.rs index 519bb4c..eaaa57e 100644 --- a/src/default_types.rs +++ b/src/default_types.rs @@ -31,6 +31,24 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[ ("c", &["*.[chH]", "*.[chH].in", "*.cats"]), ("cabal", &["*.cabal"]), ("cbor", &["*.cbor"]), + ("cert", &[ + // Certificate files: + "*.crt", + "*.cer", + "*.ca-bundle", + "*.p7b", + "*.p7c", + "*.p7s", + "*.pem", + // Keystore Files: + "*.key", + "*.keystore", + "*.jks", + // Combined certificate and key files: + "*.p12", + "*.pfx", + "*.pem", + ]), ("ceylon", &["*.ceylon"]), ("clojure", &["*.clj", "*.cljc", "*.cljs", "*.cljx"]), ("cmake", &["*.cmake", "CMakeLists.txt"]), @@ -170,7 +188,11 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[ ("ps", &["*.cdxml", "*.ps1", "*.ps1xml", "*.psd1", "*.psm1"]), ("puppet", &["*.erb", "*.pp", "*.rb"]), ("purs", &["*.purs"]), - ("py", &["*.py"]), + ("py", &[ + "*.py", + // From a spell-check perspective, this is more like Python than toml + "pyproject.toml", + ]), ("qmake", &["*.pro", "*.pri", "*.prf"]), ("qml", &["*.qml"]), ("r", &["*.R", "*.r", "*.Rmd", "*.Rnw"]), @@ -186,7 +208,11 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[ // Extensions "*.gemspec", "*.rb", "*.rbw" ]), - ("rust", &["*.rs"]), + ("rust", &[ + "*.rs", + // From a spell-check perspective, this is more like Python than toml + "Cargo.toml", + ]), ("sass", &["*.sass", "*.scss"]), ("scala", &["*.scala", "*.sbt"]), ("sh", &[