Skip to content

Commit fd1b0e1

Browse files
committed
Fix: Ruff did not check code quality
Solution: Add ruff to check the code quality and fix the reported errors.
1 parent f6d0b7b commit fd1b0e1

File tree

5 files changed

+10
-12
lines changed

5 files changed

+10
-12
lines changed

pyproject.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,19 +141,19 @@ dependencies = [
141141
"black==24.2.0",
142142
"mypy==1.9.0",
143143
"mypy-extensions==1.0.0",
144-
# "ruff==0.1.15",
144+
"ruff==0.4.8",
145145
"isort==5.13.2",
146146
]
147147
[tool.hatch.envs.linting.scripts]
148148
typing = "mypy --config-file=pyproject.toml {args:} ./src/ ./tests/ ./examples/"
149149
style = [
150-
# "ruff {args:.}",
150+
"ruff {args:.} ./src/ ./tests/ ./examples/",
151151
"black --check --diff {args:} ./src/ ./tests/ ./examples/",
152152
"isort --check-only --profile black {args:} ./src/ ./tests/ ./examples/",
153153
]
154154
fmt = [
155155
"black {args:} ./src/ ./tests/ ./examples/",
156-
# "ruff --fix {args:.}",
156+
"ruff --fix {args:.} ./src/ ./tests/ ./examples/",
157157
"isort --profile black {args:} ./src/ ./tests/ ./examples/",
158158
"style",
159159
]
@@ -169,6 +169,7 @@ exclude = [
169169
"conftest.py"
170170
]
171171
show_column_numbers = true
172+
check_untyped_defs = true
172173

173174
# Import discovery
174175
# Install types for third-party library stubs (e.g. from typeshed repository)
@@ -231,4 +232,4 @@ exclude_lines = [
231232

232233
# Don't complain about ineffective code:
233234
"pass",
234-
]
235+
]

tests/unit/conftest.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
import asyncio
12
import json
3+
from functools import wraps
24
from io import BytesIO
35
from pathlib import Path
46
from tempfile import NamedTemporaryFile
@@ -196,10 +198,6 @@ def mock_session_with_post_success(
196198
return client
197199

198200

199-
import asyncio
200-
from functools import wraps
201-
202-
203201
def async_wrap(cls):
204202
class AsyncWrapper:
205203
def __init__(self, *args, **kwargs):

tests/unit/test_domains.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ async def test_configured_domain():
4747
url = "https://custom-domain-unit-test.aleph.sh"
4848
hostname = hostname_from_url(url)
4949
status = await alephdns.check_domain(hostname, TargetType.IPFS, "0xfakeaddress")
50-
assert type(status) is dict
50+
assert isinstance(status, dict)
5151

5252

5353
@pytest.mark.asyncio
@@ -57,4 +57,4 @@ async def test_not_configured_domain():
5757
hostname = hostname_from_url(url)
5858
with pytest.raises(DomainConfigurationError):
5959
status = await alephdns.check_domain(hostname, TargetType.IPFS, "0xfakeaddress")
60-
assert type(status) is None
60+
assert status is None

tests/unit/test_download.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import tempfile
22
from pathlib import Path
3-
from unittest.mock import AsyncMock, patch
43

54
import pytest
65

tests/unit/test_wallet_ethereum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ async def test_ledger_eth_account():
2323

2424
address = account.get_address()
2525
assert address
26-
assert type(address) is str
26+
assert isinstance(address, str)
2727
assert len(address) == 42
2828

2929
message = Message("ETH", account.get_address(), "SomeType", "ItemHash")

0 commit comments

Comments
 (0)