Skip to content

Commit

Permalink
Rename new ruff rule output format to "pretty"
Browse files Browse the repository at this point in the history
The new `ruff rule` output format introduced in
551b810 doesn't print Markdown but
rather some rich text with escape sequences for colors and links,
it's actually the "text" format that prints Markdown, so naming the new
format "markdown" is very confusing. This commit therefore renames it to
"pretty".

This isn't a breaking change since there hasn't been a release yet.
  • Loading branch information
not-my-profile authored and charliermarsh committed Feb 12, 2023
1 parent 8289ede commit f5a3c90
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions crates/ruff_cli/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub enum Command {
rule: Rule,

/// Output format
#[arg(long, value_enum, default_value = "markdown")]
#[arg(long, value_enum, default_value = "pretty")]
format: HelpFormat,
},
/// List all supported upstream linters
Expand Down Expand Up @@ -284,7 +284,7 @@ pub struct CheckArgs {
pub enum HelpFormat {
Text,
Json,
Markdown,
Pretty,
}

#[allow(clippy::module_name_repetitions)]
Expand Down
2 changes: 1 addition & 1 deletion crates/ruff_cli/src/commands/linter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pub fn linter(format: HelpFormat) -> Result<()> {
output.push('\n');
}

HelpFormat::Markdown => {
HelpFormat::Pretty => {
output.push_str(&format!("| {:>6} | {:<27} |\n", "Prefix", "Name"));
output.push_str(&format!("| {:>6} | {:<27} |\n", "------", "-".repeat(27)));

Expand Down
4 changes: 2 additions & 2 deletions crates/ruff_cli/src/commands/rule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub fn rule(rule: &Rule, format: HelpFormat) -> Result<()> {
let mut output = String::new();

match format {
HelpFormat::Text | HelpFormat::Markdown => {
HelpFormat::Text | HelpFormat::Pretty => {
output.push_str(&format!("# {} ({})", rule.as_ref(), rule.code()));
output.push('\n');
output.push('\n');
Expand Down Expand Up @@ -69,7 +69,7 @@ pub fn rule(rule: &Rule, format: HelpFormat) -> Result<()> {
HelpFormat::Json | HelpFormat::Text => {
writeln!(stdout, "{output}")?;
}
HelpFormat::Markdown => {
HelpFormat::Pretty => {
let parser = Parser::new_ext(
&output,
Options::ENABLE_TASKLISTS | Options::ENABLE_STRIKETHROUGH,
Expand Down

0 comments on commit f5a3c90

Please sign in to comment.