refactor: Move default config to default types

This commit is contained in:
Ed Page 2022-03-09 08:37:22 -06:00
parent 8cb2d44284
commit 560de68f58
2 changed files with 32 additions and 33 deletions

View file

@ -182,8 +182,7 @@ impl TypeEngineConfig {
patterns patterns
.entry("rust".into()) .entry("rust".into())
.or_insert_with(|| GlobEngineConfig { .or_insert_with(|| GlobEngineConfig {
// From a spell-check perspective, these are more closely related to Rust than Toml extend_glob: Vec::new(),
extend_glob: vec!["Cargo.toml".into()],
engine: EngineConfig { engine: EngineConfig {
dict: Some(DictConfig { dict: Some(DictConfig {
extend_words: maplit::hashmap! { extend_words: maplit::hashmap! {
@ -196,40 +195,14 @@ impl TypeEngineConfig {
}, },
}); });
patterns patterns
.entry("python".into()) .entry("cert".into())
.or_insert_with(|| GlobEngineConfig { .or_insert_with(|| GlobEngineConfig {
// From a spell-check perspective, these are more closely related to Python than Toml extend_glob: Vec::new(),
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(),
],
engine: EngineConfig { engine: EngineConfig {
check_file: Some(false), check_file: Some(false),
..Default::default() ..Default::default()
}, },
} });
});
patterns.into_iter() patterns.into_iter()
} }
} }

View file

@ -31,6 +31,24 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
("c", &["*.[chH]", "*.[chH].in", "*.cats"]), ("c", &["*.[chH]", "*.[chH].in", "*.cats"]),
("cabal", &["*.cabal"]), ("cabal", &["*.cabal"]),
("cbor", &["*.cbor"]), ("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"]), ("ceylon", &["*.ceylon"]),
("clojure", &["*.clj", "*.cljc", "*.cljs", "*.cljx"]), ("clojure", &["*.clj", "*.cljc", "*.cljs", "*.cljx"]),
("cmake", &["*.cmake", "CMakeLists.txt"]), ("cmake", &["*.cmake", "CMakeLists.txt"]),
@ -170,7 +188,11 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
("ps", &["*.cdxml", "*.ps1", "*.ps1xml", "*.psd1", "*.psm1"]), ("ps", &["*.cdxml", "*.ps1", "*.ps1xml", "*.psd1", "*.psm1"]),
("puppet", &["*.erb", "*.pp", "*.rb"]), ("puppet", &["*.erb", "*.pp", "*.rb"]),
("purs", &["*.purs"]), ("purs", &["*.purs"]),
("py", &["*.py"]), ("py", &[
"*.py",
// From a spell-check perspective, this is more like Python than toml
"pyproject.toml",
]),
("qmake", &["*.pro", "*.pri", "*.prf"]), ("qmake", &["*.pro", "*.pri", "*.prf"]),
("qml", &["*.qml"]), ("qml", &["*.qml"]),
("r", &["*.R", "*.r", "*.Rmd", "*.Rnw"]), ("r", &["*.R", "*.r", "*.Rmd", "*.Rnw"]),
@ -186,7 +208,11 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
// Extensions // Extensions
"*.gemspec", "*.rb", "*.rbw" "*.gemspec", "*.rb", "*.rbw"
]), ]),
("rust", &["*.rs"]), ("rust", &[
"*.rs",
// From a spell-check perspective, this is more like Python than toml
"Cargo.toml",
]),
("sass", &["*.sass", "*.scss"]), ("sass", &["*.sass", "*.scss"]),
("scala", &["*.scala", "*.sbt"]), ("scala", &["*.scala", "*.sbt"]),
("sh", &[ ("sh", &[