You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#8811 added initial support for formatting doctest code snippets in docstrings, but it does have some silent behavior that should probably be louder. For example, if it detects a code snippet that is invalid Python, then it will silently skip the code snippet. Another example is a bit more pathological, but it is possible for the code snippet formatter to generate invalid Python in some case (as a result of nested triple quoted strings in some cases). In this case, we detect it and bail out of reformatting the code snippet. Ideally, we would emit a warning about this too, although this is arguably more of a bug in the current implementation.
This was brought up in review, and it was suggested that perhaps we split the warning/logging infrastructure out from the linter and use it in the formatter.
The text was updated successfully, but these errors were encountered:
This was #8811 (comment), and it was suggested that perhaps we split the warning/logging infrastructure out from the linter and use it in the formatter.
I'm a bit hesitant of adopting the linter's warn macros because they assume a CLI client and either mess with stderr if you would call ruff through a python or rust API or are silently ignored in the LSP.
Ideally we would return diagnostics as part of the formatted result and it's the caller's responsibility to present them somehow to the user.
@BurntSushi are you planning to work on this for the stable release? If not, then I recommend removing it from Stable and mark it as wish (I agree we should do it, but I think we could ship the stable without it)
#8811 added initial support for formatting doctest code snippets in docstrings, but it does have some silent behavior that should probably be louder. For example, if it detects a code snippet that is invalid Python, then it will silently skip the code snippet. Another example is a bit more pathological, but it is possible for the code snippet formatter to generate invalid Python in some case (as a result of nested triple quoted strings in some cases). In this case, we detect it and bail out of reformatting the code snippet. Ideally, we would emit a warning about this too, although this is arguably more of a bug in the current implementation.
This was brought up in review, and it was suggested that perhaps we split the warning/logging infrastructure out from the linter and use it in the formatter.
The text was updated successfully, but these errors were encountered: