Skip to content

Tiny best practice improvement with the order of linting and formatting #18

@opinner

Description

@opinner

The default just qa runs the ruff commands in the following order

uv run --group test ruff format .
uv run --group test ruff check . --fix
uv run --group test ruff check --select I --fix .

However, according to https://github.com/astral-sh/ruff-pre-commit/blob/3771680eb64f3d27eb87aa0d7593eb2dd934985f/README.md?plain=1#L80-L84

When running with --fix, Ruff's lint hook should be placed before Ruff's formatter hook, and
before Black, isort, and other formatting tools, as Ruff's fix behavior can output code changes
that require reformatting.
When running without --fix, Ruff's formatter hook can be placed before or after Ruff's lint hook.

Therefore, it should probably better be

uv run --group test ruff check . --fix
uv run --group test ruff check --select I --fix .
uv run --group test ruff format .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions