Skip to content

Should ruff check be renamed to ruff lint? #8535

Closed as not planned
Closed as not planned

Description

@thernstig

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.

Activity

  1. changed the title [-]Should `ruff check` be renamed to `ruff lint`[/-] [+]Should `ruff check` be renamed to `ruff lint`?[/+] on Nov 7, 2023
  2. zanieb commented on Nov 7, 2023

    @zanieb
    Member

    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.

  3. added
    cli
    on Nov 7, 2023
  4. T-256 commented on Nov 7, 2023

    @T-256
    Contributor

    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)

  5. parafoxia commented on Nov 8, 2023

    @parafoxia

    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.

  6. thernstig commented on Nov 8, 2023

    @thernstig
    ContributorAuthor

    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.

  7. tmeiczin commented on Nov 9, 2023

    @tmeiczin

    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.

  8. Avasam commented on Dec 16, 2023

    @Avasam
    Contributor

    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

  9. MichaReiser commented on Feb 23, 2024

    @MichaReiser
    Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cli

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions