Skip to content

Suggestion: mark fixable checks in the default output? #2452

@henryiii

Description

@henryiii

One thing IMO that would really be nice would be Ruby Rubocop's feature of marking changes that support autofix. For example, on the dummy Ruby file:

# frozen_string_literal: true

def abs(x)
  if x > 0
    x
  else
    -x
  end
end

Rubocop produces this:

Inspecting 1 file
C

Offenses:

tmp.rb:3:9: C: Naming/MethodParameterName: Method parameter must be at least 3 characters long.
def abs(x)
        ^
tmp.rb:4:6: C: [Correctable] Style/NumericPredicate: Use x.positive? instead of x > 0.
  if x > 0
     ^^^^^

1 file inspected, 2 offenses detected, 1 offense auto-correctable

Yeah, the default is a little verbose, but notice the [Correctable] marker. That's fantastic, as it gives you an idea of what adding the fix (-A in Rubocop) flag will do, and what it won't. I miss not having some little mark or something in Ruff's output that lets me know what fixing will do and what it won't.

This is different than looking up each issue and checking to see if it's fixable or not, and it's a bit more helpful than just the summary of how many would be fixable, which is already there. I don't think it needs to be spelled out, but a little marker might be useful (like [*], then [*] could be placed by the total number of fixable values, to help a user realize what it is there for.

Maybe the target is to try to mimic flake8's output as closely as possible, and that's okay, but just thought I'd point it out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    cliRelated to the command-line interface

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions