Skip to content

Commit 6907b09

Browse files
chore: unused arguments (#2166)
Co-authored-by: danceratopz <[email protected]>
1 parent 47ab040 commit 6907b09

File tree

35 files changed

+92
-51
lines changed

35 files changed

+92
-51
lines changed

docs/getting_started/code_standards.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ Code pushed to @ethereum/execution-spec-tests must fulfill the following checks
8080
- **Relative Imports**: Use relative imports within the same package
8181
- **Error Handling**: Use explicit exception types and meaningful error messages.
8282
- **Type Hints**: All functions should include type annotations.
83+
- **Unused Function Arguments**: When unavoidable, use `del`, e.g., `del unused_var`, at function start to avoid flagging linter errors.
8384
- **Variable Naming**:
8485
- Use `snake_case` for variables, functions, and modules.
8586
- Use `PascalCase` for classes.

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,13 @@ ethereum_test_forks = ["forks/contracts/*.bin"]
127127
line-length = 99
128128

129129
[tool.ruff.lint]
130-
select = ["E", "F", "B", "W", "I", "A", "N", "D", "C"]
130+
select = ["E", "F", "B", "W", "I", "A", "N", "D", "C", "ARG001"]
131131
fixable = ["I", "B", "E", "F", "W", "D", "C"]
132132
ignore = ["D205", "D203", "D212", "D415", "C420", "C901"]
133133

134+
[tool.ruff.lint.per-file-ignores]
135+
"tests/*" = ["ARG001"] # TODO: ethereum/execution-spec-tests#2188
136+
134137
[tool.mypy]
135138
disable_error_code = ["import-untyped"]
136139
mypy_path = ["src", "$MYPY_CONFIG_FILE_DIR/stubs"]

src/cli/gen_index.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,6 @@ def count_json_files_exclude_index(start_path: Path) -> int:
5353
required=True,
5454
help="The input directory",
5555
)
56-
@click.option(
57-
"--disable-infer-format",
58-
"-d",
59-
"disable_infer_format",
60-
is_flag=True,
61-
default=False,
62-
expose_value=True,
63-
help="Don't try to guess the fixture format from the json file's path.",
64-
)
6556
@click.option(
6657
"--quiet",
6758
"-q",
@@ -80,23 +71,19 @@ def count_json_files_exclude_index(start_path: Path) -> int:
8071
expose_value=True,
8172
help="Force re-generation of the index file, even if it already exists.",
8273
)
83-
def generate_fixtures_index_cli(
84-
input_dir: str, quiet_mode: bool, force_flag: bool, disable_infer_format: bool
85-
):
74+
def generate_fixtures_index_cli(input_dir: str, quiet_mode: bool, force_flag: bool):
8675
"""CLI wrapper to an index of all the fixtures in the specified directory."""
8776
generate_fixtures_index(
8877
Path(input_dir),
8978
quiet_mode=quiet_mode,
9079
force_flag=force_flag,
91-
disable_infer_format=disable_infer_format,
9280
)
9381

9482

9583
def generate_fixtures_index(
9684
input_path: Path,
9785
quiet_mode: bool = False,
9886
force_flag: bool = False,
99-
disable_infer_format: bool = False,
10087
):
10188
"""
10289
Generate an index file (index.json) of all the fixtures in the specified

src/cli/gentest/tests/test_cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ def test_tx_type(pytester, tmp_path, monkeypatch, tx_type, transaction_hash, def
106106
tx = transactions_by_type[tx_type]
107107

108108
def get_mock_context(self: StateTestProvider) -> dict:
109+
del self
109110
return tx
110111

111112
monkeypatch.setattr(StateTestProvider, "get_context", get_mock_context)

src/cli/pytest_commands/check_eip_versions.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
@common_pytest_options
1515
def check_eip_versions(pytest_args: List[str], **kwargs) -> None:
1616
"""Run pytest with the `spec_version_checker` plugin."""
17+
del kwargs
18+
1719
command = PytestCommand(
1820
config_file="pytest-check-eip-versions.ini",
1921
argument_processors=[HelpFlagsProcessor("check-eip-versions")],

src/cli/pytest_commands/checklist.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ def checklist(output: str, eip: tuple, **kwargs) -> None:
4141
uv run checklist --output ./my-checklists
4242
4343
"""
44+
del kwargs
45+
4446
# Add output directory to pytest args
4547
args = ["--checklist-output", output]
4648

src/cli/pytest_commands/consume.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def create_consume_command(
3636
)
3737

3838

39-
def get_command_logic_test_paths(command_name: str, is_hive: bool) -> List[Path]:
39+
def get_command_logic_test_paths(command_name: str) -> List[Path]:
4040
"""Determine the command paths based on the command name and hive flag."""
4141
base_path = Path("pytest_plugins/consume")
4242
if command_name in ["engine", "rlp"]:
@@ -66,7 +66,7 @@ def consume_command(is_hive: bool = False) -> Callable[[Callable[..., Any]], cli
6666
def decorator(func: Callable[..., Any]) -> click.Command:
6767
command_name = func.__name__
6868
command_help = func.__doc__
69-
command_logic_test_paths = get_command_logic_test_paths(command_name, is_hive)
69+
command_logic_test_paths = get_command_logic_test_paths(command_name)
7070

7171
@consume.command(
7272
name=command_name,
@@ -76,6 +76,8 @@ def decorator(func: Callable[..., Any]) -> click.Command:
7676
@common_pytest_options
7777
@functools.wraps(func)
7878
def command(pytest_args: List[str], **kwargs) -> None:
79+
del kwargs
80+
7981
consume_cmd = create_consume_command(
8082
command_logic_test_paths=command_logic_test_paths,
8183
is_hive=is_hive,
@@ -118,5 +120,7 @@ def sync() -> None:
118120
@common_pytest_options
119121
def cache(pytest_args: List[str], **kwargs) -> None:
120122
"""Consume command to cache test fixtures."""
123+
del kwargs
124+
121125
cache_cmd = create_consume_command(command_logic_test_paths=[], is_hive=False)
122126
cache_cmd.execute(list(pytest_args))

src/cli/pytest_commands/fill.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ def create_executions(self, pytest_args: List[str]) -> List[PytestExecution]:
213213
@common_pytest_options
214214
def fill(pytest_args: List[str], **kwargs) -> None:
215215
"""Entry point for the fill command."""
216+
del kwargs
217+
216218
command = FillCommand()
217219
command.execute(list(pytest_args))
218220

@@ -225,6 +227,8 @@ def fill(pytest_args: List[str], **kwargs) -> None:
225227
@common_pytest_options
226228
def phil(pytest_args: List[str], **kwargs) -> None:
227229
"""Friendly alias for the fill command."""
230+
del kwargs
231+
228232
command = PhilCommand()
229233
command.execute(list(pytest_args))
230234

src/cli/show_pre_alloc_group_stats.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def calculate_size_distribution(
100100
return group_distribution, test_distribution
101101

102102

103-
def analyze_pre_alloc_folder(folder: Path, verbose: int = 0) -> Dict:
103+
def analyze_pre_alloc_folder(folder: Path) -> Dict:
104104
"""Analyze pre-allocation folder and return statistics."""
105105
pre_alloc_groups = PreAllocGroups.from_folder(folder, lazy_load=False)
106106

@@ -480,7 +480,7 @@ def main(pre_alloc_folder: Path, verbose: int):
480480
console = Console()
481481

482482
try:
483-
stats = analyze_pre_alloc_folder(pre_alloc_folder, verbose=verbose)
483+
stats = analyze_pre_alloc_folder(pre_alloc_folder)
484484
display_stats(stats, console, verbose=verbose)
485485
except FileNotFoundError:
486486
console.print(f"[red]Error: Folder not found: {pre_alloc_folder}[/red]")

src/cli/tests/test_pytest_execute_command.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def test_execute_help_shows_subcommand_docstrings(runner):
2828
assert "Recover funds from test executions" in result.output
2929

3030

31-
def test_execute_subcommands_have_help_text(runner):
31+
def test_execute_subcommands_have_help_text():
3232
"""Test that execute sub-commands have proper help text defined."""
3333
from ..pytest_commands.execute import hive, recover, remote
3434

0 commit comments

Comments
 (0)