Skip to content

Commit f962700

Browse files
pqCommit Queue
authored and
Commit Queue
committed
+ flutter_style_todos
Enabled `flutter_style_todos` in analyzer packages: * `analyzer_cli` * `analyzer_plugin` * `analyzer_utilities` * `meta` Change-Id: I5fcd76bfa5a3bdeb14d6a81b8193129c6d83d0e8 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335405 Commit-Queue: Phil Quitslund <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent 57a2fb6 commit f962700

28 files changed

+107
-90
lines changed

pkg/analysis_server_client/lib/src/protocol/protocol_common.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import 'dart:convert' hide JsonDecoder;
1111
import 'package:analysis_server_client/src/protocol/protocol_base.dart';
1212
import 'package:analysis_server_client/src/protocol/protocol_internal.dart';
1313

14+
// ignore_for_file: flutter_style_todos
15+
1416
/// AddContentOverlay
1517
///
1618
/// {

pkg/analyzer_cli/analysis_options.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ linter:
2525
directives_ordering: true
2626
empty_catches: true
2727
enable_null_safety: true
28+
flutter_style_todos: true
2829

2930
# We import heavily from package:analyzer/src.
3031
implementation_imports: false

pkg/analyzer_cli/lib/src/driver.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ class Driver implements CommandLineStarter {
173173
// time during the following analysis.
174174
SeverityProcessor defaultSeverityProcessor;
175175
defaultSeverityProcessor = (AnalysisError error) {
176-
// TODO(pq) get file path from `error.source.fullName`
176+
// TODO(pq): get file path from `error.source.fullName`
177177
return determineProcessedSeverity(
178178
error, options, analysisDriver!.analysisOptions);
179179
};
@@ -507,7 +507,7 @@ class _AnalysisContextProvider {
507507
return _analysisContext!.driver;
508508
}
509509

510-
/// TODO(scheglov) Use analyzedFiles()
510+
// TODO(scheglov): Use analyzedFiles()
511511
PathFilter get pathFilter {
512512
var contextRoot = analysisContext!.contextRoot;
513513
var optionsFile = contextRoot.optionsFile;

pkg/analyzer_cli/lib/src/error_formatter.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ class HumanErrorFormatter extends ErrorFormatter {
306306
}
307307
var contextMessages = <ContextMessage>[];
308308
for (var message in error.contextMessages) {
309-
// TODO(scheglov) We should add `LineInfo` to `DiagnosticMessage`.
309+
// TODO(scheglov): We should add `LineInfo` to `DiagnosticMessage`.
310310
var session = result.session.analysisContext;
311311
if (session is DriverBasedAnalysisContext) {
312312
var fileResult = session.driver.getFileSync(message.filePath);

pkg/analyzer_cli/lib/src/options.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,14 @@ class CommandLineOptions {
142142
for (var variable in variables) {
143143
var index = variable.indexOf('=');
144144
if (index < 0) {
145-
// TODO (brianwilkerson) Decide the semantics we want in this case.
145+
// TODO(brianwilkerson): Decide the semantics we want in this case.
146146
// The VM prints "No value given to -D option", then tries to load '-Dfoo'
147147
// as a file and dies. Unless there was nothing after the '-D', in which
148148
// case it prints the warning and ignores the option.
149149
} else {
150150
var name = variable.substring(0, index);
151151
if (name.isNotEmpty) {
152-
// TODO (brianwilkerson) Decide the semantics we want in the case where
152+
// TODO(brianwilkerson): Decide the semantics we want in the case where
153153
// there is no name. If there is no name, the VM tries to load a file
154154
// named '-D' and dies.
155155
declaredVariables[name] = variable.substring(index + 1);
@@ -299,8 +299,8 @@ class CommandLineOptions {
299299
/// are those that are typically used to control the way in which the code is
300300
/// analyzed.
301301
///
302-
/// TODO(danrubel) Update DDC to support all the options defined in this method
303-
/// then remove the [ddc] named argument from this method.
302+
// TODO(danrubel): Update DDC to support all the options defined in this method
303+
// then remove the [ddc] named argument from this method.
304304
static void _defineAnalysisArguments(ArgParser parser,
305305
{bool hide = true, bool ddc = false}) {
306306
parser.addOption(_sdkPathOption,

pkg/analyzer_plugin/analysis_options.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ linter:
1313
#dangling_library_doc_comments: true
1414
depend_on_referenced_packages: true
1515
enable_null_safety: true
16+
flutter_style_todos: true
1617
implicit_call_tearoffs: true
1718
library_annotations: true
1819
omit_local_variable_types: true

pkg/analyzer_plugin/lib/plugin/plugin.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,13 @@ abstract class ServerPlugin {
231231
for (var event in parameters.events) {
232232
switch (event.type) {
233233
case WatchEventType.ADD:
234-
// TODO(brianwilkerson) Handle the event.
234+
// TODO(brianwilkerson): Handle the event.
235235
break;
236236
case WatchEventType.MODIFY:
237237
await contentChanged([event.path]);
238238
break;
239239
case WatchEventType.REMOVE:
240-
// TODO(brianwilkerson) Handle the event.
240+
// TODO(brianwilkerson): Handle the event.
241241
break;
242242
default:
243243
// Ignore unhandled watch event types.

pkg/analyzer_plugin/lib/protocol/protocol_common.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import 'dart:convert' hide JsonDecoder;
1111
import 'package:analyzer_plugin/protocol/protocol.dart';
1212
import 'package:analyzer_plugin/src/protocol/protocol_internal.dart';
1313

14+
// ignore_for_file: flutter_style_todos
15+
1416
/// AddContentOverlay
1517
///
1618
/// {

pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class DartEditBuilderImpl extends EditBuilderImpl implements DartEditBuilder {
9595
String? nameGroupName,
9696
DartType? superclass,
9797
String? superclassGroupName}) {
98-
// TODO(brianwilkerson) Add support for type parameters, probably as a
98+
// TODO(brianwilkerson): Add support for type parameters, probably as a
9999
// parameterWriter parameter.
100100
if (isAbstract) {
101101
write(Keyword.ABSTRACT.lexeme);
@@ -111,7 +111,7 @@ class DartEditBuilderImpl extends EditBuilderImpl implements DartEditBuilder {
111111
write(' extends ');
112112
writeType(superclass, groupName: superclassGroupName);
113113
} else if (mixins != null && mixins.isNotEmpty) {
114-
// TODO(brianwilkerson) Remove this branch when 2.1 semantics are
114+
// TODO(brianwilkerson): Remove this branch when 2.1 semantics are
115115
// supported everywhere.
116116
write(' extends Object ');
117117
}
@@ -361,7 +361,7 @@ class DartEditBuilderImpl extends EditBuilderImpl implements DartEditBuilder {
361361
void Function()? membersWriter,
362362
String? nameGroupName,
363363
Iterable<DartType>? superclassConstraints}) {
364-
// TODO(brianwilkerson) Add support for type parameters, probably as a
364+
// TODO(brianwilkerson): Add support for type parameters, probably as a
365365
// parameterWriter parameter.
366366
write('mixin ');
367367
if (nameGroupName == null) {
@@ -681,7 +681,7 @@ class DartEditBuilderImpl extends EditBuilderImpl implements DartEditBuilder {
681681

682682
@override
683683
void writeParametersMatchingArguments(ArgumentList argumentList) {
684-
// TODO(brianwilkerson) Handle the case when there are required parameters
684+
// TODO(brianwilkerson): Handle the case when there are required parameters
685685
// after named parameters.
686686
var usedNames = <String>{};
687687
List<Expression> arguments = argumentList.arguments;
@@ -734,7 +734,7 @@ class DartEditBuilderImpl extends EditBuilderImpl implements DartEditBuilder {
734734
write(' ');
735735
}
736736
}
737-
// TODO(brianwilkerson) The name of the setter is unlikely to be a good name
737+
// TODO(brianwilkerson): The name of the setter is unlikely to be a good name
738738
// for the parameter. We need to find a better name to produce here.
739739
write(name);
740740
write(') ');
@@ -917,7 +917,7 @@ class DartEditBuilderImpl extends EditBuilderImpl implements DartEditBuilder {
917917
}
918918

919919
if (type is RecordType) {
920-
// TODO(brianwilkerson) This should return `false` if the `records`
920+
// TODO(brianwilkerson): This should return `false` if the `records`
921921
// feature is not enabled.
922922
return true;
923923
}
@@ -1069,7 +1069,7 @@ class DartEditBuilderImpl extends EditBuilderImpl implements DartEditBuilder {
10691069
if (suggestions.isNotEmpty) {
10701070
return suggestions;
10711071
}
1072-
// TODO(brianwilkerson) Verify that the name below is not in the set of used names.
1072+
// TODO(brianwilkerson): Verify that the name below is not in the set of used names.
10731073
return <String>['param$index'];
10741074
}
10751075

@@ -1163,7 +1163,7 @@ class DartEditBuilderImpl extends EditBuilderImpl implements DartEditBuilder {
11631163
return;
11641164
}
11651165

1166-
// TODO(scheglov) We should use "methodBeingCopied" to verify that
1166+
// TODO(scheglov): We should use "methodBeingCopied" to verify that
11671167
// we really are just copying this type parameter.
11681168
if (element is TypeParameterElement) {
11691169
return;
@@ -1295,7 +1295,7 @@ class DartEditBuilderImpl extends EditBuilderImpl implements DartEditBuilder {
12951295
}
12961296

12971297
if (type is RecordType) {
1298-
// TODO(brianwilkerson) This should return `false` if the `records`
1298+
// TODO(brianwilkerson): This should return `false` if the `records`
12991299
// feature is not enabled. More importantly, we can't currently return
13001300
// `false` if some portion of a type has already been written, so we
13011301
// need to figure out what to do when a record type is nested in another

pkg/analyzer_plugin/lib/src/utilities/completion/completion_target.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ class CompletionTarget {
174174
// Try to replace with a comment token.
175175
var commentToken = _getContainingCommentToken(entity, offset);
176176
if (commentToken != null) {
177-
// TODO(scheglov) This is duplicate of the code below.
177+
// TODO(scheglov): This is duplicate of the code below.
178178
// If the preceding comment is dartdoc token, then update
179179
// the containing node to be the dartdoc comment.
180180
// Otherwise completion is not required.

pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class OpType {
9191

9292
/// Indicates whether the completion location requires a constant expression
9393
/// without being a constant context.
94-
// TODO(brianwilkerson) Consider using this value to control whether non-const
94+
// TODO(brianwilkerson): Consider using this value to control whether non-const
9595
// elements are suggested.
9696
bool mustBeConst = false;
9797

@@ -313,7 +313,7 @@ class _OpTypeAstVisitor extends GeneralizingAstVisitor<void> {
313313
optype.includeTypeNameSuggestions = true;
314314
} else if (identical(entity, node.message)) {
315315
optype.completionLocation = 'AssertInitializer_message';
316-
// TODO(brianwilkerson) Consider including return value suggestions and
316+
// TODO(brianwilkerson): Consider including return value suggestions and
317317
// type name suggestions here.
318318
}
319319
}
@@ -326,7 +326,7 @@ class _OpTypeAstVisitor extends GeneralizingAstVisitor<void> {
326326
optype.includeTypeNameSuggestions = true;
327327
} else if (identical(entity, node.message)) {
328328
optype.completionLocation = 'AssertStatement_message';
329-
// TODO(brianwilkerson) Consider including return value suggestions and
329+
// TODO(brianwilkerson): Consider including return value suggestions and
330330
// type name suggestions here.
331331
}
332332
}
@@ -623,7 +623,7 @@ class _OpTypeAstVisitor extends GeneralizingAstVisitor<void> {
623623
type = parent.staticType;
624624
if (type is FunctionType) {
625625
if (type.returnType is VoidType) {
626-
// TODO(brianwilkerson) Determine whether the return type can ever
626+
// TODO(brianwilkerson): Determine whether the return type can ever
627627
// be inferred as void and remove this case if it can't be.
628628
optype.includeVoidReturnSuggestions = true;
629629
} else {
@@ -1075,7 +1075,7 @@ class _OpTypeAstVisitor extends GeneralizingAstVisitor<void> {
10751075
identical(entity, node.name) && node.returnType == null) {
10761076
optype.completionLocation = 'MethodDeclaration_returnType';
10771077
}
1078-
// TODO(brianwilkerson) In visitFunctionDeclaration, this is conditional. It
1078+
// TODO(brianwilkerson): In visitFunctionDeclaration, this is conditional. It
10791079
// seems like it should be the same in both places.
10801080
optype.includeTypeNameSuggestions = true;
10811081
}
@@ -1769,7 +1769,7 @@ class _OpTypeAstVisitor extends GeneralizingAstVisitor<void> {
17691769
} else if (parent is FunctionExpressionInvocation) {
17701770
return 'function';
17711771
} else if (parent is InstanceCreationExpression) {
1772-
// TODO(brianwilkerson) Enable this case.
1772+
// TODO(brianwilkerson): Enable this case.
17731773
// if (flutter.isWidgetType(parent.staticType)) {
17741774
// return 'widgetConstructor';
17751775
// }

pkg/analyzer_plugin/lib/utilities/analyzer_converter.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ class AnalyzerConverter {
169169
} else if (element is analyzer.FieldElement && element.isEnumConstant
170170
// MyEnum.values and MyEnum.one.index return isEnumConstant = true
171171
// so these additional checks are necessary.
172-
// TODO(danrubel) MyEnum.values is constant, but is a list
172+
// TODO(danrubel): MyEnum.values is constant, but is a list
173173
// so should it return isEnumConstant = true?
174174
// MyEnum.one.index is final but *not* constant
175175
// so should it return isEnumConstant = true?
@@ -195,7 +195,7 @@ class AnalyzerConverter {
195195
/// Return a textual representation of the parameters of the given [element],
196196
/// or `null` if the element does not have any parameters.
197197
String? _getParametersString(analyzer.Element element) {
198-
// TODO(scheglov) expose the corresponding feature from ExecutableElement
198+
// TODO(scheglov): expose the corresponding feature from ExecutableElement
199199
List<analyzer.ParameterElement> parameters;
200200
if (element is analyzer.ExecutableElement) {
201201
// valid getters don't have parameters
@@ -272,7 +272,7 @@ class AnalyzerConverter {
272272
}
273273

274274
bool _isAbstract(analyzer.Element element) {
275-
// TODO(scheglov) add isAbstract to Element API
275+
// TODO(scheglov): add isAbstract to Element API
276276
if (element is analyzer.ClassElement) {
277277
return element.isAbstract;
278278
} else if (element is analyzer.MethodElement) {
@@ -284,7 +284,7 @@ class AnalyzerConverter {
284284
}
285285

286286
bool _isConst(analyzer.Element element) {
287-
// TODO(scheglov) add isConst to Element API
287+
// TODO(scheglov): add isConst to Element API
288288
if (element is analyzer.ConstructorElement) {
289289
return element.isConst;
290290
} else if (element is analyzer.VariableElement) {
@@ -294,15 +294,15 @@ class AnalyzerConverter {
294294
}
295295

296296
bool _isFinal(analyzer.Element element) {
297-
// TODO(scheglov) add isFinal to Element API
297+
// TODO(scheglov): add isFinal to Element API
298298
if (element is analyzer.VariableElement) {
299299
return element.isFinal;
300300
}
301301
return false;
302302
}
303303

304304
bool _isStatic(analyzer.Element element) {
305-
// TODO(scheglov) add isStatic to Element API
305+
// TODO(scheglov): add isStatic to Element API
306306
if (element is analyzer.ExecutableElement) {
307307
return element.isStatic;
308308
} else if (element is analyzer.PropertyInducingElement) {

pkg/analyzer_plugin/lib/utilities/navigation/navigation_dart.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ class _DartNavigationComputerVisitor extends RecursiveAstVisitor<void> {
275275
if (resolvedUri is DirectiveUriWithSource) {
276276
final source = resolvedUri.source;
277277
if (resourceProvider.getResource(source.fullName).exists) {
278-
// TODO(brianwilkerson) If the analyzer ever resolves the URI to a
278+
// TODO(brianwilkerson): If the analyzer ever resolves the URI to a
279279
// library, use that library element to create the region.
280280
var uriNode = node.uri;
281281
if (computer._isWithinRequestedRange(uriNode.offset, uriNode.length)) {

pkg/analyzer_plugin/test/integration/support/integration_tests.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ abstract class AbstractAnalysisServerIntegrationTest
141141
currentAnalysisErrors[params.file] = params.errors;
142142
});
143143
var serverConnected = Completer();
144-
// TODO(brianwilkerson) Implement this.
144+
// TODO(brianwilkerson): Implement this.
145145
// onServerConnected.listen((_) {
146146
// outOfTestExpect(serverConnected.isCompleted, isFalse);
147147
// serverConnected.complete();
@@ -185,7 +185,7 @@ abstract class AbstractAnalysisServerIntegrationTest
185185
/// can be used.
186186
Future standardAnalysisSetup({bool subscribeStatus = true}) {
187187
var futures = <Future>[];
188-
// TODO(brianwilkerson) Implement this.
188+
// TODO(brianwilkerson): Implement this.
189189
// if (subscribeStatus) {
190190
// futures.add(sendServerSetSubscriptions([ServerService.STATUS]));
191191
// }

pkg/analyzer_plugin/test/integration/support/protocol_matchers.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import 'package:test/test.dart';
1313

1414
import 'integration_tests.dart';
1515

16+
// ignore_for_file: flutter_style_todos
17+
1618
/// AddContentOverlay
1719
///
1820
/// {

pkg/analyzer_plugin/test/src/channel/isolate_channel_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class PluginIsolateChannelTest {
4242
done = true;
4343
});
4444
channel.close();
45-
// TODO(brianwilkerson) Figure out how to wait until the handler has been
45+
// TODO(brianwilkerson): Figure out how to wait until the handler has been
4646
// called.
4747
await _pumpEventQueue();
4848
expect(done, isTrue);

pkg/analyzer_plugin/test/src/utilities/change_builder/change_builder_core_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ class FileEditBuilderImplTest extends AbstractChangeBuilderTest {
315315
}
316316

317317
Future<void> test_addDeletion_adjacent_lowerOffsetFirst() async {
318-
// TODO(brianwilkerson) This should also merge the deletions, but is written
318+
// TODO(brianwilkerson): This should also merge the deletions, but is written
319319
// to ensure that existing uses of FileEditBuilder continue to work even
320320
// without that change.
321321
var firstOffset = 23;
@@ -337,7 +337,7 @@ class FileEditBuilderImplTest extends AbstractChangeBuilderTest {
337337
}
338338

339339
Future<void> test_addDeletion_adjacent_lowerOffsetSecond() async {
340-
// TODO(brianwilkerson) This should also merge the deletions, but is written
340+
// TODO(brianwilkerson): This should also merge the deletions, but is written
341341
// to ensure that existing uses of FileEditBuilder continue to work even
342342
// without that change.
343343
var firstOffset = 23;

0 commit comments

Comments
 (0)