Skip to content

Commit c0ceca5

Browse files
zeel2104vfdev-5
andauthored
Use Ruff formatter in devcontainer config (#3737)
Fixes #3736 Description: - Replace `ms-python.black-formatter` with `astral-sh.ruff` in `.devcontainer/devcontainer.json` - Set Ruff as the default formatter for Python files in VS Code devcontainer settings - Remove the remaining Black-specific formatter configuration Check list: - [ ] New tests are added (if a new feature is added) - [ ] New doc strings: description and/or example code are in RST format - [ ] Documentation is updated (if required) --------- Co-authored-by: vfdev <vfdev.5@gmail.com>
1 parent dc39e4d commit c0ceca5

3 files changed

Lines changed: 5 additions & 37 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,13 @@
44
"postCreateCommand": "pip install -e . && pip install -r requirements-dev.txt && pre-commit install",
55
"customizations": {
66
"vscode": {
7-
"extensions": [
8-
"ms-python.python",
9-
"charliermarsh.ruff",
10-
"ms-python.black-formatter"
11-
],
7+
"extensions": ["ms-python.python", "charliermarsh.ruff"],
128
"settings": {
139
"editor.formatOnSave": true,
1410
"python.testing.pytestEnabled": true,
1511
"[python]": {
16-
"editor.defaultFormatter": "ms-python.black-formatter"
12+
"editor.defaultFormatter": "charliermarsh.ruff"
1713
},
18-
"black-formatter.args": ["--line-length", "120"],
1914
"editor.rulers": [80, 120]
2015
}
2116
}

CONTRIBUTING.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,7 @@ please run lint checking and tests:
140140

141141
#### Checking Code Style
142142

143-
To ensure the codebase complies with the PEP8 style guide, we use [ruff](https://docs.astral.sh/ruff/)
144-
and [black](https://black.readthedocs.io/en/stable/) to lint and format the codebase respectively.
143+
To ensure the codebase complies with the PEP8 style guide, we use [ruff](https://docs.astral.sh/ruff/) to lint and [ruff format](https://docs.astral.sh/ruff/formatter/) to format the codebase.
145144

146145
##### Formatting the code
147146

@@ -176,9 +175,8 @@ pre-commit install
176175
git add .
177176
git commit -m "Added awesome feature"
178177
# DONT'T WORRY IF ERRORS ARE RAISED.
179-
# YOUR CODE IS NOT COMPLIANT WITH flake8, µsort or black
180-
# Fix any flake8 errors by following their suggestions
181-
# µfmt will automatically format the files so they might look different, but you'll need to stage the files
178+
# YOUR CODE IS NOT COMPLIANT WITH ruff format
179+
# Fix any errors by following their suggestions
182180
# again for committing
183181
# After fixing any flake8 errors
184182
git add .

pyproject.toml

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -123,31 +123,6 @@ docstring-code-format = false
123123
# enabled.
124124
docstring-code-line-length = "dynamic"
125125

126-
[tool.black]
127-
line-length = 120
128-
target-version = ['py311', 'py313']
129-
include = '\.pyi?$'
130-
exclude = '''
131-
132-
(
133-
/(
134-
\.eggs # exclude a few common directories in the
135-
| \.git # root of the project
136-
| \.hg
137-
| \.mypy_cache
138-
| \.tox
139-
| \.venv
140-
| _build
141-
| buck-out
142-
| build
143-
| dist
144-
| assets
145-
)/
146-
| foo.py # also separately exclude a file named foo.py in
147-
# the root of the project
148-
)
149-
'''
150-
151126
[tool.pytest.ini_options]
152127
markers = [
153128
"distributed: mark a test with distributed option",

0 commit comments

Comments
 (0)