Files
sdk/pkg/analyzer_utilities/lib
Paul Berry e6228e34ca [messages] Handle camelCase-formatted files.
Updates the logic in `pkg/analyzer_utilities` and
`pkg/front_end/test/messages_suite.dart` for processing
`messages.yaml` files so that:

- Message keys in analyzer-style `messages.yaml` files can be
  `camelCase`, `lower_snake_case`, or `UPPER_SNAKE_CASE` (previously
  they could only be `lower_snake_case` or `UPPER_SNAKE_CASE`).

- Message keys in CFE-style `messages.yaml` files can be either
  `camelCase` or `PascalCase` (previously they could only be
  `PascalCase`).

- `sharedName` fields can be `camelCase`, `lower_snake_case`, or
  `UPPER_SNAKE_CASE` (previously they could only be `lower_snake_case`
  or `UPPER_SNAKE_CASE`).

- `analyzerCode` fields in `pkg/_fe_analyzer_shared/messages.yaml` can
  be `ClassName.lower_snake_case`, `ClassName.UPPER_SNAKE_CASE`, or
  `camelCase`, where `ClassName` is ignored (previously they could
  only be `ClassName.lower_snake_case` or
  `ClassName.UPPER_SNAKE_CASE`).

This paves the way for a follow-up CL in which all these fields and
keys will be standardized to `camelCase`, and then the ability to
specify them in `lower_snake_case` or `UPPER_SNAKE_CASE` will be
removed. This will eliminate a significant inconsistency between the
diagnostic code formats in the analyzer and the front end.

Note that a few diagnostic names contain an underscore immediately
followed by a digit in their snake case representation:

- `final_not_initialized_constructor_1`
- `final_not_initialized_constructor_2`
- `final_not_initialized_constructor_3_plus`
- `lines_longer_than_80_chars`

When these are converted to `camelCase` form, the code generator will
no longer know to introduce the underscores when converting them back
to `snake_case` form (e.g. `finalNotInitializedConstructor1` will get
converted to `final_not_initialized_constructor1`). The snake case
forms are an important part of the customer facing API (since they are
what is accepted in `// ignore:` comments), so in order to preserve
the existing snake case names, a hardcoded map is introduced,
`_snakeCaseExceptions`.

Change-Id: I6a6a696444ccd92dd6574a7cde08da88ac5a7135
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/466540
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-12-09 11:56:11 -08:00
..