mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-22 09:01:04 -05:00
Merge pull request #762 from epage/config
fix(config): Force-skip config files
This commit is contained in:
commit
2868856df4
6 changed files with 9 additions and 19 deletions
|
@ -2,6 +2,8 @@ use std::collections::HashMap;
|
||||||
|
|
||||||
use kstring::KString;
|
use kstring::KString;
|
||||||
|
|
||||||
|
pub const SUPPORTED_FILE_NAMES: &[&str] = &["typos.toml", "_typos.toml", ".typos.toml"];
|
||||||
|
|
||||||
#[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)]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
|
@ -17,9 +19,7 @@ pub struct Config {
|
||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
pub fn from_dir(cwd: &std::path::Path) -> Result<Option<Self>, anyhow::Error> {
|
pub fn from_dir(cwd: &std::path::Path) -> Result<Option<Self>, anyhow::Error> {
|
||||||
let config = if let Some(path) =
|
let config = if let Some(path) = find_project_file(cwd, SUPPORTED_FILE_NAMES) {
|
||||||
find_project_file(cwd, &["typos.toml", "_typos.toml", ".typos.toml"])
|
|
||||||
{
|
|
||||||
log::debug!("Loading {}", path.display());
|
log::debug!("Loading {}", path.display());
|
||||||
Some(Self::from_file(&path)?)
|
Some(Self::from_file(&path)?)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -684,6 +684,12 @@ fn walk_entry(
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
if crate::config::SUPPORTED_FILE_NAMES
|
||||||
|
.iter()
|
||||||
|
.any(|n| *n == entry.file_name())
|
||||||
|
{
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
if entry.file_type().map(|t| t.is_file()).unwrap_or(true) {
|
if entry.file_type().map(|t| t.is_file()).unwrap_or(true) {
|
||||||
let explicit = entry.depth() == 0;
|
let explicit = entry.depth() == 0;
|
||||||
let (path, lookup_path) = if entry.is_stdin() {
|
let (path, lookup_path) = if entry.is_stdin() {
|
||||||
|
|
|
@ -3,8 +3,3 @@ check-filename = false
|
||||||
|
|
||||||
[default.extend-words]
|
[default.extend-words]
|
||||||
foo = "bar"
|
foo = "bar"
|
||||||
|
|
||||||
[files]
|
|
||||||
extend-exclude = [
|
|
||||||
"_typos.toml"
|
|
||||||
]
|
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
[files]
|
|
||||||
extend-exclude = ["_typos.toml"]
|
|
||||||
|
|
||||||
[default.extend-identifiers]
|
[default.extend-identifiers]
|
||||||
hello = "goodbye"
|
hello = "goodbye"
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
[files]
|
|
||||||
extend-exclude = ["_typos.toml"]
|
|
||||||
|
|
||||||
[default]
|
[default]
|
||||||
extend-ignore-re = ["`.*`"]
|
extend-ignore-re = ["`.*`"]
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,3 @@ check-file = false
|
||||||
|
|
||||||
[default.extend-words]
|
[default.extend-words]
|
||||||
foo = "bar"
|
foo = "bar"
|
||||||
|
|
||||||
[files]
|
|
||||||
extend-exclude = [
|
|
||||||
"_typos.toml"
|
|
||||||
]
|
|
||||||
|
|
Loading…
Reference in a new issue