Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub Action to lint Python code with ruff #2056

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/prettier.yml
Expand Up @@ -10,8 +10,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v2
- uses: actions/cache@v2
uses: actions/checkout@v3
- uses: actions/cache@v3
name: Configure npm caching
with:
path: ~/.npm
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/push_docker_tag.yml
Expand Up @@ -13,7 +13,7 @@ jobs:
deploy_docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Build and push to Docker Hub
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/ruff.yml
@@ -0,0 +1,31 @@
# https://beta.ruff.rs
name: ruff
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: pip install --user ruff
- run: ruff --exclude=tests/ --ignore=E713,F401,F522,F811,F841 --format=github --line-length=145 --target-version=py37 .
- run: ruff --ignore=E711,E712,E713,E741,F401,F522,F811,F841 --format=github --line-length=252 --target-version=py37 .
ruff_with_cache:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Read self to find an exactly pinned dependency (ruff==x.y.z) and then echo if we got a cache hit
# https://github.com/actions/setup-python#caching-packages-dependencies
- uses: actions/setup-python@v4
id: python_with_cache
with:
python-version: 3.x
cache: pip
cache-dependency-path: .github/workflows/ruff.yml
- run: echo 'cache-hit = ${{ steps.python_with_cache.outputs.cache-hit }}' # true if cache-hit occured on pip
- run: pip install --user ruff==0.0.261
- run: ruff --exclude=tests/ --ignore=E713,F401,F522,F811,F841 --format=github --line-length=145 --target-version=py37 .
- run: ruff --ignore=E711,E712,E713,E741,F401,F522,F811,F841 --format=github --line-length=252 --target-version=py37 .
6 changes: 3 additions & 3 deletions .github/workflows/spellcheck.yml
Expand Up @@ -9,12 +9,12 @@ jobs:
spellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.9
- uses: actions/cache@v2
- uses: actions/cache@v3
name: Configure pip caching
with:
path: ~/.cache/pip
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-coverage.yml
Expand Up @@ -15,9 +15,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out datasette
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.9
- uses: actions/cache@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-pyodide.yml
Expand Up @@ -14,13 +14,13 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: 'pip'
cache-dependency-path: '**/setup.py'
- name: Cache Playwright browsers
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.cache/ms-playwright/
key: ${{ runner.os }}-browsers
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tmate-mac.yml
Expand Up @@ -10,6 +10,6 @@ jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
2 changes: 1 addition & 1 deletion .github/workflows/tmate.yml
Expand Up @@ -10,6 +10,6 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3