Go to file
2023-09-15 14:37:18 -05:00
.github Revert adding toml and jupyter (#45) 2023-07-10 15:03:43 -04:00
.gitignore Initial commit 2022-09-19 20:52:36 -06:00
.pre-commit-hooks.yaml Add alpha formatter support (#50) 2023-09-12 15:49:39 -05:00
.version Mirror: 0.0.289 2023-09-12 16:43:36 +00:00
LICENSE Initial commit 2022-09-19 20:52:36 -06:00
README.md Bump version to 0.0.290; update required formatter revision (#51) 2023-09-15 14:37:18 -05:00
setup.py Mirror: 0.0.289 2023-09-12 16:43:36 +00:00
update_version.py Update update_version.py 2023-06-20 16:40:23 -04:00

ruff-pre-commit

Ruff image image image Actions status

A pre-commit hook for Ruff.

Distributed as a standalone repository to enable installing Ruff via prebuilt wheels from PyPI.

Using Ruff with pre-commit

Add this to your .pre-commit-config.yaml:

- repo: https://github.com/astral-sh/ruff-pre-commit
  # Ruff version.
  rev: v0.0.289
  hooks:
    - id: ruff

Or, to enable autofix:

- repo: https://github.com/astral-sh/ruff-pre-commit
  # Ruff version.
  rev: v0.0.289
  hooks:
    - id: ruff
      args: [--fix, --exit-non-zero-on-fix]

To run the hook on Jupyter Notebooks too:

- repo: https://github.com/astral-sh/ruff-pre-commit
  # Ruff version.
  rev: v0.0.290
  hooks:
    - id: ruff
      types_or: [python, pyi, jupyter]

Ruff's pre-commit hook should be placed after other formatting tools, such as Black and isort, unless you enable autofix, in which case, Ruff's pre-commit hook should run before Black, isort, and other formatting tools, as Ruff's autofix behavior can output code changes that require reformatting.

Using Ruff's formatter (unstable)

Ruff's formatter is in Alpha, but can used with pre-commit by adding the ruff-format hook:

- repo: https://github.com/astral-sh/ruff-pre-commit
  # Ruff version.
  rev: v0.0.290
  hooks:
    - id: ruff-format

To check formatting without changing files, use --check:

- repo: https://github.com/astral-sh/ruff-pre-commit
  # Ruff version.
  rev: v0.0.290
  hooks:
    - id: ruff-format
      args: [--check]

Note v0.0.290 is the minimum version that provides the ruff-format hook.

License

MIT