Skip to content

Commit 4506e0d

Browse files
committed
Add Ruff pre-commit config and workflow
1 parent aa5832d commit 4506e0d

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

.github/workflows/pre-commit.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: pre-commit
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
jobs:
9+
pre-commit:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: '3.11'
19+
20+
- name: Install pre-commit
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install pre-commit
24+
25+
- name: Run pre-commit
26+
run: pre-commit run --all-files

.pre-commit-config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.14.0
4+
hooks:
5+
- id: ruff
6+
args:
7+
- --fix
8+
- --exit-non-zero-on-fix
9+
- id: ruff-format

pyproject.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,3 +745,24 @@ intel-gpu-torch270 = [
745745
homepage = "http://www.unsloth.ai"
746746
documentation = "https://github.com/unslothai/unsloth"
747747
repository = "https://github.com/unslothai/unsloth"
748+
749+
[tool.ruff]
750+
target-version = "py311"
751+
752+
[tool.ruff.lint]
753+
ignore = [
754+
"E402",
755+
"E722",
756+
"F403",
757+
"F405",
758+
"F811",
759+
"F821",
760+
"F841",
761+
"F401",
762+
"E731",
763+
"E741",
764+
"F601",
765+
"E712",
766+
]
767+
768+
[tool.ruff.format]

0 commit comments

Comments
 (0)