mirror of
https://github.com/crate-ci/typos.git
synced 2024-12-22 23:52:12 -05:00
Revert "feat(ignore): Typos-specific ignores"
This reverts commit 0052617fcd
.
The fix for #134 was backwards. It turns out `overrides` is for
including rather than ignoring. Will need to look at this further.
This commit is contained in:
parent
f0c24b0afa
commit
2ef1d02164
3 changed files with 1 additions and 47 deletions
|
@ -15,7 +15,6 @@ Configuration is read from the following (in precedence order)
|
|||
| Field | Argument | Format | Description |
|
||||
|------------------------|-------------------|--------|-------------|
|
||||
| files.binary | --binary | bool | Check binary files as text |
|
||||
| files.ignore-patterns | | list of strings | Typos-specific ignore globs (gitignore syntax) |
|
||||
| files.ignore-hidden | --hidden | bool | Skip hidden files and directories. |
|
||||
| files.ignore-files | --ignore | bool | Respect ignore files. |
|
||||
| files.ignore-dot | --ignore-dot | bool | Respect .ignore files. |
|
||||
|
|
|
@ -17,16 +17,6 @@ pub trait WalkSource {
|
|||
None
|
||||
}
|
||||
|
||||
/// The root for `ignore_patterns`
|
||||
fn ignore_root(&self) -> Option<&std::path::Path> {
|
||||
None
|
||||
}
|
||||
|
||||
/// Ignore the specified patterns (gitignore syntax)
|
||||
fn ignore_patterns(&self) -> Option<&[String]> {
|
||||
None
|
||||
}
|
||||
|
||||
/// Skip hidden files and directories.
|
||||
fn ignore_hidden(&self) -> Option<bool> {
|
||||
None
|
||||
|
@ -120,9 +110,7 @@ impl Config {
|
|||
let mut file = std::fs::File::open(path)?;
|
||||
let mut s = String::new();
|
||||
file.read_to_string(&mut s)?;
|
||||
let mut c = Self::from_toml(&s)?;
|
||||
c.files.ignore_root = path.parent().map(|p| p.to_owned());
|
||||
Ok(c)
|
||||
Self::from_toml(&s)
|
||||
}
|
||||
|
||||
pub fn from_toml(data: &str) -> Result<Self, anyhow::Error> {
|
||||
|
@ -163,9 +151,6 @@ impl ConfigSource for Config {
|
|||
#[serde(rename_all = "kebab-case")]
|
||||
pub struct Walk {
|
||||
pub binary: Option<bool>,
|
||||
#[serde(skip)]
|
||||
pub ignore_root: Option<std::path::PathBuf>,
|
||||
pub ignore_patterns: Option<Vec<String>>,
|
||||
pub ignore_hidden: Option<bool>,
|
||||
pub ignore_files: Option<bool>,
|
||||
pub ignore_dot: Option<bool>,
|
||||
|
@ -179,10 +164,6 @@ impl Walk {
|
|||
if let Some(source) = source.binary() {
|
||||
self.binary = Some(source);
|
||||
}
|
||||
if let (Some(root), Some(source)) = (source.ignore_root(), source.ignore_patterns()) {
|
||||
self.ignore_root = Some(root.to_owned());
|
||||
self.ignore_patterns = Some(source.to_owned());
|
||||
}
|
||||
if let Some(source) = source.ignore_hidden() {
|
||||
self.ignore_hidden = Some(source);
|
||||
}
|
||||
|
@ -212,14 +193,6 @@ impl Walk {
|
|||
self.binary.unwrap_or(false)
|
||||
}
|
||||
|
||||
pub fn ignore_root(&self) -> Option<&std::path::Path> {
|
||||
self.ignore_root.as_deref()
|
||||
}
|
||||
|
||||
pub fn ignore_patterns(&self) -> Option<&[String]> {
|
||||
self.ignore_patterns.as_deref()
|
||||
}
|
||||
|
||||
pub fn ignore_hidden(&self) -> bool {
|
||||
self.ignore_hidden.unwrap_or(true)
|
||||
}
|
||||
|
@ -249,14 +222,6 @@ impl WalkSource for Walk {
|
|||
self.binary
|
||||
}
|
||||
|
||||
fn ignore_root(&self) -> Option<&std::path::Path> {
|
||||
self.ignore_root.as_deref()
|
||||
}
|
||||
|
||||
fn ignore_patterns(&self) -> Option<&[String]> {
|
||||
self.ignore_patterns.as_deref()
|
||||
}
|
||||
|
||||
fn ignore_hidden(&self) -> Option<bool> {
|
||||
self.ignore_hidden
|
||||
}
|
||||
|
|
10
src/main.rs
10
src/main.rs
|
@ -84,16 +84,6 @@ fn run() -> Result<i32, anyhow::Error> {
|
|||
.git_ignore(config.files.ignore_vcs())
|
||||
.git_exclude(config.files.ignore_vcs())
|
||||
.parents(config.files.ignore_parent());
|
||||
if let (Some(root), Some(patterns)) =
|
||||
(config.files.ignore_root(), config.files.ignore_patterns())
|
||||
{
|
||||
let mut overrides = ignore::overrides::OverrideBuilder::new(root);
|
||||
for pattern in patterns {
|
||||
overrides.add(pattern)?;
|
||||
}
|
||||
let overrides = overrides.build()?;
|
||||
walk.overrides(overrides);
|
||||
}
|
||||
|
||||
let mut reporter = args.format.reporter();
|
||||
let replace_reporter = replace::Replace::new(reporter);
|
||||
|
|
Loading…
Reference in a new issue