Skip to content

Commit 3e0329d

Browse files
authored
check format using ruff (#1457)
* check format using ruff instead of black
1 parent 1dcef1b commit 3e0329d

File tree

5 files changed

+28
-16
lines changed

5 files changed

+28
-16
lines changed

Diff for: .github/workflows/lint.yaml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Lint
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
ruff:
7+
name: Ruff
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
- name: Set up Python
12+
uses: actions/setup-python@v4
13+
with:
14+
python-version: "3.10"
15+
- name: Install Ruff
16+
run: |
17+
python -m pip install ruff>=0.5
18+
- name: Format check (Ruff)
19+
run: |
20+
ruff format --check

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ pip-log.txt
3030
.coverage
3131
.tox
3232
.pytest_cache/
33+
.ruff_cache/
3334
nosetests.xml
3435

3536
# Translations

Diff for: .pre-commit-config.yaml

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
repos:
2-
- repo: https://github.com/psf/black
3-
rev: 24.8.0
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.5.7
44
hooks:
5-
- id: black
6-
exclude: ^(oauth2_provider/migrations/|tests/migrations/)
5+
- id: ruff-format
76
- repo: https://github.com/pre-commit/pre-commit-hooks
87
rev: v4.6.0
98
hooks:

Diff for: pyproject.toml

+4-11
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
1-
[tool.black]
2-
line-length = 110
3-
target-version = ['py38']
4-
exclude = '''
5-
^/(
6-
oauth2_provider/migrations/
7-
| tests/migrations/
8-
| .tox
9-
)
10-
'''
11-
121
# Ref: https://github.com/codespell-project/codespell#using-a-config-file
132
[tool.codespell]
143
skip = '.git,package-lock.json,locale,AUTHORS,tox.ini'
154
check-hidden = true
165
ignore-regex = '.*pragma: codespell-ignore.*'
176
ignore-words-list = 'assertIn'
7+
8+
[tool.ruff]
9+
line-length = 110
10+
exclude = [".tox", "oauth2_provider/migrations/", "tests/migrations/", "manage.py"]

Diff for: tox.ini

-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ deps =
9999
flake8
100100
flake8-isort
101101
flake8-quotes
102-
flake8-black
103102

104103
[testenv:migrations]
105104
setenv =

0 commit comments

Comments
 (0)