Commit e6228e3
[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 <[email protected]>
Commit-Queue: Paul Berry <[email protected]>1 parent d0b5024 commit e6228e3
File tree
5 files changed
+88
-18
lines changed- pkg
- analyzer_utilities/lib
- front_end
- test
- tool
5 files changed
+88
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
199 | | - | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
200 | 202 | | |
201 | 203 | | |
202 | 204 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | | - | |
| 156 | + | |
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
175 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
176 | 187 | | |
177 | 188 | | |
178 | 189 | | |
| |||
211 | 222 | | |
212 | 223 | | |
213 | 224 | | |
214 | | - | |
| 225 | + | |
| 226 | + | |
215 | 227 | | |
216 | | - | |
217 | | - | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
218 | 244 | | |
| 245 | + | |
219 | 246 | | |
220 | 247 | | |
221 | 248 | | |
222 | 249 | | |
223 | | - | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
224 | 288 | | |
225 | 289 | | |
226 | 290 | | |
227 | 291 | | |
228 | 292 | | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | 293 | | |
233 | 294 | | |
234 | 295 | | |
| |||
410 | 471 | | |
411 | 472 | | |
412 | 473 | | |
413 | | - | |
| 474 | + | |
414 | 475 | | |
415 | 476 | | |
416 | 477 | | |
| |||
602 | 663 | | |
603 | 664 | | |
604 | 665 | | |
605 | | - | |
| 666 | + | |
606 | 667 | | |
607 | 668 | | |
608 | 669 | | |
| |||
949 | 1010 | | |
950 | 1011 | | |
951 | 1012 | | |
952 | | - | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
953 | 1016 | | |
954 | 1017 | | |
955 | | - | |
| 1018 | + | |
| 1019 | + | |
956 | 1020 | | |
957 | 1021 | | |
958 | 1022 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
176 | 177 | | |
177 | 178 | | |
178 | 179 | | |
179 | | - | |
| 180 | + | |
180 | 181 | | |
181 | | - | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
182 | 185 | | |
183 | 186 | | |
184 | 187 | | |
| |||
552 | 555 | | |
553 | 556 | | |
554 | 557 | | |
555 | | - | |
| 558 | + | |
556 | 559 | | |
557 | 560 | | |
558 | 561 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
631 | 631 | | |
632 | 632 | | |
633 | 633 | | |
| 634 | + | |
634 | 635 | | |
635 | 636 | | |
636 | 637 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
155 | | - | |
| 155 | + | |
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
| |||
0 commit comments