Skip to content

Commit 409e6f3

Browse files
committed
Configure Ruff to replace Black and isort
- Remove [tool.black] and [tool.isort] configuration sections - Add ruff>=0.8.0 as development dependency - Configure [tool.ruff] with line-length=79, target-version=py311 - Set up [tool.ruff.format] with Black-compatible settings - Configure [tool.ruff.isort] with Django-aware import sorting - Add [tool.ruff.lint] with basic linting rules (E, F, W, I) - Exclude migrations directory from formatting and linting This maintains existing code style while consolidating formatting, import sorting, and linting into a single faster tool.
1 parent 6b32830 commit 409e6f3

2 files changed

Lines changed: 34 additions & 34 deletions

File tree

.kiro/specs/black-to-ruff-migration/tasks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Implementation Plan
22

3-
- [ ] 1. Configure Ruff in pyproject.toml
3+
- [x] 1. Configure Ruff in pyproject.toml
44

55
- Remove existing [tool.black] and [tool.isort] configuration sections
66
- Add comprehensive [tool.ruff] configuration with general settings (line-length = 79, target-version = "py311", exclude migrations)

pyproject.toml

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ dependencies = [
5454

5555
# Development & Debugging
5656
"django-debug-toolbar>=5.2.0,<6.0.0",
57+
"ruff>=0.8.0,<1.0.0",
5758

5859
# Testing
5960
"django-nose>=1.4.7,<2.0.0",
@@ -75,37 +76,36 @@ dependencies = [
7576
Repository = "https://github.com/weallcode/website"
7677
Homepage = "https://github.com/weallcode/website"
7778

78-
[tool.black]
79+
[tool.ruff]
7980
line-length = 79
80-
target-version = ["py311"]
81-
include = '\.pyi?$'
82-
exclude = '''
83-
/(
84-
\.eggs
85-
| \.git
86-
| \.hg
87-
| \.mypy_cache
88-
| \.tox
89-
| \.venv
90-
| _build
91-
| buck-out
92-
| build
93-
| dist
94-
| migrations
95-
)/
96-
'''
97-
98-
[tool.isort]
99-
profile = "black"
100-
line_length = 79
101-
multi_line_output = 3
102-
include_trailing_comma = true
103-
combine_as_imports = true
104-
force_grid_wrap = 2
105-
use_parentheses = true
106-
remove_redundant_aliases = true
107-
known_django = "django"
108-
sections = "FUTURE,STDLIB,DJANGO,THIRDPARTY,FIRSTPARTY,LOCALFOLDER"
109-
skip_gitignore = true
110-
skip = [".gitignore", ".dockerignore", ".venv"]
111-
skip_glob = ["**/migrations/*.py"]
81+
target-version = "py311"
82+
exclude = [
83+
".eggs",
84+
".git",
85+
".hg",
86+
".mypy_cache",
87+
".tox",
88+
".venv",
89+
"_build",
90+
"buck-out",
91+
"build",
92+
"dist",
93+
"migrations",
94+
]
95+
96+
[tool.ruff.format]
97+
quote-style = "double"
98+
indent-style = "space"
99+
skip-source-first-line = false
100+
line-ending = "auto"
101+
102+
[tool.ruff.isort]
103+
known-django = ["django"]
104+
section-order = ["future", "standard-library", "django", "third-party", "first-party", "local-folder"]
105+
combine-as-imports = true
106+
force-wrap-aliases = true
107+
split-on-trailing-comma = true
108+
109+
[tool.ruff.lint]
110+
select = ["E", "F", "W", "I"]
111+
ignore = []

0 commit comments

Comments
 (0)