diff --git a/apps/oxlint/src/command/lint.rs b/apps/oxlint/src/command/lint.rs index 599f8e51011a3..c39d59c45077d 100644 --- a/apps/oxlint/src/command/lint.rs +++ b/apps/oxlint/src/command/lint.rs @@ -245,10 +245,21 @@ pub struct WarningOptions { pub struct OutputOptions { /// Use a specific output format. Possible values: /// `checkstyle`, `default`, `github`, `gitlab`, `json`, `junit`, `stylish`, `unix` - #[bpaf(long, short, fallback(OutputFormat::Default), hide_usage)] + #[bpaf(long, short, fallback_with(default_output_format), hide_usage)] pub format: OutputFormat, } +#[expect(clippy::unnecessary_wraps)] +fn default_output_format() -> Result { + if cfg!(debug_assertions) { + Ok(OutputFormat::Default) + } else if std::env::var("GITHUB_ACTIONS").ok().is_some_and(|value| value == "true") { + Ok(OutputFormat::Github) + } else { + Ok(OutputFormat::Default) + } +} + /// Enable/Disable Plugins #[expect(clippy::struct_field_names)] #[derive(Debug, Default, Clone, Bpaf)]