Go to file
Jeppe Fihl-Pearson 987f9d7d01
Remove "v" from the Ruff version number in link to release notes (#92)
## Summary

Starting with version 0.5.0 of Ruff, the release/tag name doesn't have a
leading "v". This has broken the link to the release notes that get
added to the release notes for the pre-commit hook.

This fixes it by stripping any "v" from the version number string.

See #91.

## Test Plan

Tested in a bash shell:
```bash
bash-5.2$ TAG_NAME=v0.5.0
bash-5.2$ echo ${TAG_NAME/v}
0.5.0
```

Will otherwise have to be tested on the next Ruff release.
2024-06-28 07:32:17 -04:00
.github Remove "v" from the Ruff version number in link to release notes (#92) 2024-06-28 07:32:17 -04:00
.gitignore chore: update information (#76) 2024-03-22 17:46:59 -05:00
.pre-commit-hooks.yaml feat: Update pre-commit mirror script (#53) 2023-09-26 10:38:22 -05:00
LICENSE-APACHE chore: update information (#76) 2024-03-22 17:46:59 -05:00
LICENSE-MIT chore: update information (#76) 2024-03-22 17:46:59 -05:00
mirror.py feat(workflow): auto release on tag creation (#81) 2024-03-30 19:17:08 -04:00
pyproject.toml Mirror: 0.5.0 2024-06-27 15:43:31 +00:00
README.md Mirror: 0.5.0 2024-06-27 15:43:31 +00:00
requirements-dev.txt feat: use uv for package management (#77) 2024-04-01 23:05:43 -05: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

To run Ruff's linter and formatter (available as of Ruff v0.0.289) via pre-commit, add the following to your .pre-commit-config.yaml:

- repo: https://github.com/astral-sh/ruff-pre-commit
  # Ruff version.
  rev: v0.5.0
  hooks:
    # Run the linter.
    - id: ruff
    # Run the formatter.
    - id: ruff-format

To enable lint fixes, add the --fix argument to the lint hook:

- repo: https://github.com/astral-sh/ruff-pre-commit
  # Ruff version.
  rev: v0.5.0
  hooks:
    # Run the linter.
    - id: ruff
      args: [ --fix ]
    # Run the formatter.
    - id: ruff-format

To run the hooks over Jupyter Notebooks too, add jupyter to the list of allowed filetypes:

- repo: https://github.com/astral-sh/ruff-pre-commit
  # Ruff version.
  rev: v0.5.0
  hooks:
    # Run the linter.
    - id: ruff
      types_or: [ python, pyi, jupyter ]
      args: [ --fix ]
    # Run the formatter.
    - id: ruff-format
      types_or: [ python, pyi, jupyter ]

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.

(As long as your Ruff configuration avoids any linter-formatter incompatibilities, ruff format should never introduce new lint errors, so it's safe to run Ruff's format hook after ruff check --fix.)

License

ruff-pre-commit is licensed under either of

at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in ruff-pre-commit by you, as defined in the Apache-2.0 license, shall be dually licensed as above, without any additional terms or conditions.