mirror of
https://github.com/crate-ci/typos.git
synced 2024-12-22 23:52:12 -05:00
fix(config): Allow check-file to work
Looks like `deny_unknown_fields` doesn't work with `flatten`. See serde-rs/serde#1547. Fixes #406
This commit is contained in:
parent
9134bec15e
commit
55114b3777
1 changed files with 4 additions and 2 deletions
|
@ -235,7 +235,7 @@ impl TypeEngineConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
||||||
#[serde(deny_unknown_fields)]
|
//#[serde(deny_unknown_fields)] // Doesn't work with `flatten`
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "kebab-case")]
|
||||||
pub struct GlobEngineConfig {
|
pub struct GlobEngineConfig {
|
||||||
|
@ -252,7 +252,7 @@ impl GlobEngineConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
||||||
#[serde(deny_unknown_fields)]
|
//#[serde(deny_unknown_fields)] // Doesn't work with `flatten`
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "kebab-case")]
|
||||||
pub struct EngineConfig {
|
pub struct EngineConfig {
|
||||||
|
@ -575,6 +575,7 @@ mod test {
|
||||||
fn parse_extend_globs() {
|
fn parse_extend_globs() {
|
||||||
let input = r#"[type.po]
|
let input = r#"[type.po]
|
||||||
extend-glob = ["*.po"]
|
extend-glob = ["*.po"]
|
||||||
|
check-file = true
|
||||||
"#;
|
"#;
|
||||||
let mut expected = Config::default();
|
let mut expected = Config::default();
|
||||||
expected.type_.patterns.insert(
|
expected.type_.patterns.insert(
|
||||||
|
@ -584,6 +585,7 @@ extend-glob = ["*.po"]
|
||||||
engine: EngineConfig {
|
engine: EngineConfig {
|
||||||
tokenizer: Some(TokenizerConfig::default()),
|
tokenizer: Some(TokenizerConfig::default()),
|
||||||
dict: Some(DictConfig::default()),
|
dict: Some(DictConfig::default()),
|
||||||
|
check_file: Some(true),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|
Loading…
Reference in a new issue