mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-22 09:01:04 -05:00
commit
3f0bea125d
3 changed files with 40 additions and 2 deletions
|
@ -87,13 +87,13 @@ serde_json = "1.0"
|
|||
encoding = "0.2"
|
||||
kstring = "1.0"
|
||||
typed-arena = "2.0.1"
|
||||
maplit = "1.0"
|
||||
|
||||
[dev-dependencies]
|
||||
assert_fs = "1.0"
|
||||
assert_cmd = "2.0"
|
||||
predicates = "2.0"
|
||||
criterion = "0.3"
|
||||
maplit = "1.0"
|
||||
|
||||
[profile.dev]
|
||||
panic = "abort"
|
||||
|
|
|
@ -167,6 +167,40 @@ impl TypeEngineConfig {
|
|||
|
||||
pub fn patterns(&self) -> impl Iterator<Item = (kstring::KString, GlobEngineConfig)> {
|
||||
let mut patterns = self.patterns.clone();
|
||||
patterns
|
||||
.entry("lock".into())
|
||||
.or_insert_with(|| GlobEngineConfig {
|
||||
extend_glob: Vec::new(),
|
||||
engine: EngineConfig {
|
||||
check_file: Some(false),
|
||||
..Default::default()
|
||||
},
|
||||
});
|
||||
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()],
|
||||
engine: EngineConfig {
|
||||
dict: Some(DictConfig {
|
||||
extend_words: maplit::hashmap! {
|
||||
"flate".into() => "flate".into(),
|
||||
"ser".into() => "ser".into(),
|
||||
},
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
},
|
||||
});
|
||||
patterns
|
||||
.entry("python".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![
|
||||
|
|
|
@ -194,7 +194,11 @@ impl<'s> ConfigEngine<'s> {
|
|||
}
|
||||
}
|
||||
|
||||
let type_config = self.init_file_config(type_engine.engine);
|
||||
let mut engine = default.clone();
|
||||
engine.update(&type_engine.engine);
|
||||
engine.update(&overrides);
|
||||
|
||||
let type_config = self.init_file_config(engine);
|
||||
types.insert(type_name, type_config);
|
||||
}
|
||||
default.update(&overrides);
|
||||
|
|
Loading…
Reference in a new issue