Skip to content

Commit cf2d16d

Browse files
authored
Fix formatting issues reported by the latest Ruff version (#616)
1 parent 17fe8d1 commit cf2d16d

File tree

5 files changed

+11
-9
lines changed

5 files changed

+11
-9
lines changed

.github/workflows/static.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
# This error cannot be resolved by adding a pylint: disable=unused-argument comment ...
4040
- run: |
4141
pip install -e .[pylint,pycodestyle]
42-
pip install ruff
42+
pip install ruff==0.9.4
4343
- name: ruff linter and code style checks
4444
run: ruff check pylsp test
4545
- name: ruff code formatter check

pylsp/_utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# Eol chars accepted by the LSP protocol
2020
# the ordering affects performance
2121
EOL_CHARS = ["\r\n", "\r", "\n"]
22-
EOL_REGEX = re.compile(f'({"|".join(EOL_CHARS)})')
22+
EOL_REGEX = re.compile(f"({'|'.join(EOL_CHARS)})")
2323

2424
log = logging.getLogger(__name__)
2525

test/plugins/test_completion.py

+2
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ class TypeCase(NamedTuple):
6565
expected: lsp.CompletionItemKind
6666

6767

68+
# fmt: off
6869
TYPE_CASES: Dict[str, TypeCase] = {
6970
"variable": TypeCase(
7071
document="test = 1\ntes",
@@ -115,6 +116,7 @@ class TypeCase(NamedTuple):
115116
expected=lsp.CompletionItemKind.Property,
116117
),
117118
}
119+
# fmt: on
118120

119121

120122
@pytest.mark.parametrize("case", list(TYPE_CASES.values()), ids=list(TYPE_CASES.keys()))

test/test_utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ def notebook_with_python_cells(cells: List[str]):
4545
"cells": [
4646
{
4747
"kind": NotebookCellKind.Code,
48-
"document": f"cell_{i+1}_uri",
48+
"document": f"cell_{i + 1}_uri",
4949
}
5050
for i in range(len(cells))
5151
],
5252
},
5353
"cellTextDocuments": [
5454
{
55-
"uri": f"cell_{i+1}_uri",
55+
"uri": f"cell_{i + 1}_uri",
5656
"languageId": "python",
5757
"text": cell,
5858
}

test/test_workspace.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def test_workspace_loads_pycodestyle_config(pylsp, tmpdir) -> None:
238238
# Test that project settings are loaded
239239
workspace2_dir = tmpdir.mkdir("NewTest456")
240240
cfg = workspace2_dir.join("pycodestyle.cfg")
241-
cfg.write("[pycodestyle]\n" "max-line-length = 1000")
241+
cfg.write("[pycodestyle]\nmax-line-length = 1000")
242242

243243
workspace1 = {"uri": str(workspace1_dir)}
244244
workspace2 = {"uri": str(workspace2_dir)}
@@ -257,7 +257,7 @@ def test_workspace_loads_pycodestyle_config(pylsp, tmpdir) -> None:
257257
# Test switching to another workspace with different settings
258258
workspace3_dir = tmpdir.mkdir("NewTest789")
259259
cfg1 = workspace3_dir.join("pycodestyle.cfg")
260-
cfg1.write("[pycodestyle]\n" "max-line-length = 20")
260+
cfg1.write("[pycodestyle]\nmax-line-length = 20")
261261

262262
workspace3 = {"uri": str(workspace3_dir)}
263263

@@ -310,9 +310,9 @@ def test_progress_simple(workspace, consumer) -> None:
310310
assert init_call[0][0]["method"] == "window/workDoneProgress/create"
311311

312312
# same method for all calls
313-
assert all(
314-
call[0][0]["method"] == "$/progress" for call in progress_calls
315-
), consumer.call_args_list
313+
assert all(call[0][0]["method"] == "$/progress" for call in progress_calls), (
314+
consumer.call_args_list
315+
)
316316

317317
# same token used in all calls
318318
assert (

0 commit comments

Comments
 (0)