[L] Change in dart/sdk[main]: [analyzer] Adds new diagnostic for `unsupported_lint`

1 view
Skip to first unread message

Felipe Morschel (Gerrit)

unread,
Sep 25, 2025, 11:43:07 AM (4 days ago) Sep 25
to dart-analys...@google.com, rev...@dartlang.org

Felipe Morschel has uploaded the change for review

Commit message

[analyzer] Adds new diagnostic for `unsupported_lint`

This is a step towards better handling lints for specific features. In a future CL we will review all lints and add the feature tag where appropriate.
Change-Id: Ice12b3c690152bc512260ec79dfbf1237326fa1a

Change information

Files:
  • M pkg/analysis_server/lib/src/context_manager.dart
  • M pkg/analysis_server/lib/src/handler/legacy/edit_get_fixes.dart
  • M pkg/analysis_server/lib/src/lsp/handlers/code_actions/analysis_options.dart
  • M pkg/analysis_server/test/services/linter/linter_test.dart
  • M pkg/analysis_server/test/src/services/correction/fix/analysis_options/test_support.dart
  • M pkg/analyzer/lib/analysis_rule/rule_state.dart
  • M pkg/analyzer/lib/src/analysis_options/error/option_codes.g.dart
  • M pkg/analyzer/lib/src/analysis_options/options_file_validator.dart
  • M pkg/analyzer/lib/src/diagnostic/diagnostic_code_values.g.dart
  • M pkg/analyzer/lib/src/lint/options_rule_validator.dart
  • M pkg/analyzer/messages.yaml
  • M pkg/analyzer/test/src/diagnostics/analysis_options/analysis_options_test_support.dart
  • M pkg/analyzer/test/src/options/options_file_validator_test.dart
  • M pkg/analyzer/test/src/options/options_rule_validator_test.dart
  • M pkg/analyzer_cli/lib/src/driver.dart
  • M pkg/linter/tool/messages_info.dart
Change size: L
Delta: 16 files changed, 301 insertions(+), 18 deletions(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: Ice12b3c690152bc512260ec79dfbf1237326fa1a
Gerrit-Change-Number: 451541
Gerrit-PatchSet: 1
Gerrit-Owner: Felipe Morschel <g...@fmorschel.dev>
Gerrit-Reviewer: Felipe Morschel <g...@fmorschel.dev>
unsatisfied_requirement
open
diffy

Felipe Morschel (Gerrit)

unread,
Sep 25, 2025, 11:48:01 AM (4 days ago) Sep 25
to Brian Wilkerson, Konstantin Shcheglov, Paul Berry, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Brian Wilkerson and Konstantin Shcheglov

Felipe Morschel added 1 comment

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Felipe Morschel . resolved

Adding @paul...@google.com as CC mostly because of the changes to `messages.yaml`.

Open in Gerrit

Related details

Attention is currently required from:
  • Brian Wilkerson
  • Konstantin Shcheglov
Submit Requirements:
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: Ice12b3c690152bc512260ec79dfbf1237326fa1a
Gerrit-Change-Number: 451541
Gerrit-PatchSet: 1
Gerrit-Owner: Felipe Morschel <g...@fmorschel.dev>
Gerrit-Reviewer: Brian Wilkerson <brianwi...@google.com>
Gerrit-Reviewer: Felipe Morschel <g...@fmorschel.dev>
Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
Gerrit-CC: Paul Berry <paul...@google.com>
Gerrit-Attention: Brian Wilkerson <brianwi...@google.com>
Gerrit-Attention: Konstantin Shcheglov <sche...@google.com>
Gerrit-Comment-Date: Thu, 25 Sep 2025 15:47:58 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
open
diffy

Paul Berry (Gerrit)

unread,
Sep 25, 2025, 3:52:28 PM (4 days ago) Sep 25
to Felipe Morschel, Brian Wilkerson, Konstantin Shcheglov, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Brian Wilkerson, Felipe Morschel and Konstantin Shcheglov

Paul Berry added 3 comments

Patchset-level comments
Paul Berry . resolved

Added some drive-by comments to `pkg/analyzer/messages.yaml`. Let me know if you want me to do a full review.

File pkg/analyzer/messages.yaml
Line 258, Patchset 1 (Latest): String p0: the rule name
Paul Berry . unresolved

The reason all the existing messages have parameters called `p0`, `p1`, etc. is because when I added the ability to give parameters names, I didn't want to stall my progress by thinking carefully about good names for all of the existing parameters. I intend to go back and assign better names for parameters over time.

For new messages, we should go ahead and give them good parameter names from the outset. Consider something like:

```
parameters:
String ruleName: the rule name
String featureName: the feature name
problemMessage: "'#ruleName' can't be active because it requires the '#featureName' experiment."
...
```
Line 269, Patchset 1 (Latest): String p0: the rule name
Paul Berry . unresolved

Similar issue here

Open in Gerrit

Related details

Attention is currently required from:
  • Brian Wilkerson
  • Felipe Morschel
  • Konstantin Shcheglov
Submit Requirements:
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: Ice12b3c690152bc512260ec79dfbf1237326fa1a
Gerrit-Change-Number: 451541
Gerrit-PatchSet: 1
Gerrit-Owner: Felipe Morschel <g...@fmorschel.dev>
Gerrit-Reviewer: Brian Wilkerson <brianwi...@google.com>
Gerrit-Reviewer: Felipe Morschel <g...@fmorschel.dev>
Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
Gerrit-CC: Paul Berry <paul...@google.com>
Gerrit-Attention: Brian Wilkerson <brianwi...@google.com>
Gerrit-Attention: Felipe Morschel <g...@fmorschel.dev>
Gerrit-Attention: Konstantin Shcheglov <sche...@google.com>
Gerrit-Comment-Date: Thu, 25 Sep 2025 19:52:25 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
open
diffy

Felipe Morschel (Gerrit)

unread,
Sep 25, 2025, 3:56:50 PM (4 days ago) Sep 25
to Brian Wilkerson, Konstantin Shcheglov, Paul Berry, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Brian Wilkerson, Konstantin Shcheglov and Paul Berry

Felipe Morschel added 1 comment

File pkg/analyzer/messages.yaml
Line 258, Patchset 1 (Latest): String p0: the rule name
Paul Berry . unresolved

The reason all the existing messages have parameters called `p0`, `p1`, etc. is because when I added the ability to give parameters names, I didn't want to stall my progress by thinking carefully about good names for all of the existing parameters. I intend to go back and assign better names for parameters over time.

For new messages, we should go ahead and give them good parameter names from the outset. Consider something like:

```
parameters:
String ruleName: the rule name
String featureName: the feature name
problemMessage: "'#ruleName' can't be active because it requires the '#featureName' experiment."
...
```
Felipe Morschel

Ohh! That makes so much more sense! I should've realized it sooner!

At least this and https://dart-review.googlesource.com/c/sdk/+/448601 will have that but I'll have to send a new CL for https://dart-review.googlesource.com/c/sdk/+/429240 hahaha.

Thanks! I'll update this later.

Open in Gerrit

Related details

Attention is currently required from:
  • Brian Wilkerson
  • Konstantin Shcheglov
  • Paul Berry
Submit Requirements:
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: Ice12b3c690152bc512260ec79dfbf1237326fa1a
Gerrit-Change-Number: 451541
Gerrit-PatchSet: 1
Gerrit-Owner: Felipe Morschel <g...@fmorschel.dev>
Gerrit-Reviewer: Brian Wilkerson <brianwi...@google.com>
Gerrit-Reviewer: Felipe Morschel <g...@fmorschel.dev>
Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
Gerrit-CC: Paul Berry <paul...@google.com>
Gerrit-Attention: Brian Wilkerson <brianwi...@google.com>
Gerrit-Attention: Paul Berry <paul...@google.com>
Gerrit-Attention: Konstantin Shcheglov <sche...@google.com>
Gerrit-Comment-Date: Thu, 25 Sep 2025 19:56:47 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Paul Berry <paul...@google.com>
unsatisfied_requirement
open
diffy

Felipe Morschel (Gerrit)

unread,
Sep 25, 2025, 3:58:18 PM (4 days ago) Sep 25
to Brian Wilkerson, Konstantin Shcheglov, Paul Berry, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Brian Wilkerson, Konstantin Shcheglov and Paul Berry

Felipe Morschel added 1 comment

File pkg/linter/tool/messages_info.dart
Line 309, Patchset 1 (Latest): var requiredFeature = _readFeature(data);
Felipe Morschel . unresolved

@paul...@google.com not a full review but the CC was mostly because of these changes (around this file). Just to make sure you have seen them.

Gerrit-Comment-Date: Thu, 25 Sep 2025 19:58:15 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
open
diffy

Paul Berry (Gerrit)

unread,
Sep 26, 2025, 3:20:08 PM (3 days ago) Sep 26
to Felipe Morschel, Brian Wilkerson, Konstantin Shcheglov, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Brian Wilkerson, Felipe Morschel and Konstantin Shcheglov

Paul Berry added 3 comments

File pkg/analyzer/messages.yaml
Line 258, Patchset 1 (Latest): String p0: the rule name
Paul Berry . resolved

The reason all the existing messages have parameters called `p0`, `p1`, etc. is because when I added the ability to give parameters names, I didn't want to stall my progress by thinking carefully about good names for all of the existing parameters. I intend to go back and assign better names for parameters over time.

For new messages, we should go ahead and give them good parameter names from the outset. Consider something like:

```
parameters:
String ruleName: the rule name
String featureName: the feature name
problemMessage: "'#ruleName' can't be active because it requires the '#featureName' experiment."
...
```
Felipe Morschel

Ohh! That makes so much more sense! I should've realized it sooner!

At least this and https://dart-review.googlesource.com/c/sdk/+/448601 will have that but I'll have to send a new CL for https://dart-review.googlesource.com/c/sdk/+/429240 hahaha.

Thanks! I'll update this later.

Paul Berry

Acknowledged

Line 269, Patchset 1 (Latest): String p0: the rule name
Paul Berry . resolved

Similar issue here

Paul Berry

Marking this as "resolved" because I'm fine with it happening either in this CL or a future CL; your choice.

File pkg/linter/tool/messages_info.dart
Line 309, Patchset 1 (Latest): var requiredFeature = _readFeature(data);
Felipe Morschel . resolved

@paul...@google.com not a full review but the CC was mostly because of these changes (around this file). Just to make sure you have seen them.

Paul Berry

Acknowledged

Open in Gerrit

Related details

Attention is currently required from:
  • Brian Wilkerson
  • Felipe Morschel
  • Konstantin Shcheglov
Submit Requirements:
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: Ice12b3c690152bc512260ec79dfbf1237326fa1a
Gerrit-Change-Number: 451541
Gerrit-PatchSet: 1
Gerrit-Owner: Felipe Morschel <g...@fmorschel.dev>
Gerrit-Reviewer: Brian Wilkerson <brianwi...@google.com>
Gerrit-Reviewer: Felipe Morschel <g...@fmorschel.dev>
Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
Gerrit-CC: Paul Berry <paul...@google.com>
Gerrit-Attention: Brian Wilkerson <brianwi...@google.com>
Gerrit-Attention: Felipe Morschel <g...@fmorschel.dev>
Gerrit-Attention: Konstantin Shcheglov <sche...@google.com>
Gerrit-Comment-Date: Fri, 26 Sep 2025 19:20:04 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Paul Berry <paul...@google.com>
Comment-In-Reply-To: Felipe Morschel <g...@fmorschel.dev>
unsatisfied_requirement
open
diffy

Brian Wilkerson (Gerrit)

unread,
Sep 26, 2025, 5:21:09 PM (3 days ago) Sep 26
to Felipe Morschel, Brian Wilkerson, Konstantin Shcheglov, Paul Berry, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Felipe Morschel and Konstantin Shcheglov

Brian Wilkerson added 4 comments

Patchset-level comments
Brian Wilkerson . resolved

I added a couple of minor comments as I was trying to get the context to review this CL, but you should ignore them in favor of addressing the bigger issue, for which I added notes to the issue.

File pkg/analyzer/messages.yaml
Line 260, Patchset 1 (Latest): problemMessage: "'#p0' can't be active because it requires the '#p1' experiment."
Brian Wilkerson . unresolved

"active" --> "enabled"

Line 260, Patchset 1 (Latest): problemMessage: "'#p0' can't be active because it requires the '#p1' experiment."
Brian Wilkerson . unresolved

"experiment" --> "experiment to be enabled"

Line 273, Patchset 1 (Latest): correctionMessage: "Try using Dart '#p2' or later or enabling the '#p1' experiment."
Brian Wilkerson . unresolved

This seems like the wrong fix for what I think this diagnostic is for. I don't know whether the message is bad or whether my understanding is off.

I'm guessing that `unsupported_lint` is generated when a lint rule requires that a given experiment be enabled and it isn't. I'd then guess that `unsupported_lint_version` is generated when a lint rule requires a certain version or above and the minimum SDK constraints are below that version.

If that's true, then the fix is to change the minimum sdk constraint, not to enable an experiment.

Open in Gerrit

Related details

Attention is currently required from:
  • Felipe Morschel
  • Konstantin Shcheglov
Submit Requirements:
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: Ice12b3c690152bc512260ec79dfbf1237326fa1a
Gerrit-Change-Number: 451541
Gerrit-PatchSet: 1
Gerrit-Owner: Felipe Morschel <g...@fmorschel.dev>
Gerrit-Reviewer: Brian Wilkerson <brianwi...@google.com>
Gerrit-Reviewer: Felipe Morschel <g...@fmorschel.dev>
Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
Gerrit-CC: Paul Berry <paul...@google.com>
Gerrit-Attention: Felipe Morschel <g...@fmorschel.dev>
Gerrit-Attention: Konstantin Shcheglov <sche...@google.com>
Gerrit-Comment-Date: Fri, 26 Sep 2025 21:21:05 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages