Skip to content

Commit

Permalink
enable flutter_style_todos
Browse files Browse the repository at this point in the history
Change-Id: Ic82963b754404d54e37f5fb03819aebc3fa67954
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/336502
Reviewed-by: Konstantin Shcheglov <[email protected]>
Reviewed-by: Brian Wilkerson <[email protected]>
Commit-Queue: Phil Quitslund <[email protected]>
  • Loading branch information
pq authored and Commit Queue committed Nov 15, 2023
1 parent 974b97c commit fe6950e
Show file tree
Hide file tree
Showing 214 changed files with 648 additions and 613 deletions.
1 change: 1 addition & 0 deletions pkg/analyzer/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ linter:
- avoid_dynamic_calls
- avoid_unused_constructor_parameters
- enable_null_safety
- flutter_style_todos
- library_annotations
- unawaited_futures
- unnecessary_library_directive
Expand Down
2 changes: 1 addition & 1 deletion pkg/analyzer/lib/dart/analysis/analysis_context.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import 'package:analyzer/src/generated/engine.dart';
/// Clients may not extend, implement or mix-in this class.
abstract class AnalysisContext {
/// The analysis options used to control the way the code is analyzed.
// TODO(pq) @Deprecated("Use 'getAnalysisOptionsForFile(file)' instead")
// TODO(pq): @Deprecated("Use 'getAnalysisOptionsForFile(file)' instead")
AnalysisOptions get analysisOptions;

/// Return the context root from which this context was created.
Expand Down
2 changes: 1 addition & 1 deletion pkg/analyzer/lib/dart/analysis/results.dart
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ abstract class SomeUnitElementResult {}
///
/// Clients may not extend, implement or mix-in this class.
///
/// TODO(scheglov) Stop implementing [FileResult].
// TODO(scheglov): Stop implementing [FileResult].
abstract class UnitElementResult implements SomeUnitElementResult, FileResult {
/// The element of the file.
CompilationUnitElement get element;
Expand Down
34 changes: 17 additions & 17 deletions pkg/analyzer/lib/dart/element/element.dart
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ abstract class ClassElement implements InterfaceElement {
///
/// Clients may not extend, implement or mix-in this class.
abstract class ClassMemberElement implements Element {
// TODO(brianwilkerson) Either remove this class or rename it to something
// TODO(brianwilkerson): Either remove this class or rename it to something
// more correct.

@override
Expand Down Expand Up @@ -415,7 +415,7 @@ abstract class ConstructorElement
/// The offset of the character immediately following the last character of
/// this constructor's name, or `null` if not named.
///
/// TODO(migration): encapsulate [nameEnd] and [periodOffset]?
// TODO(migration): encapsulate [nameEnd] and [periodOffset]?
int? get nameEnd;

/// The offset of the `.` before this constructor name, or `null` if not
Expand Down Expand Up @@ -750,7 +750,7 @@ abstract class Element implements AnalysisTarget {
/// compilation unit in which the type is defined. If [shortName] is `null`
/// then [displayName] will be used as the name of this element. Otherwise
/// the provided name will be used.
// TODO(brianwilkerson) Make the parameter optional.
// TODO(brianwilkerson): Make the parameter optional.
String getExtendedDisplayName(String? shortName);

/// Whether the element, assuming that it is within scope, is accessible to
Expand Down Expand Up @@ -1563,32 +1563,32 @@ abstract class InterfaceElement implements InstanceElement {
///
/// If the class does not declare any constructors, a synthetic default
/// constructor will be returned.
/// TODO(scheglov) Deprecate and remove it.
// TODO(scheglov): Deprecate and remove it.
ConstructorElement? get unnamedConstructor;

/// The field (synthetic or explicit) defined directly in this class or
/// augmentation that has the given [name].
/// TODO(scheglov) Deprecate and remove it.
// TODO(scheglov): Deprecate and remove it.
FieldElement? getField(String name);

/// The getter (synthetic or explicit) defined directly in this class or
/// augmentation that has the given [name].
/// TODO(scheglov) Deprecate and remove it.
// TODO(scheglov): Deprecate and remove it.
PropertyAccessorElement? getGetter(String name);

/// The method defined directly in this class or augmentation that has the
/// given [name].
/// TODO(scheglov) Deprecate and remove it.
// TODO(scheglov): Deprecate and remove it.
MethodElement? getMethod(String name);

/// The constructor defined directly in this class or augmentation
/// that has the given [name].
/// TODO(scheglov) Deprecate and remove it.
// TODO(scheglov): Deprecate and remove it.
ConstructorElement? getNamedConstructor(String name);

/// The setter (synthetic or explicit) defined directly in this class or
/// augmentation that has the given [name].
/// TODO(scheglov) Deprecate and remove it.
// TODO(scheglov): Deprecate and remove it.
PropertyAccessorElement? getSetter(String name);

/// Create the [InterfaceType] for this element with the given
Expand All @@ -1613,7 +1613,7 @@ abstract class InterfaceElement implements InstanceElement {
/// <i>S</i> with respect to <i>L</i>. Otherwise, we say that the lookup has
/// failed.
/// </blockquote>
/// TODO(scheglov) Deprecate and remove it.
// TODO(scheglov): Deprecate and remove it.
MethodElement? lookUpConcreteMethod(
String methodName, LibraryElement library);

Expand All @@ -1633,7 +1633,7 @@ abstract class InterfaceElement implements InstanceElement {
/// <i>m</i> in <i>S</i> with respect to <i>L</i>. Otherwise, we say that the
/// lookup has failed.
/// </blockquote>
/// TODO(scheglov) Deprecate and remove it.
// TODO(scheglov): Deprecate and remove it.
PropertyAccessorElement? lookUpGetter(
String getterName, LibraryElement library);

Expand All @@ -1654,7 +1654,7 @@ abstract class InterfaceElement implements InstanceElement {
/// <i>m</i> in <i>S</i> with respect to <i>L</i>. Otherwise, we say that the
/// lookup has failed.
/// </blockquote>
/// TODO(scheglov) Deprecate and remove it.
// TODO(scheglov): Deprecate and remove it.
PropertyAccessorElement? lookUpInheritedConcreteGetter(
String getterName, LibraryElement library);

Expand All @@ -1674,7 +1674,7 @@ abstract class InterfaceElement implements InstanceElement {
/// <i>S</i> with respect to <i>L</i>. Otherwise, we say that the lookup has
/// failed.
/// </blockquote>
/// TODO(scheglov) Deprecate and remove it.
// TODO(scheglov): Deprecate and remove it.
MethodElement? lookUpInheritedConcreteMethod(
String methodName, LibraryElement library);

Expand All @@ -1695,7 +1695,7 @@ abstract class InterfaceElement implements InstanceElement {
/// <i>m</i> in <i>S</i> with respect to <i>L</i>. Otherwise, we say that the
/// lookup has failed.
/// </blockquote>
/// TODO(scheglov) Deprecate and remove it.
// TODO(scheglov): Deprecate and remove it.
PropertyAccessorElement? lookUpInheritedConcreteSetter(
String setterName, LibraryElement library);

Expand All @@ -1714,7 +1714,7 @@ abstract class InterfaceElement implements InstanceElement {
/// <i>S</i> with respect to <i>L</i>. Otherwise, we say that the lookup has
/// failed.
/// </blockquote>
/// TODO(scheglov) Deprecate and remove it.
// TODO(scheglov): Deprecate and remove it.
MethodElement? lookUpInheritedMethod(
String methodName, LibraryElement library);

Expand All @@ -1733,7 +1733,7 @@ abstract class InterfaceElement implements InstanceElement {
/// <i>S</i> with respect to <i>L</i>. Otherwise, we say that the lookup has
/// failed.
/// </blockquote>
/// TODO(scheglov) Deprecate and remove it.
// TODO(scheglov): Deprecate and remove it.
MethodElement? lookUpMethod(String methodName, LibraryElement library);

/// Returns the element representing the setter that results from looking up
Expand All @@ -1752,7 +1752,7 @@ abstract class InterfaceElement implements InstanceElement {
/// <i>m</i> in <i>S</i> with respect to <i>L</i>. Otherwise, we say that the
/// lookup has failed.
/// </blockquote>
/// TODO(scheglov) Deprecate and remove it.
// TODO(scheglov): Deprecate and remove it.
PropertyAccessorElement? lookUpSetter(
String setterName, LibraryElement library);
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/analyzer/lib/dart/element/type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ abstract class FunctionType implements DartType {
/// The formal type parameters of this generic function.
/// For example `<T> T -> T`.
///
/// TODO(scheglov) Remove the mention for "typeParameters".
// TODO(scheglov): Remove the mention for "typeParameters".
/// These are distinct from the `typeParameters` list, which contains type
/// parameters from surrounding contexts, and thus are free type variables
/// from the perspective of this function type.
Expand Down
4 changes: 2 additions & 2 deletions pkg/analyzer/lib/error/listener.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class ErrorReporter {
/// location of the diagnostic will be the name of the [constructor].
void reportErrorForName(ErrorCode code, ConstructorDeclaration constructor,
{List<Object>? arguments}) {
// TODO(brianwilkerson) Consider extending this method to take any
// TODO(brianwilkerson): Consider extending this method to take any
// declaration and compute the correct range for the name of that
// declaration. This might make it easier to be consistent.
if (constructor.name != null) {
Expand Down Expand Up @@ -232,7 +232,7 @@ class ErrorReporter {
}
}
for (_TypeToConvert typeToConvert in typeGroup) {
// TODO(brianwilkerson) When clients do a better job of displaying
// TODO(brianwilkerson): When clients do a better job of displaying
// context messages, remove the extra text added to the buffer.
StringBuffer? buffer;
for (Element element in typeToConvert.allElements()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
// While transitioning `HintCodes` to `WarningCodes`, we refer to deprecated
// codes here.
// ignore_for_file: deprecated_member_use_from_same_package
//
// Generated comments don't quite align with flutter style.
// ignore_for_file: flutter_style_todos

import "package:analyzer/error/error.dart";

Expand Down
4 changes: 2 additions & 2 deletions pkg/analyzer/lib/src/context/context.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ class AnalysisContextImpl implements AnalysisContext {
return _analysisOptions;
}

/// TODO(scheglov) Remove it, exists only for Cider.
// TODO(scheglov): Remove it, exists only for Cider.
set analysisOptions(AnalysisOptionsImpl analysisOptions) {
_analysisOptions = analysisOptions;

// TODO() remove this method as well
// TODO(scheglov): remove this method as well
_typeSystemLegacy?.updateOptions(
strictCasts: analysisOptions.strictCasts,
strictInference: analysisOptions.strictInference,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:analyzer/file_system/file_system.dart';
/// Instances of the class [AnalysisOptionsMap] map [File]s under analysis to their
/// corresponding [AnalysisOptions].
class AnalysisOptionsMap {
// todo(pq): final backing representation TBD.
// TODO(pq): final backing representation TBD.
final List<({Folder folder, AnalysisOptions options})> _entries = [];

/// Map this [folder] to the given [options].
Expand Down
12 changes: 6 additions & 6 deletions pkg/analyzer/lib/src/dart/analysis/context_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class ContextBuilderImpl implements ContextBuilder {
MacroSupport? macroSupport,
OwnedFiles? ownedFiles,
}) {
// TODO(scheglov) Remove this, and make `sdkPath` required.
// TODO(scheglov): Remove this, and make `sdkPath` required.
sdkPath ??= getSdkPath();
ArgumentError.checkNotNull(sdkPath, 'sdkPath');
if (updateAnalysisOptions != null && updateAnalysisOptions2 != null) {
Expand Down Expand Up @@ -110,7 +110,7 @@ class ContextBuilderImpl implements ContextBuilder {
sdkSummaryPath: sdkSummaryPath,
);

// TODO(scheglov) Ensure that "librarySummaryPaths" not null only
// TODO(scheglov): Ensure that "librarySummaryPaths" not null only
// when "sdkSummaryPath" is not null.
if (sdk is SummaryBasedDartSdk) {
summaryData?.addBundle(null, sdk.bundle);
Expand Down Expand Up @@ -167,7 +167,7 @@ class ContextBuilderImpl implements ContextBuilder {

/// Return [Packages] to analyze the [contextRoot].
///
/// TODO(scheglov) Get [Packages] from [Workspace]?
// TODO(scheglov): Get [Packages] from [Workspace]?
Packages _createPackageMap({
required ContextRoot contextRoot,
}) {
Expand Down Expand Up @@ -199,7 +199,7 @@ class ContextBuilderImpl implements ContextBuilder {
);

{
// TODO(scheglov) We already had partial SourceFactory in ContextLocatorImpl.
// TODO(scheglov): We already had partial SourceFactory in ContextLocatorImpl.
var partialSourceFactory = workspace.createSourceFactory(null, null);
var embedderYamlSource = partialSourceFactory.forUri(
'package:sky_engine/_embedder.yaml',
Expand All @@ -225,7 +225,7 @@ class ContextBuilderImpl implements ContextBuilder {
/// Return the `pubspec.yaml` file that should be used when analyzing code in
/// the [contextRoot], possibly `null`.
///
/// TODO(scheglov) Get it from [Workspace]?
// TODO(scheglov): Get it from [Workspace]?
File? _findPubspecFile(ContextRoot contextRoot) {
for (var current in contextRoot.root.withAncestors) {
var file = current.getChildAssumingFile(file_paths.pubspecYaml);
Expand All @@ -239,7 +239,7 @@ class ContextBuilderImpl implements ContextBuilder {
/// Return the analysis options that should be used to analyze code in the
/// [contextRoot].
///
/// TODO(scheglov) We have already loaded it once in [ContextLocatorImpl].
// TODO(scheglov): We have already loaded it once in [ContextLocatorImpl].
AnalysisOptionsImpl _getAnalysisOptions(
ContextRoot contextRoot,
SourceFactory sourceFactory,
Expand Down
14 changes: 7 additions & 7 deletions pkg/analyzer/lib/src/dart/analysis/context_builder2.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class ContextBuilderImpl2 implements ContextBuilder {
MacroSupport? macroSupport,
OwnedFiles? ownedFiles,
}) {
// TODO(scheglov) Remove this, and make `sdkPath` required.
// TODO(scheglov): Remove this, and make `sdkPath` required.
sdkPath ??= getSdkPath();
ArgumentError.checkNotNull(sdkPath, 'sdkPath');
if (updateAnalysisOptions != null && updateAnalysisOptions2 != null) {
Expand Down Expand Up @@ -112,15 +112,15 @@ class ContextBuilderImpl2 implements ContextBuilder {
sdkSummaryPath: sdkSummaryPath,
);

// TODO(scheglov) Ensure that "librarySummaryPaths" not null only
// TODO(scheglov): Ensure that "librarySummaryPaths" not null only
// when "sdkSummaryPath" is not null.
if (sdk is SummaryBasedDartSdk) {
summaryData?.addBundle(null, sdk.bundle);
}

var sourceFactory = workspace.createSourceFactory(sdk, summaryData);

// todo(pq): remove
// TODO(pq): remove
var options = _getAnalysisOptions(contextRoot, sourceFactory);
if (updateAnalysisOptions != null) {
updateAnalysisOptions(options);
Expand Down Expand Up @@ -229,7 +229,7 @@ class ContextBuilderImpl2 implements ContextBuilder {

/// Return [Packages] to analyze the [contextRoot].
///
/// TODO(scheglov) Get [Packages] from [Workspace]?
// TODO(scheglov): Get [Packages] from [Workspace]?
Packages _createPackageMap({
required ContextRoot contextRoot,
}) {
Expand Down Expand Up @@ -261,7 +261,7 @@ class ContextBuilderImpl2 implements ContextBuilder {
);

{
// TODO(scheglov) We already had partial SourceFactory in ContextLocatorImpl.
// TODO(scheglov): We already had partial SourceFactory in ContextLocatorImpl.
var partialSourceFactory = workspace.createSourceFactory(null, null);
var embedderYamlSource = partialSourceFactory.forUri(
'package:sky_engine/_embedder.yaml',
Expand All @@ -287,7 +287,7 @@ class ContextBuilderImpl2 implements ContextBuilder {
/// Return the `pubspec.yaml` file that should be used when analyzing code in
/// the [contextRoot], possibly `null`.
///
/// TODO(scheglov) Get it from [Workspace]?
// TODO(scheglov): Get it from [Workspace]?
File? _findPubspecFile(ContextRoot contextRoot) {
for (var current in contextRoot.root.withAncestors) {
var file = current.getChildAssumingFile(file_paths.pubspecYaml);
Expand All @@ -301,7 +301,7 @@ class ContextBuilderImpl2 implements ContextBuilder {
/// Return the analysis options that should be used to analyze code in the
/// [contextRoot].
///
/// TODO(scheglov) We have already loaded it once in [ContextLocatorImpl].
// TODO(scheglov): We have already loaded it once in [ContextLocatorImpl].
AnalysisOptionsImpl _getAnalysisOptions(
ContextRoot contextRoot,
SourceFactory sourceFactory,
Expand Down
4 changes: 2 additions & 2 deletions pkg/analyzer/lib/src/dart/analysis/context_locator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ class ContextLocatorImpl implements ContextLocator {
folder.shortName.startsWith('.')) {
return true;
}
// TODO(scheglov) Why not take it from `containingRoot`?
// TODO(scheglov): Why not take it from `containingRoot`?
for (var pattern in excludedGlobs) {
if (pattern.matches(folder.path)) {
return true;
Expand Down Expand Up @@ -427,7 +427,7 @@ class ContextLocatorImpl implements ContextLocator {
return null;
}

// TODO(scheglov) Create SourceFactory once.
// TODO(scheglov): Create SourceFactory once.
var sourceFactory = workspace.createSourceFactory(null, null);
var uriStr = WorkspaceWithDefaultAnalysisOptions.uri;
var path = sourceFactory.forUri(uriStr)?.fullName;
Expand Down
6 changes: 3 additions & 3 deletions pkg/analyzer/lib/src/dart/analysis/context_locator2.dart
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ class ContextLocatorImpl2 implements ContextLocator {
var buildGnFile = folder.getExistingFile(file_paths.buildGn);

if (localOptionsFile != null) {
// todo(pq): remove cast when API is finalized.
// TODO(pq): remove cast when API is finalized.
(containingRoot as ContextRootImpl).optionsFileMap[folder] =
localOptionsFile;
}
Expand Down Expand Up @@ -350,7 +350,7 @@ class ContextLocatorImpl2 implements ContextLocator {
folder.shortName.startsWith('.')) {
return true;
}
// TODO(scheglov) Why not take it from `containingRoot`?
// TODO(scheglov): Why not take it from `containingRoot`?
for (var pattern in excludedGlobs) {
if (pattern.matches(folder.path)) {
return true;
Expand Down Expand Up @@ -435,7 +435,7 @@ class ContextLocatorImpl2 implements ContextLocator {
return null;
}

// TODO(scheglov) Create SourceFactory once.
// TODO(scheglov): Create SourceFactory once.
var sourceFactory = workspace.createSourceFactory(null, null);
var uriStr = WorkspaceWithDefaultAnalysisOptions.uri;
var path = sourceFactory.forUri(uriStr)?.fullName;
Expand Down
Loading

0 comments on commit fe6950e

Please sign in to comment.