Skip to content

Commit 5fbb1b8

Browse files
committed
Add Ruff pre-commit config and workflow
1 parent aa5832d commit 5fbb1b8

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-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: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,3 +745,25 @@ 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+
select = ["E9", "F63", "F7", "F82"]
754+
ignore = [
755+
"E402",
756+
"E722",
757+
"F403",
758+
"F405",
759+
"F811",
760+
"F821",
761+
"F841",
762+
"F401",
763+
"E731",
764+
"E741",
765+
"F601",
766+
"E712",
767+
]
768+
769+
[tool.ruff.format]

0 commit comments

Comments
 (0)