Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the format output with details about what needs to be formatted. #9765

Closed
vlkorsakov opened this issue Feb 1, 2024 · 4 comments
Closed
Labels
formatter Related to the formatter question Asking for support or clarification

Comments

@vlkorsakov
Copy link

Please provide a more detailed output, including the line number and a description of what I need to format as in flake8. I think you can update the output for use with the --check flag only.

code example:

def foo():
    pass
def bar():
    pass

flake8 output:

my_awesome_project/main.py:3:1: E302 expected 2 blank lines, found 0
my_awesome_project/main.py:4:9: W292 no newline at end of file

ruff format --check output:

Would reformat: my_awesome_project/main.py
1 file would be reformatted
@AlexWaygood AlexWaygood added the formatter Related to the formatter label Feb 1, 2024
@zanieb
Copy link
Member

zanieb commented Feb 1, 2024

Sounds like you're looking for #7352 with ruff check for those specific rules.

Note that the formatter and linter are different, but if you want to see the format changes, run ruff format --diff. See this document for information on how the linter and formatter overlap. It's unlikely that we'll be able to provide discrete "codes" or descriptions of what needs to be changed by the formatter. It works in a different way than lint rules and implementing it would be very challenging.

@zanieb zanieb added the question Asking for support or clarification label Feb 1, 2024
@vlkorsakov
Copy link
Author

run ruff format --diff

This gives such a complex result. flake8's output is easier to understand. I think if you add more colours to diff (like in git diff), the output might become easier.

In general, I would like the result to be the same as "check" only because part of the pycodestyle rules are not supported right now (waiting for #9266), and I can only see what I missed by using the formatter. Thanks for the answer.

@zanieb
Copy link
Member

zanieb commented Feb 1, 2024

You can get colors with something like ruff format --diff | ydiff (there are a bunch of different tools out there for viewing diffs). I agree that's not ideal though we should probably emit colored diffs by default!

In general, I would like the result to be the same as "check"

Yeah I agree this would be nice if it were feasible.

@MichaReiser
Copy link
Member

We plan to add color support to our diffs. See #9984 I'll close this in favour of that issue.

@MichaReiser MichaReiser closed this as not planned Won't fix, can't repro, duplicate, stale Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
formatter Related to the formatter question Asking for support or clarification
Projects
None yet
Development

No branches or pull requests

4 participants