From 3e923a8b4d1edb8928237ee173c0d934014be152 Mon Sep 17 00:00:00 2001 From: Philipp A Date: Fri, 20 Oct 2023 14:06:17 +0200 Subject: [PATCH 1/4] Fix message for `too-many-arguments` lint --- crates/ruff_linter/src/rules/pylint/rules/too_many_arguments.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ruff_linter/src/rules/pylint/rules/too_many_arguments.rs b/crates/ruff_linter/src/rules/pylint/rules/too_many_arguments.rs index 8948aeb0cc152..3be81cc42e0f2 100644 --- a/crates/ruff_linter/src/rules/pylint/rules/too_many_arguments.rs +++ b/crates/ruff_linter/src/rules/pylint/rules/too_many_arguments.rs @@ -53,7 +53,7 @@ impl Violation for TooManyArguments { #[derive_message_formats] fn message(&self) -> String { let TooManyArguments { c_args, max_args } = self; - format!("Too many arguments to function call ({c_args} > {max_args})") + format!("Too many arguments to function definition ({c_args} > {max_args})") } } From d445e3a88fbd4c7ae912d63e784b4ae613ca3ba1 Mon Sep 17 00:00:00 2001 From: Philipp A Date: Fri, 20 Oct 2023 14:26:02 +0200 Subject: [PATCH 2/4] Fix tests --- ...__pylint__tests__PLR0913_too_many_arguments.py.snap | 10 +++++----- .../ruff_linter__rules__pylint__tests__max_args.snap | 4 ++-- ...__pylint__tests__max_args_with_dummy_variables.snap | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0913_too_many_arguments.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0913_too_many_arguments.py.snap index 6677bf7e05d58..d1978c244d61f 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0913_too_many_arguments.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0913_too_many_arguments.py.snap @@ -1,35 +1,35 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -too_many_arguments.py:1:5: PLR0913 Too many arguments to function call (8 > 5) +too_many_arguments.py:1:5: PLR0913 Too many arguments to function definition (8 > 5) | 1 | def f(x, y, z, t, u, v, w, r): # Too many arguments (8/5) | ^ PLR0913 2 | pass | -too_many_arguments.py:17:5: PLR0913 Too many arguments to function call (6 > 5) +too_many_arguments.py:17:5: PLR0913 Too many arguments to function definition (6 > 5) | 17 | def f(x, y, z, u=1, v=1, r=1): # Too many arguments (6/5) | ^ PLR0913 18 | pass | -too_many_arguments.py:25:5: PLR0913 Too many arguments to function call (6 > 5) +too_many_arguments.py:25:5: PLR0913 Too many arguments to function definition (6 > 5) | 25 | def f(x, y, z, /, u, v, w): # Too many arguments (6/5) | ^ PLR0913 26 | pass | -too_many_arguments.py:29:5: PLR0913 Too many arguments to function call (6 > 5) +too_many_arguments.py:29:5: PLR0913 Too many arguments to function definition (6 > 5) | 29 | def f(x, y, z, *, u, v, w): # Too many arguments (6/5) | ^ PLR0913 30 | pass | -too_many_arguments.py:33:5: PLR0913 Too many arguments to function call (9 > 5) +too_many_arguments.py:33:5: PLR0913 Too many arguments to function definition (9 > 5) | 33 | def f(x, y, z, a, b, c, *, u, v, w): # Too many arguments (9/5) | ^ PLR0913 diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_args.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_args.snap index 48f493fdbb6a5..79bc85d92ac72 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_args.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_args.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -too_many_arguments_params.py:3:5: PLR0913 Too many arguments to function call (6 > 4) +too_many_arguments_params.py:3:5: PLR0913 Too many arguments to function definition (6 > 4) | 1 | # Too many args (6/4) for max_args=4 2 | # OK for dummy_variable_rgx ~ "skip_.*" @@ -10,7 +10,7 @@ too_many_arguments_params.py:3:5: PLR0913 Too many arguments to function call (6 4 | pass | -too_many_arguments_params.py:9:5: PLR0913 Too many arguments to function call (6 > 4) +too_many_arguments_params.py:9:5: PLR0913 Too many arguments to function definition (6 > 4) | 7 | # Too many args (6/4) for max_args=4 8 | # Too many args (6/5) for dummy_variable_rgx ~ "skip_.*" diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_args_with_dummy_variables.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_args_with_dummy_variables.snap index 12a9a7fdcb563..ffeb0955e73f6 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_args_with_dummy_variables.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_args_with_dummy_variables.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -too_many_arguments_params.py:9:5: PLR0913 Too many arguments to function call (6 > 5) +too_many_arguments_params.py:9:5: PLR0913 Too many arguments to function definition (6 > 5) | 7 | # Too many args (6/4) for max_args=4 8 | # Too many args (6/5) for dummy_variable_rgx ~ "skip_.*" From b67d0677ede7c652a380caecab7b049308266fb1 Mon Sep 17 00:00:00 2001 From: Philipp A Date: Fri, 20 Oct 2023 16:14:31 +0200 Subject: [PATCH 3/4] Update crates/ruff_linter/src/rules/pylint/rules/too_many_arguments.rs Co-authored-by: Zanie Blue --- crates/ruff_linter/src/rules/pylint/rules/too_many_arguments.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ruff_linter/src/rules/pylint/rules/too_many_arguments.rs b/crates/ruff_linter/src/rules/pylint/rules/too_many_arguments.rs index 3be81cc42e0f2..5ddd80ecbc37c 100644 --- a/crates/ruff_linter/src/rules/pylint/rules/too_many_arguments.rs +++ b/crates/ruff_linter/src/rules/pylint/rules/too_many_arguments.rs @@ -53,7 +53,7 @@ impl Violation for TooManyArguments { #[derive_message_formats] fn message(&self) -> String { let TooManyArguments { c_args, max_args } = self; - format!("Too many arguments to function definition ({c_args} > {max_args})") + format!("Too many arguments in function definition ({c_args} > {max_args})") } } From 04de4cd5b576dc00f3faab3cbfe9c4b2d43145f9 Mon Sep 17 00:00:00 2001 From: Philipp A Date: Fri, 20 Oct 2023 16:15:41 +0200 Subject: [PATCH 4/4] fix tests again --- ...__pylint__tests__PLR0913_too_many_arguments.py.snap | 10 +++++----- .../ruff_linter__rules__pylint__tests__max_args.snap | 4 ++-- ...__pylint__tests__max_args_with_dummy_variables.snap | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0913_too_many_arguments.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0913_too_many_arguments.py.snap index d1978c244d61f..0dd41c50267ba 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0913_too_many_arguments.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0913_too_many_arguments.py.snap @@ -1,35 +1,35 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -too_many_arguments.py:1:5: PLR0913 Too many arguments to function definition (8 > 5) +too_many_arguments.py:1:5: PLR0913 Too many arguments in function definition (8 > 5) | 1 | def f(x, y, z, t, u, v, w, r): # Too many arguments (8/5) | ^ PLR0913 2 | pass | -too_many_arguments.py:17:5: PLR0913 Too many arguments to function definition (6 > 5) +too_many_arguments.py:17:5: PLR0913 Too many arguments in function definition (6 > 5) | 17 | def f(x, y, z, u=1, v=1, r=1): # Too many arguments (6/5) | ^ PLR0913 18 | pass | -too_many_arguments.py:25:5: PLR0913 Too many arguments to function definition (6 > 5) +too_many_arguments.py:25:5: PLR0913 Too many arguments in function definition (6 > 5) | 25 | def f(x, y, z, /, u, v, w): # Too many arguments (6/5) | ^ PLR0913 26 | pass | -too_many_arguments.py:29:5: PLR0913 Too many arguments to function definition (6 > 5) +too_many_arguments.py:29:5: PLR0913 Too many arguments in function definition (6 > 5) | 29 | def f(x, y, z, *, u, v, w): # Too many arguments (6/5) | ^ PLR0913 30 | pass | -too_many_arguments.py:33:5: PLR0913 Too many arguments to function definition (9 > 5) +too_many_arguments.py:33:5: PLR0913 Too many arguments in function definition (9 > 5) | 33 | def f(x, y, z, a, b, c, *, u, v, w): # Too many arguments (9/5) | ^ PLR0913 diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_args.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_args.snap index 79bc85d92ac72..440f2dafeb402 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_args.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_args.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -too_many_arguments_params.py:3:5: PLR0913 Too many arguments to function definition (6 > 4) +too_many_arguments_params.py:3:5: PLR0913 Too many arguments in function definition (6 > 4) | 1 | # Too many args (6/4) for max_args=4 2 | # OK for dummy_variable_rgx ~ "skip_.*" @@ -10,7 +10,7 @@ too_many_arguments_params.py:3:5: PLR0913 Too many arguments to function definit 4 | pass | -too_many_arguments_params.py:9:5: PLR0913 Too many arguments to function definition (6 > 4) +too_many_arguments_params.py:9:5: PLR0913 Too many arguments in function definition (6 > 4) | 7 | # Too many args (6/4) for max_args=4 8 | # Too many args (6/5) for dummy_variable_rgx ~ "skip_.*" diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_args_with_dummy_variables.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_args_with_dummy_variables.snap index ffeb0955e73f6..865d4d0abd262 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_args_with_dummy_variables.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__max_args_with_dummy_variables.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -too_many_arguments_params.py:9:5: PLR0913 Too many arguments to function definition (6 > 5) +too_many_arguments_params.py:9:5: PLR0913 Too many arguments in function definition (6 > 5) | 7 | # Too many args (6/4) for max_args=4 8 | # Too many args (6/5) for dummy_variable_rgx ~ "skip_.*"