Skip to content

Commit 766f96d

Browse files
caseyGeorgeLS
authored andcommitted
Avoid multi-sentence error messagess (casey#3315)
1 parent d3eac5b commit 766f96d

9 files changed

Lines changed: 19 additions & 19 deletions

src/compile_error.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ impl Display for CompileError<'_> {
203203
),
204204
InconsistentLeadingWhitespace { expected, found } => write!(
205205
f,
206-
"recipe line has inconsistent leading whitespace. Recipe started with `{}` but found \
207-
line with `{}`",
206+
"recipe line has inconsistent leading whitespace, started with `{}` but found line with \
207+
`{}`",
208208
ShowWhitespace(expected),
209209
ShowWhitespace(found)
210210
),
@@ -239,14 +239,14 @@ impl Display for CompileError<'_> {
239239
close,
240240
} => write!(
241241
f,
242-
"mismatched closing delimiter `{}`. (Did you mean to close the `{}` on line {}?)",
242+
"mismatched closing delimiter `{}`, did you mean to close the `{}` on line {}?",
243243
close.close(),
244244
open.open(),
245245
open_line.ordinal(),
246246
),
247247
MixedLeadingWhitespace { whitespace } => write!(
248248
f,
249-
"found a mix of tabs and spaces in leading whitespace: `{}`\nLeading whitespace may \
249+
"found a mix of tabs and spaces in leading whitespace: `{}`\nleading whitespace may \
250250
consist of tabs or spaces, but not both",
251251
ShowWhitespace(whitespace)
252252
),

src/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ impl ColorDisplay for Error<'_> {
632632
Internal { message } => {
633633
write!(
634634
f,
635-
"internal runtime error, this may indicate a bug in just: {message} \
635+
"internal runtime error, this may indicate a bug in just: {message}\n\
636636
consider filing an issue: https://github.com/casey/just/issues/new",
637637
)?;
638638
}
@@ -846,7 +846,7 @@ impl ColorDisplay for Error<'_> {
846846
UnstableFeature { unstable_feature } => {
847847
write!(
848848
f,
849-
"{unstable_feature} Invoke `just` with `--unstable`, set the `JUST_UNSTABLE` environment variable, or add `set unstable` to your `justfile` to enable unstable features.",
849+
"{unstable_feature}, invoke `just` with `--unstable`, set the `JUST_UNSTABLE` environment variable, or add `set unstable` to your `justfile` to enable unstable features",
850850
)?;
851851
}
852852
WriteJustfile { justfile, io_error } => {

src/unstable_feature.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ impl Display for UnstableFeature {
1212
match self {
1313
Self::LogicalOperators => write!(
1414
f,
15-
"the logical operators `&&` and `||` are currently unstable."
15+
"the logical operators `&&` and `||` are currently unstable"
1616
),
1717
Self::UserDefinedFunction => {
18-
write!(f, "user-defined functions are currently unstable.")
18+
write!(f, "user-defined functions are currently unstable")
1919
}
20-
Self::WhichFunction => write!(f, "the `which()` function is currently unstable."),
20+
Self::WhichFunction => write!(f, "the `which()` function is currently unstable"),
2121
}
2222
}
2323
}

tests/delimiters.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ fn mismatched_delimiter() {
66
.justfile("(]")
77
.stderr(
88
"
9-
error: mismatched closing delimiter `]`. (Did you mean to close the `(` on line 1?)
9+
error: mismatched closing delimiter `]`, did you mean to close the `(` on line 1?
1010
——▶ justfile:1:2
1111
1212
1 │ (]

tests/function_definitions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use super::*;
44
fn unstable() {
55
Test::new()
66
.justfile("foo() := 'bar'")
7-
.stderr_regex(r"error: user-defined functions are currently unstable\..*")
7+
.stderr_regex(r"error: user-defined functions are currently unstable,.*")
88
.failure();
99
}
1010

tests/logical_operators.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ fn logical_operators_are_unstable() {
1515
Test::new()
1616
.justfile("x := 'foo' && 'bar'")
1717
.args(["--evaluate", "x"])
18-
.stderr_regex(r"error: the logical operators `&&` and `\|\|` are currently unstable. .*")
18+
.stderr_regex(r"error: the logical operators `&&` and `\|\|` are currently unstable, .*")
1919
.failure();
2020

2121
Test::new()
2222
.justfile("x := 'foo' || 'bar'")
2323
.args(["--evaluate", "x"])
24-
.stderr_regex(r"error: the logical operators `&&` and `\|\|` are currently unstable. .*")
24+
.stderr_regex(r"error: the logical operators `&&` and `\|\|` are currently unstable, .*")
2525
.failure();
2626
}
2727

tests/misc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ fn mixed_whitespace() {
833833
.justfile("bar:\n\t echo hello")
834834
.stderr(
835835
"error: found a mix of tabs and spaces in leading whitespace: `␉␠`
836-
Leading whitespace may consist of tabs or spaces, but not both
836+
leading whitespace may consist of tabs or spaces, but not both
837837
——▶ justfile:2:1
838838
839839
2 │ echo hello
@@ -863,8 +863,8 @@ fn inconsistent_leading_whitespace() {
863863
Test::new()
864864
.justfile("bar:\n\t\techo hello\n\t echo goodbye")
865865
.stderr(
866-
"error: recipe line has inconsistent leading whitespace. \
867-
Recipe started with `␉␉` but found line with `␉␠`
866+
"error: recipe line has inconsistent leading whitespace, \
867+
started with `␉␉` but found line with `␉␠`
868868
——▶ justfile:3:1
869869
870870
3 │ echo goodbye

tests/unstable.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fn set_unstable_false_with_env_var() {
1919
.justfile("f(a) := a")
2020
.arg("--dump")
2121
.env("JUST_UNSTABLE", val)
22-
.stderr_regex("error: user-defined functions are currently unstable.*")
22+
.stderr_regex("error: user-defined functions are currently unstable,.*")
2323
.failure();
2424
}
2525
}
@@ -29,7 +29,7 @@ fn set_unstable_false_with_env_var_unset() {
2929
Test::new()
3030
.justfile("f(a) := a")
3131
.arg("--dump")
32-
.stderr_regex("error: user-defined functions are currently unstable.*")
32+
.stderr_regex("error: user-defined functions are currently unstable,.*")
3333
.failure();
3434
}
3535

tests/which_function.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ fn is_unstable() {
230230
.write("hello.exe", HELLO_SCRIPT)
231231
.make_executable("hello.exe")
232232
.env("PATH", path.to_str().unwrap())
233-
.stderr_regex(r".*the `which\(\)` function is currently unstable\..*")
233+
.stderr_regex(r".*the `which\(\)` function is currently unstable,.*")
234234
.failure();
235235
}
236236

0 commit comments

Comments
 (0)