Skip to content

Commit d1d62bc

Browse files
authored
chore(tooling): Add ruff ARG002, 003, 005 rules and fix all violations (#2291)
1 parent 820f575 commit d1d62bc

File tree

40 files changed

+236
-13
lines changed

40 files changed

+236
-13
lines changed

pyproject.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,6 @@ ignore = [
164164
"D205", # Missing blank line after summary
165165
"D212", # Multi-line docstring summary should start at the first line
166166
"D401", # First line should be in imperative mood ("Do", not "Does")
167-
# TODO: ethereum/execution-spec-tests#2176
168-
"ARG002", # unused-method-argument
169-
"ARG003", # unused-class-method-argument
170-
"ARG005", # unused-lambda-argument
171167
]
172168

173169
[tool.ruff.lint.per-file-ignores]

src/ethereum_clis/clis/besu.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ def evaluate(
108108
slow_request: bool = False,
109109
) -> TransitionToolOutput:
110110
"""Execute `evm t8n` with the specified arguments."""
111+
del slow_request
112+
111113
if not self.process:
112114
self.start_server()
113115

src/ethereum_clis/clis/ethereumjs.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def is_fork_supported(self, fork: Fork) -> bool:
4242
4343
Currently, EthereumJS-t8n provides no way to determine supported forks.
4444
"""
45+
del fork
4546
return True
4647

4748

src/ethereum_clis/clis/evmone.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def is_fork_supported(self, fork: Fork) -> bool:
5555
Return True if the fork is supported by the tool. Currently, evmone-t8n
5656
provides no way to determine supported forks.
5757
"""
58+
del fork
5859
return True
5960

6061

@@ -71,6 +72,7 @@ def __init__(
7172
trace: bool = False,
7273
):
7374
"""Initialize the EvmoneFixtureConsumerCommon class."""
75+
del trace
7476
self._info_metadata: Optional[Dict[str, Any]] = {}
7577

7678
def _run_command(self, command: List[str]) -> subprocess.CompletedProcess:

src/ethereum_clis/clis/nethermind.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ def consume_state_test_file(
151151
function is cached in order to only call the command once and
152152
`consume_state_test` can simply select the result that was requested.
153153
"""
154+
del fixture_path
154155
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
155156

156157
if debug_output_path:
@@ -228,6 +229,8 @@ def consume_blockchain_test(
228229
debug_output_path: Optional[Path] = None,
229230
) -> None:
230231
"""Execute the the fixture at `fixture_path` via `nethtest`."""
232+
del fixture_path
233+
del fixture_name
231234
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
232235

233236
if debug_output_path:
@@ -249,6 +252,7 @@ def consume_eof_test_file(
249252
debug_output_path: Optional[Path] = None,
250253
) -> Tuple[Dict[Any, Any], str, str]:
251254
"""Consume an entire EOF fixture file."""
255+
del fixture_path
252256
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
253257

254258
pattern = re.compile(r"^(test_.+?)\s+(PASS|FAIL)$", re.MULTILINE)

src/ethereum_clis/transition_tool.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@ def _server_post(
384384

385385
def _generate_post_args(self, t8n_data: TransitionToolData) -> Dict[str, List[str] | str]:
386386
"""Generate the arguments for the POST request to the t8n-server."""
387+
del t8n_data
387388
return {}
388389

389390
def _evaluate_server(

src/ethereum_test_base_types/tests/test_base_types.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ def test_json_serialization(
222222
self, can_be_deserialized: bool, model_instance: Any, json: str | Dict[str, Any]
223223
) -> None:
224224
"""Test that to_json returns the expected JSON for the given object."""
225+
del can_be_deserialized
225226
assert to_json(model_instance) == json
226227

227228
def test_json_deserialization(

src/ethereum_test_benchmark/benchmark_code_generator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def deploy_contracts(self, pre: Alloc, fork: Fork) -> None:
2121
code = self.generate_repeated_code(self.attack_block, self.setup, fork)
2222
self._contract_address = pre.deploy_contract(code=code)
2323

24-
def generate_transaction(self, pre: Alloc, gas_limit: int, fork: Fork) -> Transaction:
24+
def generate_transaction(self, pre: Alloc, gas_limit: int) -> Transaction:
2525
"""Generate transaction that executes the looping contract."""
2626
if not hasattr(self, "_contract_address"):
2727
raise ValueError("deploy_contracts must be called before generate_transaction")
@@ -68,7 +68,7 @@ def deploy_contracts(self, pre: Alloc, fork: Fork) -> None:
6868
caller_code = self.generate_repeated_code(code_sequence, Bytecode(), fork)
6969
self._contract_address = pre.deploy_contract(code=caller_code)
7070

71-
def generate_transaction(self, pre: Alloc, gas_limit: int, fork: Fork) -> Transaction:
71+
def generate_transaction(self, pre: Alloc, gas_limit: int) -> Transaction:
7272
"""Generate transaction that executes the caller contract."""
7373
if not hasattr(self, "_contract_address"):
7474
raise ValueError("deploy_contracts must be called before generate_transaction")

src/ethereum_test_execution/transaction_post.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ def execute(
3737
request: FixtureRequest,
3838
) -> None:
3939
"""Execute the format."""
40+
del fork
41+
del engine_rpc
4042
assert not any(tx.ty == 3 for block in self.blocks for tx in block), (
4143
"Transaction type 3 is not supported in execute mode."
4244
)

src/ethereum_test_fixtures/base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ def supports_fork(cls, fork: Fork) -> bool:
156156
157157
By default, all fixtures support all forks.
158158
"""
159+
del fork
159160
return True
160161

161162
@classmethod
@@ -168,6 +169,7 @@ def discard_fixture_format_by_marks(
168169
Discard a fixture format from filling if the appropriate marker is
169170
used.
170171
"""
172+
del fork, markers
171173
return False
172174

173175

0 commit comments

Comments
 (0)