From 2967c05025402cb3c5ad9951ed25c6c914692815 Mon Sep 17 00:00:00 2001 From: Ildeberto Vasconcelos Date: Sun, 7 Dec 2025 21:59:25 +0000 Subject: [PATCH 1/3] Fix parameter_assignments documentation for null safety and updated Dart syntax --- pkg/linter/messages.yaml | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/pkg/linter/messages.yaml b/pkg/linter/messages.yaml index 30a3fc20cd03..bcc3fbbe4c41 100644 --- a/pkg/linter/messages.yaml +++ b/pkg/linter/messages.yaml @@ -8259,12 +8259,11 @@ LinterLintCode: stable: "2.0" categories: [style] hasPublishedDocs: false - deprecatedDetails: |- + documentation: |- **DON'T** assign new values to parameters of methods or functions. - - Assigning new values to parameters is generally a bad practice unless an - operator such as `??=` is used. Otherwise, arbitrarily reassigning parameters - is usually a mistake. + Assigning new values to parameters is generally a bad practice, even when using + operators such as `??=`. Arbitrarily reassigning parameters is usually a + mistake and can make code harder to reason about. **BAD:** ```dart @@ -8275,14 +8274,14 @@ LinterLintCode: **BAD:** ```dart - void badFunction(int required, {int optional: 42}) { // LINT + void badFunction(int required, {int? optional}) { // LINT optional ??= 8; } ``` **BAD:** ```dart - void badFunctionPositional(int required, [int optional = 42]) { // LINT + void badFunctionPositional(int required, [int? optional]) { // LINT optional ??= 8; } ``` @@ -8305,15 +8304,17 @@ LinterLintCode: **GOOD:** ```dart - void actuallyGood(int required, {int optional}) { // OK - optional ??= ...; + void actuallyGood(int required, {int? optional}) { // OK + final value = optional ?? 8; + print(value); } ``` **GOOD:** ```dart - void actuallyGoodPositional(int required, [int optional]) { // OK - optional ??= ...; + void actuallyGoodPositional(int required, [int? optional]) { // OK + final value = optional ?? 8; + print(value); } ``` From 5189af2f1746307d698de41c59480116107a011d Mon Sep 17 00:00:00 2001 From: Ildeberto Vasconcelos Date: Sun, 7 Dec 2025 23:11:56 +0100 Subject: [PATCH 2/3] Update pkg/linter/messages.yaml Co-authored-by: Parker Lougheed --- pkg/linter/messages.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/linter/messages.yaml b/pkg/linter/messages.yaml index bcc3fbbe4c41..5dd6fd23cf9f 100644 --- a/pkg/linter/messages.yaml +++ b/pkg/linter/messages.yaml @@ -8261,6 +8261,7 @@ LinterLintCode: hasPublishedDocs: false documentation: |- **DON'T** assign new values to parameters of methods or functions. + Assigning new values to parameters is generally a bad practice, even when using operators such as `??=`. Arbitrarily reassigning parameters is usually a mistake and can make code harder to reason about. From 81c997987810c17ad80238605230312c9dacf1df Mon Sep 17 00:00:00 2001 From: Ildeberto Vasconcelos Date: Sun, 7 Dec 2025 22:15:00 +0000 Subject: [PATCH 3/3] update messages.yml parameter_assigments --- pkg/linter/messages.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/linter/messages.yaml b/pkg/linter/messages.yaml index 5dd6fd23cf9f..ce7d548b8b75 100644 --- a/pkg/linter/messages.yaml +++ b/pkg/linter/messages.yaml @@ -8259,7 +8259,7 @@ LinterLintCode: stable: "2.0" categories: [style] hasPublishedDocs: false - documentation: |- + deprecatedDetails: |- **DON'T** assign new values to parameters of methods or functions. Assigning new values to parameters is generally a bad practice, even when using