Skip to content

Commit 1f4f0d3

Browse files
parloughCommit Queue
authored andcommitted
[linter] Generate lint codes from messages file
Change-Id: Id4f7ee5843a4063d1e527c1566847d88b355c614 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373725 Reviewed-by: Phil Quitslund <[email protected]> Commit-Queue: Phil Quitslund <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent 6b81ea9 commit 1f4f0d3

File tree

266 files changed

+4051
-2362
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

266 files changed

+4051
-2362
lines changed

pkg/analysis_server/lib/src/services/correction/dart/add_diagnostic_property_reference.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import 'package:analyzer_plugin/utilities/assist/assist.dart';
1616
import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
1717
import 'package:analyzer_plugin/utilities/change_builder/change_builder_dart.dart';
1818
import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
19-
import 'package:linter/src/rules/diagnostic_describe_all_properties.dart';
19+
import 'package:linter/src/linter_lint_codes.dart';
2020

2121
class AddDiagnosticPropertyReference extends ResolvedCorrectionProducer {
2222
AddDiagnosticPropertyReference({required super.context});
@@ -347,7 +347,7 @@ class AddDiagnosticPropertyReference extends ResolvedCorrectionProducer {
347347
for (var error in unitResult.errors) {
348348
var errorCode = error.errorCode;
349349
if (errorCode.type == ErrorType.LINT &&
350-
errorCode == DiagnosticDescribeAllProperties.code &&
350+
errorCode == LinterLintCode.diagnostic_describe_all_properties &&
351351
error.offset > startOffset &&
352352
error.offset < endOffset) {
353353
propertyErrors.add(error);

pkg/analysis_server/lib/src/services/correction/dart/remove_comparison.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import 'package:analyzer/src/error/codes.g.dart';
1212
import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
1313
import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
1414
import 'package:analyzer_plugin/utilities/range_factory.dart';
15-
import 'package:linter/src/rules/avoid_null_checks_in_equality_operators.dart';
15+
import 'package:linter/src/linter_lint_codes.dart';
1616

1717
class RemoveComparison extends ResolvedCorrectionProducer {
1818
@override
@@ -49,7 +49,7 @@ class RemoveComparison extends ResolvedCorrectionProducer {
4949
return errorCode == WarningCode.UNNECESSARY_NAN_COMPARISON_TRUE ||
5050
errorCode == WarningCode.UNNECESSARY_NULL_COMPARISON_TRUE ||
5151
errorCode == WarningCode.UNNECESSARY_TYPE_CHECK_TRUE ||
52-
errorCode == AvoidNullChecksInEqualityOperators.code;
52+
errorCode == LinterLintCode.avoid_null_checks_in_equality_operators;
5353
}
5454

5555
@override

pkg/analysis_server/lib/src/services/correction/dart/replace_with_decorated_box.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import 'package:analyzer/src/lint/linter.dart';
1111
import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
1212
import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
1313
import 'package:analyzer_plugin/utilities/range_factory.dart';
14-
import 'package:linter/src/rules/use_decorated_box.dart';
14+
import 'package:linter/src/linter_lint_codes.dart';
1515

1616
class ReplaceWithDecoratedBox extends ResolvedCorrectionProducer {
1717
ReplaceWithDecoratedBox({required super.context});
@@ -116,7 +116,7 @@ class ReplaceWithDecoratedBox extends ResolvedCorrectionProducer {
116116
return unitResult.errors.any((error) {
117117
var errorCode = error.errorCode;
118118
return errorCode.type == ErrorType.LINT &&
119-
errorCode == UseDecoratedBox.code &&
119+
errorCode == LinterLintCode.use_decorated_box &&
120120
error.offset == constructorName.offset &&
121121
error.length == constructorName.length;
122122
});

pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml

Lines changed: 76 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1846,17 +1846,21 @@ HintCode.UNNECESSARY_IMPORT:
18461846
status: hasFix
18471847
HintCode.UNREACHABLE_SWITCH_CASE:
18481848
status: hasFix
1849-
LintCode.always_declare_return_types:
1849+
LintCode.always_declare_return_types_of_functions:
1850+
status: hasFix
1851+
LintCode.always_declare_return_types_of_methods:
18501852
status: hasFix
18511853
LintCode.always_put_control_body_on_new_line:
18521854
status: hasFix
18531855
LintCode.always_put_required_named_parameters_first:
18541856
status: hasFix
1855-
LintCode.always_require_non_null_named_parameters:
1856-
status: noFix
1857-
notes: |-
1858-
Removed.
1859-
LintCode.always_specify_types:
1857+
LintCode.always_specify_types_add_type:
1858+
status: hasFix
1859+
LintCode.always_specify_types_replace_keyword:
1860+
status: hasFix
1861+
LintCode.always_specify_types_specify_type:
1862+
status: hasFix
1863+
LintCode.always_specify_types_split_to_types:
18601864
status: hasFix
18611865
LintCode.always_use_package_imports:
18621866
status: hasFix
@@ -1866,10 +1870,6 @@ LintCode.annotate_redeclares:
18661870
status: hasFix
18671871
LintCode.avoid_annotating_with_dynamic:
18681872
status: hasFix
1869-
LintCode.avoid_as:
1870-
status: noFix
1871-
notes: |-
1872-
Removed.
18731873
LintCode.avoid_bool_literals_in_conditional_expressions:
18741874
status: needsFix
18751875
notes: |-
@@ -1943,15 +1943,9 @@ LintCode.avoid_renaming_method_parameters:
19431943
status: hasFix
19441944
LintCode.avoid_return_types_on_setters:
19451945
status: hasFix
1946-
LintCode.avoid_returning_null:
1947-
status: noFix
1948-
notes: |-
1949-
Deprecated.
1950-
LintCode.avoid_returning_null_for_future:
1951-
status: noFix
1952-
notes: |-
1953-
Removed.
1954-
LintCode.avoid_returning_null_for_void:
1946+
LintCode.avoid_returning_null_for_void_from_function:
1947+
status: hasFix
1948+
LintCode.avoid_returning_null_for_void_from_method:
19551949
status: hasFix
19561950
LintCode.avoid_returning_this:
19571951
status: noFix
@@ -1985,9 +1979,6 @@ LintCode.avoid_types_on_closure_parameters:
19851979
status: hasFix
19861980
LintCode.avoid_unnecessary_containers:
19871981
status: hasFix
1988-
LintCode.avoid_unstable_final_fields:
1989-
status: noFix
1990-
notes: This lint is deprecated.
19911982
LintCode.avoid_unused_constructor_parameters:
19921983
status: hasFix
19931984
LintCode.avoid_void_async:
@@ -2039,17 +2030,31 @@ LintCode.dangling_library_doc_comments:
20392030
status: hasFix
20402031
LintCode.depend_on_referenced_packages:
20412032
status: needsFix
2042-
LintCode.deprecated_consistency:
2033+
LintCode.deprecated_consistency_constructor:
20432034
status: needsFix
20442035
notes: |-
20452036
The fix is to either remove deprecated or to add it in the missing places.
2046-
LintCode.deprecated_member_use_from_same_package:
2037+
LintCode.deprecated_consistency_field:
2038+
status: needsFix
2039+
notes: |-
2040+
The fix is to either remove deprecated or to add it in the missing places.
2041+
LintCode.deprecated_consistency_parameter:
2042+
status: needsFix
2043+
notes: |-
2044+
The fix is to either remove deprecated or to add it in the missing places.
2045+
LintCode.deprecated_member_use_from_same_package_without_message:
20472046
status: hasFix
20482047
LintCode.deprecated_member_use_from_same_package_with_message:
20492048
status: hasFix
20502049
LintCode.diagnostic_describe_all_properties:
20512050
status: hasFix
2052-
LintCode.directives_ordering:
2051+
LintCode.directives_ordering_alphabetical:
2052+
status: hasFix
2053+
LintCode.directives_ordering_dart:
2054+
status: hasFix
2055+
LintCode.directives_ordering_exports:
2056+
status: hasFix
2057+
LintCode.directives_ordering_package_before_relative:
20532058
status: hasFix
20542059
LintCode.discarded_futures:
20552060
status: hasFix
@@ -2066,10 +2071,6 @@ LintCode.empty_constructor_bodies:
20662071
status: hasFix
20672072
LintCode.empty_statements:
20682073
status: hasFix
2069-
LintCode.enable_null_safety:
2070-
status: noFix
2071-
notes: |-
2072-
Removed.
20732074
LintCode.eol_at_end_of_file:
20742075
status: hasFix
20752076
LintCode.erase_dart_type_extension_types:
@@ -2096,20 +2097,24 @@ LintCode.implicit_reopen:
20962097
status: hasFix
20972098
LintCode.invalid_case_patterns:
20982099
status: hasFix
2099-
LintCode.invalid_runtime_check_with_js_interop_types:
2100-
status: needsFix
2100+
LintCode.invalid_runtime_check_with_js_interop_types_dart_as_js:
2101+
status: needsEvaluation
21012102
notes: |-
21022103
The fix is dependent on the specific types that are being used. In some
21032104
cases, the type test is incorrect and has no fix besides removing the test.
21042105
In other cases, JS interop helpers may be used to do the type test instead.
2105-
LintCode.invariant_booleans:
2106-
status: noFix
2107-
notes: |-
2108-
Removed.
2109-
LintCode.iterable_contains_unrelated_type:
2110-
status: noFix
2111-
notes: |-
2112-
Removed.
2106+
LintCode.invalid_runtime_check_with_js_interop_types_dart_is_js:
2107+
status: needsEvaluation
2108+
LintCode.invalid_runtime_check_with_js_interop_types_js_as_dart:
2109+
status: needsEvaluation
2110+
LintCode.invalid_runtime_check_with_js_interop_types_js_as_incompatible_js:
2111+
status: needsEvaluation
2112+
LintCode.invalid_runtime_check_with_js_interop_types_js_is_dart:
2113+
status: needsEvaluation
2114+
LintCode.invalid_runtime_check_with_js_interop_types_js_is_inconsistent_js:
2115+
status: needsEvaluation
2116+
LintCode.invalid_runtime_check_with_js_interop_types_js_is_unrelated_js:
2117+
status: needsEvaluation
21132118
LintCode.join_return_with_assignment:
21142119
status: needsFix
21152120
LintCode.leading_newlines_in_multiline_strings:
@@ -2132,10 +2137,6 @@ LintCode.library_private_types_in_public_api:
21322137
to make the private type public, which (sort of) requires a refactoring.
21332138
LintCode.lines_longer_than_80_chars:
21342139
status: noFix
2135-
LintCode.list_remove_unrelated_type:
2136-
status: noFix
2137-
notes: |-
2138-
Removed.
21392140
LintCode.literal_only_boolean_expressions:
21402141
status: noFix
21412142
LintCode.matching_super_parameters:
@@ -2231,10 +2232,6 @@ LintCode.prefer_asserts_in_initializer_lists:
22312232
The fix is to move the assert to the initializer list.
22322233
LintCode.prefer_asserts_with_message:
22332234
status: noFix
2234-
LintCode.prefer_bool_in_asserts:
2235-
status: noFix
2236-
notes: |-
2237-
Removed.
22382235
LintCode.prefer_collection_literals:
22392236
status: hasFix
22402237
LintCode.prefer_conditional_assignment:
@@ -2251,19 +2248,21 @@ LintCode.prefer_constructors_over_static_methods:
22512248
status: needsFix
22522249
notes: |-
22532250
The fix is to rewrite the static method as a factory constructor.
2254-
LintCode.prefer_contains:
2251+
LintCode.prefer_contains_always_false:
2252+
status: hasFix
2253+
LintCode.prefer_contains_always_true:
2254+
status: hasFix
2255+
LintCode.prefer_contains_use_contains:
22552256
status: hasFix
22562257
LintCode.prefer_double_quotes:
22572258
status: hasFix
2258-
LintCode.prefer_equal_for_default_values:
2259-
status: noFix
2260-
notes: |-
2261-
Removed.
22622259
LintCode.prefer_expression_function_bodies:
22632260
status: hasFix
22642261
LintCode.prefer_final_fields:
22652262
status: hasFix
2266-
LintCode.prefer_final_in_for_each:
2263+
LintCode.prefer_final_in_for_each_pattern:
2264+
status: hasFix
2265+
LintCode.prefer_final_in_for_each_variable:
22672266
status: hasFix
22682267
LintCode.prefer_final_locals:
22692268
status: hasFix
@@ -2285,13 +2284,21 @@ LintCode.prefer_if_null_operators:
22852284
status: hasFix
22862285
LintCode.prefer_initializing_formals:
22872286
status: hasFix
2288-
LintCode.prefer_inlined_adds:
2287+
LintCode.prefer_inlined_adds_multiple:
2288+
status: hasFix
2289+
LintCode.prefer_inlined_adds_single:
22892290
status: hasFix
22902291
LintCode.prefer_int_literals:
22912292
status: hasFix
22922293
LintCode.prefer_interpolation_to_compose_strings:
22932294
status: hasFix
2294-
LintCode.prefer_is_empty:
2295+
LintCode.prefer_is_empty_always_false:
2296+
status: hasFix
2297+
LintCode.prefer_is_empty_always_true:
2298+
status: hasFix
2299+
LintCode.prefer_is_empty_use_is_empty:
2300+
status: hasFix
2301+
LintCode.prefer_is_empty_use_is_not_empty:
22952302
status: hasFix
22962303
LintCode.prefer_is_not_empty:
22972304
status: hasFix
@@ -2315,7 +2322,9 @@ LintCode.prefer_single_quotes:
23152322
status: hasFix
23162323
LintCode.prefer_spread_collections:
23172324
status: hasFix
2318-
LintCode.prefer_typing_uninitialized_variables:
2325+
LintCode.prefer_typing_uninitialized_variables_for_field:
2326+
status: hasFix
2327+
LintCode.prefer_typing_uninitialized_variables_for_local_variable:
23192328
status: hasFix
23202329
LintCode.prefer_void_to_null:
23212330
status: hasFix
@@ -2329,6 +2338,8 @@ LintCode.public_member_api_docs:
23292338
status: noFix
23302339
LintCode.recursive_getters:
23312340
status: noFix
2341+
LintCode.removed_lint:
2342+
status: noFix
23322343
LintCode.require_trailing_commas:
23332344
status: hasFix
23342345
LintCode.secure_pubspec_urls:
@@ -2349,10 +2360,6 @@ LintCode.sort_pub_dependencies:
23492360
status: needsFix
23502361
LintCode.sort_unnamed_constructors_first:
23512362
status: hasFix
2352-
LintCode.super_goes_last:
2353-
status: noFix
2354-
notes: |-
2355-
Removed.
23562363
LintCode.test_types_in_equals:
23572364
status: noFix
23582365
LintCode.throw_in_finally:
@@ -2381,7 +2388,9 @@ LintCode.unnecessary_const:
23812388
status: hasFix
23822389
LintCode.unnecessary_constructor_name:
23832390
status: hasFix
2384-
LintCode.unnecessary_final:
2391+
LintCode.unnecessary_final_with_type:
2392+
status: hasFix
2393+
LintCode.unnecessary_final_without_type:
23852394
status: hasFix
23862395
LintCode.unnecessary_getters_setters:
23872396
status: hasFix
@@ -2425,9 +2434,9 @@ LintCode.unnecessary_to_list_in_spreads:
24252434
status: hasFix
24262435
LintCode.unreachable_from_main:
24272436
status: hasFix
2428-
LintCode.unrelated_type_equality_checks_expression:
2437+
LintCode.unrelated_type_equality_checks_in_expression:
24292438
status: needsEvaluation
2430-
LintCode.unrelated_type_equality_checks_pattern:
2439+
LintCode.unrelated_type_equality_checks_in_pattern:
24312440
status: needsEvaluation
24322441
LintCode.unsafe_html_attribute:
24332442
status: noFix
@@ -2477,10 +2486,12 @@ LintCode.use_string_buffers:
24772486
It isn't clear that this occurs often enough to justify the cost.
24782487
LintCode.use_string_in_part_of_directives:
24792488
status: hasFix
2480-
LintCode.use_super_parameters:
2481-
status: hasFix
24822489
LintCode.use_test_throws_matchers:
24832490
status: needsFix
2491+
LintCode.use_super_parameters_multiple:
2492+
status: hasFix
2493+
LintCode.use_super_parameters_single:
2494+
status: hasFix
24842495
LintCode.use_to_and_as_if_applicable:
24852496
status: noFix
24862497
notes: |-

0 commit comments

Comments
 (0)