Change Ruff's text
format to show the source code and context by default
#4189
MichaReiser
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Ruff's default
text
format only shows the file, location, and message of a reported violation without providing any additional context.This has the advantage that the output is very compact, which is especially useful when there are many diagnostics. However, I have found myself struggling with understanding diagnostics from just the brief (and very long) message. For example the following message:
crates/ruff/resources/test/cpython/Tools/unittestgui/unittestgui.py:107:9: E722 Do not use bare `except`
As a Python beginner, I haven't heard of a bare
except
before. Showing the source text would help me because I may at least be able to infer that it probably refers to theexcept
without any specific exception, but only if I have the experience on why this might be bad. I recommend showing the suggested fix, if any, to help users understand how to solve the problem.The part I'm somewhat undecided on is whether we should show the explanation why this is bad. Showing the explanation can be useful to understand the problem but it can bloat every diagnostic quiet a bit.
What's your use case/opinion? Would you find it useful if ruff shows more descriptive diagnostics by default or do you prefer the compact rendering as it is today, and why?
Prior Art
Rome
Clippy
Elm review
Beta Was this translation helpful? Give feedback.
All reactions