Skip to content

Commit e69465b

Browse files
committed
style: switch completly to ruff for formatting and style
1 parent 1a3cb65 commit e69465b

File tree

37 files changed

+128
-95
lines changed

37 files changed

+128
-95
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
"tamasfe.even-better-toml",
4242
"gruntfuggly.todo-tree",
4343
"charliermarsh.ruff",
44-
"ms-python.black-formatter",
4544
"ms-python.mypy-type-checker",
4645
"ms-python.debugpy"
4746
],
@@ -82,12 +81,7 @@
8281
"^(.*(/|\\\\)\\.?robot\\.toml|\\.?robot\\.toml)$": "http://localhost:8000/etc/robot.toml.json"
8382
},
8483
"mypy-type-checker.importStrategy": "fromEnvironment",
85-
"debugpy.debugJustMyCode": false,
86-
"black-formatter.importStrategy": "fromEnvironment",
87-
"black-formatter.args": [
88-
"--config",
89-
"${workspaceFolder}./pyproject.toml"
90-
]
84+
"debugpy.debugJustMyCode": false
9185
}
9286
}
9387
}

.pre-commit-config.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,4 @@ repos:
4949
pass_filenames: false
5050
language: system
5151
stages: [pre-commit]
52-
types:
53-
- "javascript"
52+
types_or: [javascript, jsx, ts, tsx]

.vscode/extensions.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"tamasfe.even-better-toml",
99
"gruntfuggly.todo-tree",
1010
"charliermarsh.ruff",
11-
"ms-python.black-formatter",
1211
"ms-python.mypy-type-checker"
1312
]
1413
}

hatch.toml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ dependencies = [
2222
"pytest-cov",
2323
"mypy",
2424
"ruff",
25-
"black",
2625
"debugpy",
2726
"GitPython",
2827
"semantic-version",
@@ -98,7 +97,7 @@ matrix.rf.dependencies = [
9897
{ value = "robotframework>=7.1, <7.2", if = [
9998
"rf71",
10099
] },
101-
{ value = "robotframework>=7.2, <7.3", if = [
100+
{ value = "robotframework>=7.2, <7.3", if = [
102101
"rf72",
103102
] },
104103
]
@@ -150,10 +149,8 @@ features = ["all"]
150149

151150

152151
[envs.lint.scripts]
153-
typing-py = "mypy --no-incremental --cache-dir /dev/null {args:.}"
154-
typing = ["typing-py", "npm run compile"]
155-
style = ["ruff check .", "black --check --diff .", "npx eslint ."]
156-
fmt = ["black .", "ruff check --fix .", "style", "npx eslint --fix ."]
152+
typing = "mypy --no-incremental --cache-dir /dev/null {args:.}"
153+
style = ["ruff check .", "ruff format --diff ."]
157154
all = ["style", "typing"]
158155

159156
[envs.lint.overrides]
@@ -178,3 +175,14 @@ extract-release-notes = ["python scripts/extract_release_notes.py"]
178175
is-prerelease = ["python scripts/is_prerelease.py"]
179176
bump = ["cz bump {args}"]
180177
install-bundled-editable = "python ./scripts/install_bundled_editable.py"
178+
179+
180+
[envs.hatch-static-analysis]
181+
installer="uv"
182+
dependencies = ["ruff"]
183+
184+
[envs.hatch-static-analysis.scripts]
185+
format-check = ["ruff format --check --diff {args:.}"]
186+
format-fix = ["ruff format {args:.}"]
187+
lint-check = ["ruff check {args:.}"]
188+
lint-fix = "ruff check --fix {args:.}"

packages/core/src/robotcode/core/concurrent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def acquire(self, blocking: bool = True, timeout: Optional[float] = None) -> boo
5353
aquired = self._lock.acquire(blocking, timeout=timeout)
5454
if not aquired and blocking and timeout > 0:
5555
raise RuntimeError(
56-
f"Could not acquire {self.__class__.__qualname__} {self.name+' ' if self.name else ' '}in {timeout}s."
56+
f"Could not acquire {self.__class__.__qualname__} {self.name + ' ' if self.name else ' '}in {timeout}s."
5757
)
5858
return aquired
5959

packages/core/src/robotcode/core/utils/dataclasses.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,9 @@ def from_dict(
488488
(
489489
(getattr(e, "__name__", None) or str(e) if e is not type(None) else "None")
490490
if _get_origin_cached(e) is not Literal
491-
else repr(e).replace("typing.", "") if e is not None else "None"
491+
else repr(e).replace("typing.", "")
492+
if e is not None
493+
else "None"
492494
)
493495
for e in types
494496
)

packages/core/src/robotcode/core/utils/logging.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ def __init_logger(self) -> LoggingDescriptor:
149149
else (
150150
("" if self.__owner is None else self.__owner.__module__ + "." + self.__owner.__qualname__)
151151
if self.__owner is not None
152-
else get_unwrapped_func(self.__func).__module__ if self.__func is not None else "<unknown>"
152+
else get_unwrapped_func(self.__func).__module__
153+
if self.__func is not None
154+
else "<unknown>"
153155
)
154156
+ self.__postfix
155157
)

packages/debugger/src/robotcode/debugger/debugger.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,6 @@ def set_breakpoints(
547547
lines: Optional[List[int]] = None,
548548
source_modified: Optional[bool] = None,
549549
) -> List[Breakpoint]:
550-
551550
if self.is_windows_path(source.path or ""):
552551
path: pathlib.PurePath = pathlib.PureWindowsPath(source.path or "")
553552
else:
@@ -647,7 +646,6 @@ def process_start_state(self, source: str, line_no: int, type: str, status: str)
647646
if source_path in self.breakpoints:
648647
breakpoints = [v for v in self.breakpoints[source_path].breakpoints if v.line == line_no]
649648
if len(breakpoints) > 0:
650-
651649
for point in breakpoints:
652650
if point.condition is not None:
653651
hit = False

packages/debugger/src/robotcode/debugger/launcher/server.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,9 @@ async def _launch(
245245
kind=(
246246
RunInTerminalKind.INTEGRATED
247247
if console == "integratedTerminal"
248-
else RunInTerminalKind.EXTERNAL if console == "externalTerminal" else None
248+
else RunInTerminalKind.EXTERNAL
249+
if console == "externalTerminal"
250+
else None
249251
),
250252
title=name,
251253
)

packages/debugger/src/robotcode/debugger/protocol.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class DebugAdapterErrorResponseError(JsonRPCException):
4444
def __init__(self, error: ErrorResponse) -> None:
4545
super().__init__(
4646
f'{error.message} (seq={error.request_seq} command="{error.command}")'
47-
f'{f": {error.body.error}" if error.body is not None and error.body.error else ""}'
47+
f"{f': {error.body.error}' if error.body is not None and error.body.error else ''}"
4848
)
4949
self.error = error
5050

@@ -60,7 +60,7 @@ def __init__(
6060
) -> None:
6161
super().__init__(
6262
f'{(message + " ") if message else ""}(seq={request_seq} command="{command}")'
63-
f'{f": {error_message}" if error_message else ""}'
63+
f"{f': {error_message}' if error_message else ''}"
6464
)
6565
self.message = message
6666
self.request_seq = request_seq

0 commit comments

Comments
 (0)