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

Should ruff check be renamed to ruff lint? #8535

Closed
thernstig opened this issue Nov 7, 2023 · 7 comments
Closed

Should ruff check be renamed to ruff lint? #8535

thernstig opened this issue Nov 7, 2023 · 7 comments
Labels
cli Related to the command-line interface

Comments

@thernstig
Copy link

thernstig commented Nov 7, 2023

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:

image

It adds more "confusion" since you have ruff format --check. One could think it does both the format and the normal ruff check.

@thernstig thernstig changed the title Should ruff check be renamed to ruff lint Should ruff check be renamed to ruff lint? Nov 7, 2023
@zanieb
Copy link
Member

zanieb commented Nov 7, 2023

Thanks for raising.

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.

@zanieb zanieb added the cli Related to the command-line interface label Nov 7, 2023
@T-256
Copy link
Contributor

T-256 commented Nov 7, 2023

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)

@parafoxia
Copy link

parafoxia commented Nov 8, 2023

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.

@thernstig
Copy link
Author

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.

@tmeiczin
Copy link

tmeiczin commented Nov 9, 2023

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.

@Avasam
Copy link

Avasam commented Dec 16, 2023

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

@MichaReiser
Copy link
Member

I'll close this in favor of #8232 where potentially introducing a ruff lint command will come up.

@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
cli Related to the command-line interface
Projects
None yet
Development

No branches or pull requests

7 participants