mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-21 16:41:01 -05:00
Add "--force-exclude" option
This commit is contained in:
parent
442b1199da
commit
8314a1567d
6 changed files with 17 additions and 13 deletions
|
@ -3,7 +3,7 @@
|
||||||
description: Source code spell checker, binary install
|
description: Source code spell checker, binary install
|
||||||
language: python
|
language: python
|
||||||
entry: typos
|
entry: typos
|
||||||
args: [--write-changes]
|
args: [--write-changes, --force-exclude]
|
||||||
types: [text]
|
types: [text]
|
||||||
stages: [commit, merge-commit, push, manual]
|
stages: [commit, merge-commit, push, manual]
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
description: Source code spell checker, Docker image
|
description: Source code spell checker, Docker image
|
||||||
language: docker
|
language: docker
|
||||||
entry: typos
|
entry: typos
|
||||||
args: [--write-changes]
|
args: [--write-changes, --force-exclude]
|
||||||
types: [text]
|
types: [text]
|
||||||
stages: [commit, merge-commit, push, manual]
|
stages: [commit, merge-commit, push, manual]
|
||||||
|
|
||||||
|
@ -21,6 +21,6 @@
|
||||||
description: Source code spell checker, source install
|
description: Source code spell checker, source install
|
||||||
language: rust
|
language: rust
|
||||||
entry: typos
|
entry: typos
|
||||||
args: [--write-changes]
|
args: [--write-changes, --force-exclude]
|
||||||
types: [text]
|
types: [text]
|
||||||
stages: [commit, merge-commit, push, manual]
|
stages: [commit, merge-commit, push, manual]
|
||||||
|
|
|
@ -46,6 +46,10 @@ pub(crate) struct Args {
|
||||||
#[arg(short = 'j', long = "threads", default_value = "0")]
|
#[arg(short = 'j', long = "threads", default_value = "0")]
|
||||||
pub(crate) threads: usize,
|
pub(crate) threads: usize,
|
||||||
|
|
||||||
|
/// Respect excluded files even for paths passed explicitly.
|
||||||
|
#[arg(long, help_heading = None)]
|
||||||
|
pub(crate) force_exclude: bool,
|
||||||
|
|
||||||
/// Custom config file
|
/// Custom config file
|
||||||
#[arg(short = 'c', long = "config", help_heading = "Config")]
|
#[arg(short = 'c', long = "config", help_heading = "Config")]
|
||||||
pub(crate) custom_config: Option<std::path::PathBuf>,
|
pub(crate) custom_config: Option<std::path::PathBuf>,
|
||||||
|
|
|
@ -216,6 +216,11 @@ fn run_checks(args: &args::Args) -> proc_exit::ExitResult {
|
||||||
let overrides = overrides
|
let overrides = overrides
|
||||||
.build()
|
.build()
|
||||||
.with_code(proc_exit::sysexits::CONFIG_ERR)?;
|
.with_code(proc_exit::sysexits::CONFIG_ERR)?;
|
||||||
|
if args.force_exclude {
|
||||||
|
if let ignore::Match::Ignore(_) = overrides.matched(path, path.is_dir()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
walk.overrides(overrides);
|
walk.overrides(overrides);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,6 @@
|
||||||
bin.name = "typos"
|
bin.name = "typos"
|
||||||
args = "file.ignore"
|
args = "file.ignore --force-exclude"
|
||||||
stdin = ""
|
stdin = ""
|
||||||
stdout = """
|
stdout = ""
|
||||||
error: `hello` should be `goodbye`
|
|
||||||
--> file.ignore:1:1
|
|
||||||
|
|
|
||||||
1 | hello
|
|
||||||
| ^^^^^
|
|
||||||
|
|
|
||||||
"""
|
|
||||||
stderr = ""
|
stderr = ""
|
||||||
status.code = 2
|
status.code = 0
|
||||||
|
|
|
@ -10,6 +10,7 @@ Arguments:
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-j, --threads <THREADS> The approximate number of threads to use [default: 0]
|
-j, --threads <THREADS> The approximate number of threads to use [default: 0]
|
||||||
|
--force-exclude Respect excluded files even for paths passed explicitly
|
||||||
-h, --help Print help
|
-h, --help Print help
|
||||||
-V, --version Print version
|
-V, --version Print version
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ Configuration is read from the following (in precedence order)
|
||||||
|------------------------|-------------------|--------|-------------|
|
|------------------------|-------------------|--------|-------------|
|
||||||
| files.binary | --binary | bool | Check binary files as text |
|
| files.binary | --binary | bool | Check binary files as text |
|
||||||
| files.extend-exclude | --exclude | list of strings | Typos-specific ignore globs (gitignore syntax) |
|
| files.extend-exclude | --exclude | list of strings | Typos-specific ignore globs (gitignore syntax) |
|
||||||
|
| file.force-excude | --force-exclude | bool | Respect excluded files even for paths passed explicitly. |
|
||||||
| files.ignore-hidden | --hidden | bool | Skip hidden files and directories. |
|
| files.ignore-hidden | --hidden | bool | Skip hidden files and directories. |
|
||||||
| files.ignore-files | --ignore | bool | Respect ignore files. |
|
| files.ignore-files | --ignore | bool | Respect ignore files. |
|
||||||
| files.ignore-dot | --ignore-dot | bool | Respect .ignore files. |
|
| files.ignore-dot | --ignore-dot | bool | Respect .ignore files. |
|
||||||
|
|
Loading…
Reference in a new issue