fix(ruff)

closes #6530
closes #6531
This commit is contained in:
Jacob Heider 2024-06-27 12:01:35 -04:00 committed by Jacob Heider
parent a8574519fc
commit d95529e9f5
2 changed files with 19 additions and 7 deletions

View file

@ -1,5 +1,5 @@
distributable: distributable:
url: https://github.com/astral-sh/ruff/archive/refs/tags/v{{version}}.tar.gz url: https://github.com/astral-sh/ruff/archive/refs/tags/{{ version.tag }}.tar.gz
strip-components: 1 strip-components: 1
versions: versions:
@ -30,8 +30,14 @@ test:
# Cause: No such file or directory (os error 2) # Cause: No such file or directory (os error 2)
- run: mkdir -p .ruff_cache/{{version}} - run: mkdir -p .ruff_cache/{{version}}
if: '>=0.1.12' if: '>=0.1.12'
- ruff -e $FIXTURE | grep "\`os\` imported but unused" - run:
- ruff --fix $FIXTURE - ruff -e $FIXTURE | grep "\`os\` imported but unused"
- ruff --fix $FIXTURE
if: <0.5
- run:
- (ruff check $FIXTURE || true) | grep "\`os\` imported but unused"
- ruff check --fix $FIXTURE
if: '>=0.5'
- test ! -s $FIXTURE - test ! -s $FIXTURE
fixture: | fixture: |
import os import os

View file

@ -1,5 +1,5 @@
distributable: distributable:
url: https://github.com/astral-sh/ruff/archive/refs/tags/v{{version}}.tar.gz url: https://github.com/astral-sh/ruff/archive/refs/tags/{{ version.tag }}.tar.gz
strip-components: 1 strip-components: 1
versions: versions:
@ -30,12 +30,18 @@ test:
script: script:
# v0.1.12 introduced this test error: # v0.1.12 introduced this test error:
# ruff failed # ruff failed
# Cause: Failed to create cache file '/__w/pantry/pantry/testbeds/github.com__charliermarsh__ruff-0.1.12/.ruff_cache/0.1.12/10391082687706843805' # Cause: Failed to create cache file '/__w/pantry/pantry/testbeds/astral.sh__ruff-0.1.12/.ruff_cache/0.1.12/10391082687706843805'
# Cause: No such file or directory (os error 2) # Cause: No such file or directory (os error 2)
- run: mkdir -p .ruff_cache/{{version}} - run: mkdir -p .ruff_cache/{{version}}
if: '>=0.1.12' if: '>=0.1.12'
- ruff -e $FIXTURE | grep "\`os\` imported but unused" - run:
- ruff --fix $FIXTURE - ruff -e $FIXTURE | grep "\`os\` imported but unused"
- ruff --fix $FIXTURE
if: <0.5
- run:
- (ruff check $FIXTURE || true) | grep "\`os\` imported but unused"
- ruff check --fix $FIXTURE
if: '>=0.5'
- test ! -s $FIXTURE - test ! -s $FIXTURE
fixture: | fixture: |
import os import os