Skip to content

Commit 7ef1dbe

Browse files
committed
Add Ruff pre-commit config and workflow
1 parent 5314c21 commit 7ef1dbe

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
@@ -865,3 +865,25 @@ amd = [
865865
homepage = "http://www.unsloth.ai"
866866
documentation = "https://github.com/unslothai/unsloth"
867867
repository = "https://github.com/unslothai/unsloth"
868+
869+
[tool.ruff]
870+
target-version = "py311"
871+
872+
[tool.ruff.lint]
873+
select = ["E9", "F63", "F7", "F82"]
874+
ignore = [
875+
"E402",
876+
"E722",
877+
"F403",
878+
"F405",
879+
"F811",
880+
"F821",
881+
"F841",
882+
"F401",
883+
"E731",
884+
"E741",
885+
"F601",
886+
"E712",
887+
]
888+
889+
[tool.ruff.format]

0 commit comments

Comments
 (0)