diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 6c5049e..23b2203 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,3 +8,5 @@ updates: github-actions: patterns: - "*" + cooldown: + default-days: 7 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f962760..e2685bd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,8 +3,6 @@ on: schedule: - cron: "0 */4 * * *" workflow_dispatch: - repository_dispatch: - types: [pypi_release] permissions: {} @@ -15,15 +13,12 @@ jobs: permissions: contents: write steps: - - if: ${{ startsWith(github.event_name, 'repository_dispatch') }} - run: sleep 30 - - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 with: persist-credentials: true # needed to push commits below - name: Install uv - uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 + uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 - name: set git config run: | @@ -38,10 +33,10 @@ jobs: UNPUSHED_COMMITS=$(git log origin/main..HEAD) if [ -z "$UNPUSHED_COMMITS" ]; then echo "No unpushed commits found." - echo "changes_exist=false" >> $GITHUB_ENV + echo "changes_exist=false" >> "$GITHUB_ENV" else echo "Unpushed commits found." - echo "changes_exist=true" >> $GITHUB_ENV + echo "changes_exist=true" >> "$GITHUB_ENV" fi - name: push changes if they exist @@ -53,8 +48,8 @@ jobs: - name: create release on new tag if new changes exist if: env.changes_exist == 'true' run: | - TAG_NAME=$(git describe --tags $(git rev-list --tags --max-count=1)) - echo $TAG_NAME + TAG_NAME=$(git describe --tags "$(git rev-list --tags --max-count=1)") + echo "$TAG_NAME" gh release create "$TAG_NAME" \ --title "$TAG_NAME" \ --notes "See: https://github.com/astral-sh/ruff/releases/tag/${TAG_NAME/v}" \ diff --git a/README.md b/README.md index 716f813..348e5be 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # ruff-pre-commit [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) -[![image](https://img.shields.io/pypi/v/ruff/0.15.13.svg)](https://pypi.python.org/pypi/ruff) -[![image](https://img.shields.io/pypi/l/ruff/0.15.13.svg)](https://pypi.python.org/pypi/ruff) -[![image](https://img.shields.io/pypi/pyversions/ruff/0.15.13.svg)](https://pypi.python.org/pypi/ruff) +[![image](https://img.shields.io/pypi/v/ruff/0.15.17.svg)](https://pypi.python.org/pypi/ruff) +[![image](https://img.shields.io/pypi/l/ruff/0.15.17.svg)](https://pypi.python.org/pypi/ruff) +[![image](https://img.shields.io/pypi/pyversions/ruff/0.15.17.svg)](https://pypi.python.org/pypi/ruff) [![Actions status](https://github.com/astral-sh/ruff-pre-commit/workflows/main/badge.svg)](https://github.com/astral-sh/ruff-pre-commit/actions) A [pre-commit](https://pre-commit.com/) hook for [Ruff](https://github.com/astral-sh/ruff). @@ -20,7 +20,7 @@ To run Ruff's [linter](https://docs.astral.sh/ruff/linter) and [formatter](https repos: - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.15.13 + rev: v0.15.17 hooks: # Run the linter. - id: ruff-check @@ -34,7 +34,7 @@ To enable lint fixes, add the `--fix` argument to the lint hook: repos: - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.15.13 + rev: v0.15.17 hooks: # Run the linter. - id: ruff-check @@ -43,13 +43,27 @@ repos: - id: ruff-format ``` +To select or ignore specific rules, pass the relevant Ruff arguments through `args`. +When using inline YAML lists, quote arguments that contain commas: + +```yaml +repos: +- repo: https://github.com/astral-sh/ruff-pre-commit + # Ruff version. + rev: v0.15.17 + hooks: + # Run the linter. + - id: ruff-check + args: [ --fix, "--extend-select=I,E", "--ignore=F401" ] +``` + To avoid running on Jupyter Notebooks, remove `jupyter` from the list of allowed filetypes: ```yaml repos: - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.15.13 + rev: v0.15.17 hooks: # Run the linter. - id: ruff-check @@ -66,7 +80,7 @@ To lint `pyproject.toml`, add `pyproject` to the list of allowed filetypes (requ repos: - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.15.13 + rev: v0.15.17 hooks: # Run the linter. - id: ruff-check diff --git a/pyproject.toml b/pyproject.toml index b01053c..f7b1ce6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,5 +2,5 @@ name = "ruff-pre-commit" version = "0.0.0" dependencies = [ - "ruff==0.15.13", + "ruff==0.15.17", ]