mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-22 09:01:04 -05:00
fix(cli): Report bad exit code on disallowed
This commit is contained in:
parent
3f41a6791c
commit
3bae999225
3 changed files with 4 additions and 3 deletions
|
@ -89,7 +89,7 @@ impl<'r> MessageStatus<'r> {
|
||||||
|
|
||||||
impl<'r> Report for MessageStatus<'r> {
|
impl<'r> Report for MessageStatus<'r> {
|
||||||
fn report(&self, msg: Message) -> Result<(), std::io::Error> {
|
fn report(&self, msg: Message) -> Result<(), std::io::Error> {
|
||||||
if msg.is_correction() {
|
if msg.is_typo() {
|
||||||
self.typos_found.store(true, atomic::Ordering::Relaxed);
|
self.typos_found.store(true, atomic::Ordering::Relaxed);
|
||||||
}
|
}
|
||||||
if msg.is_error() {
|
if msg.is_error() {
|
||||||
|
|
|
@ -20,10 +20,10 @@ pub enum Message<'m> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'m> Message<'m> {
|
impl<'m> Message<'m> {
|
||||||
pub fn is_correction(&self) -> bool {
|
pub fn is_typo(&self) -> bool {
|
||||||
match self {
|
match self {
|
||||||
Message::BinaryFile(_) => false,
|
Message::BinaryFile(_) => false,
|
||||||
Message::Typo(c) => c.corrections.is_correction(),
|
Message::Typo(c) => !c.corrections.is_valid(),
|
||||||
Message::FileType(_) => false,
|
Message::FileType(_) => false,
|
||||||
Message::File(_) => false,
|
Message::File(_) => false,
|
||||||
Message::Parse(_) => false,
|
Message::Parse(_) => false,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
bin.name = "typos"
|
bin.name = "typos"
|
||||||
|
status.code = 2
|
||||||
stdin = ""
|
stdin = ""
|
||||||
stdout = """
|
stdout = """
|
||||||
error: `hello` is disallowed
|
error: `hello` is disallowed
|
||||||
|
|
Loading…
Reference in a new issue