From 301fe68ff7211cf71b5ae84c85d5b718df165039 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Thu, 27 Oct 2022 17:05:41 -0400 Subject: [PATCH] Deprecate hook name `lint`; add hook name `ruff` (#4) --- .github/workflows/main.yml | 19 ++++++++++++++++++- .pre-commit-hooks.yaml | 14 ++++++++++++-- README.md | 15 +++++++++++++++ 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0e9e0f9..ea297cf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,6 +22,23 @@ jobs: git config user.name 'Github Actions' git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' - - run: pre-commit-mirror --language python --package-name ruff --entry ruff --id lint --types python --description "Run ruff to lint Python files." . + - run: > + pre-commit-mirror + --language python + --package-name ruff + --entry ruff + --id ruff + --types python + --description "Run `ruff` for extremely fast Python linting" . + + # Intended for removal November 2022 (1 month after deprecation) + - run: > + pre-commit-mirror + --language python + --package-name ruff + --entry ruff + --id lint + --types python + --description "Deprecated: use hook id `ruff` instead. Planned removal 2022-11-30" . - run: git push origin HEAD:refs/heads/main --tags diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 93e92a6..08f46f9 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -1,6 +1,16 @@ -- id: lint +- id: ruff name: ruff - description: 'Run ruff to lint Python files.' + description: 'Run `ruff` for extremely fast Python linting' + entry: ruff + language: python + 'types': [python] + args: [] + require_serial: false + additional_dependencies: [] + minimum_pre_commit_version: '0' +- id: lint + name: ruff + description: 'Deprecated: use hook id `ruff` instead. Planned removal 2022-11-30' entry: ruff language: python 'types': [python] diff --git a/README.md b/README.md index d5d436a..b0a5934 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,21 @@ A [pre-commit](https://pre-commit.com/) hook for [ruff](https://github.com/charl Distributed as a standalone repository to enable installing ruff via prebuilt wheels from [PyPI](https://pypi.org/project/ruff/). +For pre-commit: see https://github.com/pre-commit/pre-commit + +For ruff: see https://github.com/charliermarsh/ruff + +### Using ruff with pre-commit + +Add this to your `.pre-commit-config.yaml`: + +```yaml + - repo: https://github.com/charliermarsh/ruff-pre-commit + rev: '' # Use the sha / tag you want to point at + hooks: + - id: ruff +``` + ## License MIT