Merge pull request #799 from epage/code

fix(cli): Report bad exit code on disallowed
This commit is contained in:
Ed Page
2023-08-09 08:34:17 -05:00
committed by GitHub
5 changed files with 24 additions and 3 deletions
+1 -1
View File
@@ -89,7 +89,7 @@ impl<'r> MessageStatus<'r> {
impl<'r> Report for MessageStatus<'r> {
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);
}
if msg.is_error() {
+2 -2
View File
@@ -20,10 +20,10 @@ pub enum Message<'m> {
}
impl<'m> Message<'m> {
pub fn is_correction(&self) -> bool {
pub fn is_typo(&self) -> bool {
match self {
Message::BinaryFile(_) => false,
Message::Typo(c) => c.corrections.is_correction(),
Message::Typo(c) => !c.corrections.is_valid(),
Message::FileType(_) => false,
Message::File(_) => false,
Message::Parse(_) => false,
@@ -0,0 +1,2 @@
[default.extend-identifiers]
hello = ""
@@ -0,0 +1 @@
hello `hello`
@@ -0,0 +1,18 @@
bin.name = "typos"
status.code = 2
stdin = ""
stdout = """
error: `hello` is disallowed
--> ./file:1:1
|
1 | hello `hello`
| ^^^^^
|
error: `hello` is disallowed
--> ./file:1:8
|
1 | hello `hello`
| ^^^^^
|
"""
stderr = ""