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

Add ruff as formatter for Python #223

Closed
Bidaya0 opened this issue Jul 21, 2023 · 3 comments · Fixed by #238 or #239
Closed

Add ruff as formatter for Python #223

Bidaya0 opened this issue Jul 21, 2023 · 3 comments · Fixed by #238 or #239
Labels
new formatter Request for integrating a formatter tool

Comments

@Bidaya0
Copy link

Bidaya0 commented Jul 21, 2023

Formatter tool
ruff

Filetype(s)

  • python

Additional context

@Bidaya0 Bidaya0 added the new formatter Request for integrating a formatter tool label Jul 21, 2023
@dbarnett
Copy link
Contributor

Hadn't heard about ruff yet but it looks great!

As a formatter, do you know if

  • it has built-in support for range formatting (updating only a few target lines out of a file, plus whatever surrounding lines it needs to touch to make a complete valid formatting change)
  • its formatting decisions tend to be stable (avoid fighting with existing valid formatting when there are multiple valid ways to format a piece of code, such as a list that's short enough to fit on one line)
    ?

@st1020
Copy link

st1020 commented Jul 24, 2023

@dbarnett As far as I know, ruff is more of a linter than a formatter. But because it has autofix support, it can also be regarded as a formatting tool (and it also have some rules related to code format).

  • Yes and no, ruff not support range formatting as a command line tool, but can support range formatting with ruff-lsp.
  • Yes, I think, as a linter, all rules that can be autofixed have only one way to autofix. So it not has "multiple valid ways to format a piece of code".

@Bidaya0
Copy link
Author

Bidaya0 commented Jul 26, 2023

Hadn't heard about ruff yet but it looks great!

As a formatter, do you know if

  • it has built-in support for range formatting (updating only a few target lines out of a file, plus whatever surrounding lines it needs to touch to make a complete valid formatting change)
  • its formatting decisions tend to be stable (avoid fighting with existing valid formatting when there are multiple valid ways to format a piece of code, such as a list that's short enough to fit on one line)
    ?

Sorry for the late reply, the situation with the library is basically as described by st1020

  • For range formatting, I found a related issue in ruff-lsp, but there is no built-in implementation
  • yes, its formatting decisions tend to be stable .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new formatter Request for integrating a formatter tool
Projects
None yet
3 participants