style: Replace black .
with ruff format
for improved user experie…
#2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Linting & formatting | |
on: | |
push: | |
branches: | |
- grass[0-9]+ | |
pull_request: | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: | |
# Do not cancel on protected branches, like grass8 | |
${{ github.ref_protected != true }} | |
env: | |
# renovate: datasource=python-version depName=python | |
PYTHON_VERSION: "3.13" | |
# renovate: datasource=pypi depName=ruff | |
RUFF_VERSION: "0.9.4" | |
permissions: {} | |
jobs: | |
run-ruff: | |
name: Ruff formatting | |
# Using matrix just to get variables which are not environmental variables | |
# and also to sync with other workflows which use matrix. | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-24.04 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
persist-credentials: false | |
- name: Set up Python | |
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
cache: "pip" | |
- name: Install | |
run: | | |
python -m pip install --upgrade pip | |
pip install ruff==${{ env.RUFF_VERSION }} | |
- name: Run ruff formatter | |
run: | | |
ruff format | |
- name: Create and uploads code suggestions to apply | |
id: diff | |
uses: OSGeo/grass/.github/actions/create-upload-suggestions@main | |
with: | |
tool-name: ruff | |
# To keep repo's file structure in formatted changes artifact | |
extra-upload-changes: pyproject.toml |