Skip to content

Commit 6cbd5c4

Browse files
stereotype441Commit Queue
authored andcommitted
[analyzer/linter] Clean up error message comments.
This change modifies the comments in the analyzer and linter `messages.yaml` files so that: - Parameters are always described at the end of the comment. If the message takes no parameters, the comment ends with the text `No parameters.` - Parameter descriptions are always word wrapped to 80 columns. It also fixes the format of the comment field for `ANALYSIS_OPTION_DEPRECATED` to remove an unintentional blank line, and adds documentation for the second parameter of `INVALID_EXPORT_OF_INTERNAL_ELEMENT_INDIRECTLY` (which was previously missing). In a follow-up CL, I will transition to a more structured format for parameters in these `messages.yaml` files, and the `Parameters:` sections of the comments will be automatically generated from this structured format during code generation. Cleaning up the comments now will ensure that the follow-up CL is clean (makes no changes to generated files), so we'll be able to have high confidence in its correctness. Change-Id: I6aa1f75fa0b8e4fb9724dcba00fb7d1f06dfb355 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/444205 Reviewed-by: Johnni Winther <[email protected]> Commit-Queue: Paul Berry <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]> Reviewed-by: Phil Quitslund <[email protected]>
1 parent 700b784 commit 6cbd5c4

File tree

11 files changed

+1357
-132
lines changed

11 files changed

+1357
-132
lines changed

pkg/_fe_analyzer_shared/lib/src/scanner/errors.g.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,25 @@ class ScannerErrorCode extends DiagnosticCode {
4141
"Illegal character '{0}'.",
4242
);
4343

44+
/// No parameters.
4445
static const ScannerErrorCode MISSING_DIGIT = const ScannerErrorCode(
4546
'MISSING_DIGIT',
4647
"Decimal digit expected.",
4748
);
4849

50+
/// No parameters.
4951
static const ScannerErrorCode MISSING_HEX_DIGIT = const ScannerErrorCode(
5052
'MISSING_HEX_DIGIT',
5153
"Hexadecimal digit expected.",
5254
);
5355

56+
/// No parameters.
5457
static const ScannerErrorCode MISSING_IDENTIFIER = const ScannerErrorCode(
5558
'MISSING_IDENTIFIER',
5659
"Expected an identifier.",
5760
);
5861

62+
/// No parameters.
5963
static const ScannerErrorCode MISSING_QUOTE = const ScannerErrorCode(
6064
'MISSING_QUOTE',
6165
"Expected quote (' or \").",
@@ -68,6 +72,7 @@ class ScannerErrorCode extends DiagnosticCode {
6872
"Unable to get content of '{0}'.",
6973
);
7074

75+
/// No parameters.
7176
static const ScannerErrorCode
7277
UNEXPECTED_DOLLAR_IN_STRING = const ScannerErrorCode(
7378
'UNEXPECTED_DOLLAR_IN_STRING',
@@ -76,6 +81,7 @@ class ScannerErrorCode extends DiagnosticCode {
7681
correctionMessage: "Try adding a backslash (\\) to escape the '\$'.",
7782
);
7883

84+
/// No parameters.
7985
static const ScannerErrorCode
8086
UNEXPECTED_SEPARATOR_IN_NUMBER = const ScannerErrorCode(
8187
'UNEXPECTED_SEPARATOR_IN_NUMBER',
@@ -91,6 +97,7 @@ class ScannerErrorCode extends DiagnosticCode {
9197
"The '{0}' operator is not supported.",
9298
);
9399

100+
/// No parameters.
94101
static const ScannerErrorCode UNTERMINATED_MULTI_LINE_COMMENT =
95102
const ScannerErrorCode(
96103
'UNTERMINATED_MULTI_LINE_COMMENT',
@@ -100,6 +107,7 @@ class ScannerErrorCode extends DiagnosticCode {
100107
"occurrences of '/*' (because comments nest in Dart).",
101108
);
102109

110+
/// No parameters.
103111
static const ScannerErrorCode UNTERMINATED_STRING_LITERAL =
104112
const ScannerErrorCode(
105113
'UNTERMINATED_STRING_LITERAL',

pkg/analyzer/lib/src/analysis_options/error/option_codes.g.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ class AnalysisOptionsWarningCode extends DiagnosticCode {
7676
///
7777
/// Parameters:
7878
/// 0: the option name
79-
///
8079
static const AnalysisOptionsWarningCode ANALYSIS_OPTION_DEPRECATED =
8180
AnalysisOptionsWarningCode(
8281
'ANALYSIS_OPTION_DEPRECATED',

pkg/analyzer/lib/src/dart/error/ffi_code.g.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class FfiCode extends DiagnosticCode {
105105
hasPublishedDocs: true,
106106
);
107107

108-
/// No parameters
108+
/// No parameters.
109109
static const FfiCode ARGUMENT_MUST_BE_NATIVE = FfiCode(
110110
'ARGUMENT_MUST_BE_NATIVE',
111111
"Argument to 'Native.addressOf' must be annotated with @Native",
@@ -161,15 +161,15 @@ class FfiCode extends DiagnosticCode {
161161
hasPublishedDocs: true,
162162
);
163163

164-
/// No parameters
164+
/// No parameters.
165165
static const FfiCode FFI_NATIVE_INVALID_DUPLICATE_DEFAULT_ASSET = FfiCode(
166166
'FFI_NATIVE_INVALID_DUPLICATE_DEFAULT_ASSET',
167167
"There may be at most one @DefaultAsset annotation on a library.",
168168
correctionMessage: "Try removing the extra annotation.",
169169
hasPublishedDocs: true,
170170
);
171171

172-
/// No parameters
172+
/// No parameters.
173173
static const FfiCode FFI_NATIVE_INVALID_MULTIPLE_ANNOTATIONS = FfiCode(
174174
'FFI_NATIVE_INVALID_MULTIPLE_ANNOTATIONS',
175175
"Native functions and fields must have exactly one `@Native` annotation.",
@@ -373,7 +373,7 @@ class FfiCode extends DiagnosticCode {
373373
hasPublishedDocs: true,
374374
);
375375

376-
/// No parameters
376+
/// No parameters.
377377
static const FfiCode NATIVE_FIELD_MISSING_TYPE = FfiCode(
378378
'NATIVE_FIELD_MISSING_TYPE',
379379
"The native type of this field could not be inferred and must be specified "
@@ -384,15 +384,15 @@ class FfiCode extends DiagnosticCode {
384384
hasPublishedDocs: true,
385385
);
386386

387-
/// No parameters
387+
/// No parameters.
388388
static const FfiCode NATIVE_FIELD_NOT_STATIC = FfiCode(
389389
'NATIVE_FIELD_NOT_STATIC',
390390
"Native fields must be static.",
391391
correctionMessage: "Try adding the modifier 'static' to this field.",
392392
hasPublishedDocs: true,
393393
);
394394

395-
/// No parameters
395+
/// No parameters.
396396
static const FfiCode NATIVE_FUNCTION_MISSING_TYPE = FfiCode(
397397
'NATIVE_FUNCTION_MISSING_TYPE',
398398
"The native type of this function couldn't be inferred so it must be "

pkg/analyzer/lib/src/dart/error/hint_codes.g.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ library;
2727
import "package:_fe_analyzer_shared/src/base/errors.dart";
2828

2929
class HintCode extends DiagnosticCode {
30-
/// No parameters.
31-
///
3230
/// Note: Since this diagnostic is only produced in pre-3.0 code, we do not
3331
/// plan to go through the exercise of converting it to a Warning.
32+
///
33+
/// No parameters.
3434
static const HintCode DEPRECATED_COLON_FOR_DEFAULT_VALUE = HintCode(
3535
'DEPRECATED_COLON_FOR_DEFAULT_VALUE',
3636
"Using a colon as the separator before a default value is deprecated and "
@@ -49,11 +49,11 @@ class HintCode extends DiagnosticCode {
4949
hasPublishedDocs: true,
5050
);
5151

52-
/// Parameters:
53-
/// 0: the name of the member
54-
///
5552
/// This code is deprecated in favor of the
5653
/// 'deprecated_member_from_same_package' lint rule, and will be removed.
54+
///
55+
/// Parameters:
56+
/// 0: the name of the member
5757
static const HintCode DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE = HintCode(
5858
'DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE',
5959
"'{0}' is deprecated and shouldn't be used.",
@@ -62,12 +62,12 @@ class HintCode extends DiagnosticCode {
6262
hasPublishedDocs: true,
6363
);
6464

65+
/// This code is deprecated in favor of the
66+
/// 'deprecated_member_from_same_package' lint rule, and will be removed.
67+
///
6568
/// Parameters:
6669
/// 0: the name of the member
6770
/// 1: message details
68-
///
69-
/// This code is deprecated in favor of the
70-
/// 'deprecated_member_from_same_package' lint rule, and will be removed.
7171
static const HintCode
7272
DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE_WITH_MESSAGE = HintCode(
7373
'DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE',

0 commit comments

Comments
 (0)