first commit
This commit is contained in:
50
.github/workflows/lint-format.yaml
vendored
Normal file
50
.github/workflows/lint-format.yaml
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
name: Lint and Format
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
|
||||
jobs:
|
||||
format-and-lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
||||
with:
|
||||
python-version: '3.9'
|
||||
cache: 'pip'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install ruff
|
||||
|
||||
- name: Run Ruff linting
|
||||
run: |
|
||||
echo "::group::Ruff Linting"
|
||||
ruff check . --output-format=github
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Run Ruff formatting check
|
||||
run: |
|
||||
echo "::group::Ruff Formatting"
|
||||
ruff format --check .
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Report formatting issues
|
||||
if: failure()
|
||||
run: |
|
||||
echo "::error::Formatting or linting issues detected!"
|
||||
echo "To fix locally, run:"
|
||||
echo " ruff check --fix ."
|
||||
echo " ruff format ."
|
||||
echo "Then commit and push the changes."
|
||||
Reference in New Issue
Block a user