Skip to content

Commit 25be5cb

Browse files
committed
refactor(check): improve clarity of suppress_unmatched branches
Invert the empty if-branch into a negated guard condition. Improve comments to explain the asymmetry between fmt and lint None arms: oxfmt handles the flag natively (exits 0), while oxlint does not (exits non-zero), requiring an explicit status override.
1 parent 54bab41 commit 25be5cb

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

  • packages/cli/binding/src/check

packages/cli/binding/src/check/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ pub(crate) async fn execute_check(
9494
));
9595
}
9696
None => {
97-
if suppress_unmatched && status == ExitStatus::SUCCESS {
98-
// No files matched fmt patterns — treat as pass when
99-
// --no-error-on-unmatched-pattern is active (explicit or
100-
// implicit via --fix with paths).
101-
} else {
97+
// oxfmt handles --no-error-on-unmatched-pattern natively and
98+
// exits 0 when no files match, so we only need to guard
99+
// against the edge case where output is unparseable but the
100+
// process still succeeded.
101+
if !(suppress_unmatched && status == ExitStatus::SUCCESS) {
102102
print_error_block(
103103
"Formatting could not start",
104104
&combined_output,
@@ -191,9 +191,9 @@ pub(crate) async fn execute_check(
191191
}
192192
None => {
193193
if suppress_unmatched {
194-
// oxlint does not support --no-error-on-unmatched-pattern natively,
195-
// so we handle it here: when all files are excluded by ignorePatterns
196-
// and the flag is active, treat it as a pass instead of an error.
194+
// oxlint does not support --no-error-on-unmatched-pattern natively
195+
// and exits non-zero when no files match, so we must override the
196+
// status here (unlike fmt, where oxfmt handles the flag and exits 0).
197197
status = ExitStatus::SUCCESS;
198198
} else {
199199
output::error("Linting could not start");

0 commit comments

Comments
 (0)