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
This is a wild idea, but since Ruff is still in its 0.X semver phase, maybe not a bad idea after all.
Should ruff check be renamed to ruff lint?
Since ruff format was introduced, the term check is harder to to understand what it does. In addition the website goes about mentioning the terms format and lint. As evident by this:
It adds more "confusion" since you have ruff format --check. One could think it does both the format and the normal ruff check.
Reacted by Niall Dooley, T-256, Tobias Hernstig, Guillaume Papin, travis-cook-sfdc, Charlie Marsh, beskep, Jerome Paddick and Alexander Nordin
We're interested in making ruff check a unified command that checks for both lint and format errors #8232. We might want to separately introduce a ruff lint command though — this seems as good a place as any for discussion on that.
Like ruff format that applies modifications by default, I suggest ruff lint do the same.
The current behavior of --fix would be default for ruff lint and can be disable by --check. (like ruff format we have today)
I disagree that a ruff lint command should fix code by default. Ruff (afaik) is the only Python linter with the capability to fix issues, so may be confusing for people switching from something else. Linters in other languages, such as Cargo, tend not to fix by default either, so I don't believe there's a precedent for this. Additionally, the linter fixes aren't 100% safe to apply (see #8556 as an example).
Whether a unified ruff check should run something equivalent to ruff lint --fix && ruff format is another question though.
Linters I am aware of has a --fix for linting faults. Or e.g. Prettier (a formatter only) has --write. I think code transformations (which linters are) should not do fixes by default as @parafoxia mentions, due to the dangers of it. When users specifically has to add a --fix, they can check the changes made and are aware they are being made.
I agree, a ruff lint should identify, but not fix issues by default. There are times when the linter does not have enough context to determine if a change is appropriate and can potentially introduce a bug. In regard to formatting, I think ruff format is explicit in that I'm asking it to format my code and should do so by default. I like the idea of ruff check identifying both lint and format, but not fixing and I kinda find --fix to be awkward. I would probably prefer a ruff fix command, but it's a balance between number of commands and options per command.
My thoughts: ruff lint: only lints by default ruff format: formats by default ruff check: shorthand for ruff lint && ruff format --check ruff fix: shorthand for ruff lint --fix && ruff format
Activity
[-]Should `ruff check` be renamed to `ruff lint`[/-][+]Should `ruff check` be renamed to `ruff lint`?[/+]zanieb commentedon Nov 7, 2023
Thanks for raising.
We're interested in making
ruff checka unified command that checks for both lint and format errors #8232. We might want to separately introduce aruff lintcommand though — this seems as good a place as any for discussion on that.T-256 commentedon Nov 7, 2023
Like
ruff formatthat applies modifications by default, I suggestruff lintdo the same.The current behavior of
--fixwould be default forruff lintand can be disable by--check. (likeruff formatwe have today)parafoxia commentedon Nov 8, 2023
I disagree that a
ruff lintcommand should fix code by default. Ruff (afaik) is the only Python linter with the capability to fix issues, so may be confusing for people switching from something else. Linters in other languages, such as Cargo, tend not to fix by default either, so I don't believe there's a precedent for this. Additionally, the linter fixes aren't 100% safe to apply (see #8556 as an example).Whether a unified
ruff checkshould run something equivalent toruff lint --fix && ruff formatis another question though.thernstig commentedon Nov 8, 2023
Linters I am aware of has a
--fixfor linting faults. Or e.g. Prettier (a formatter only) has--write. I think code transformations (which linters are) should not do fixes by default as @parafoxia mentions, due to the dangers of it. When users specifically has to add a--fix, they can check the changes made and are aware they are being made.tmeiczin commentedon Nov 9, 2023
I agree, a
ruff lintshould identify, but not fix issues by default. There are times when the linter does not have enough context to determine if a change is appropriate and can potentially introduce a bug. In regard to formatting, I thinkruff formatis explicit in that I'm asking it to format my code and should do so by default. I like the idea ofruff checkidentifying both lint and format, but not fixing and I kinda find--fixto be awkward. I would probably prefer aruff fixcommand, but it's a balance between number of commands and options per command.Avasam commentedon Dec 16, 2023
My thoughts:
ruff lint: only lints by defaultruff format: formats by defaultruff check: shorthand forruff lint && ruff format --checkruff fix: shorthand forruff lint --fix && ruff formatMichaReiser commentedon Feb 23, 2024
I'll close this in favor of #8232 where potentially introducing a
ruff lintcommand will come up.