Add missing lints (#24381)

* update lint list

* enable sort_pub_dependencies

* enable avoid_returning_null_for_void

* enable flutter_style_todos
This commit is contained in:
Alexandre Ardhuin 2018-11-19 10:37:55 +01:00 committed by GitHub
parent 15e3df25c5
commit 79b5e5bc8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 22 additions and 14 deletions

View file

@ -56,6 +56,7 @@ linter:
- avoid_empty_else
- avoid_field_initializers_in_const_classes
- avoid_function_literals_in_foreach_calls
# - avoid_implementing_value_types # not yet tested
- avoid_init_to_null
# - avoid_js_rounded_ints # only useful when targeting JS runtime
- avoid_null_checks_in_equality_operators
@ -65,6 +66,7 @@ linter:
- avoid_renaming_method_parameters
- avoid_return_types_on_setters
# - avoid_returning_null # there are plenty of valid reasons to return null
- avoid_returning_null_for_void
# - avoid_returning_this # there are plenty of valid reasons to return this
# - avoid_setters_without_getters # not yet tested
# - avoid_single_cascade_in_expression_statements # not yet tested
@ -87,6 +89,7 @@ linter:
- empty_constructor_bodies
- empty_statements
# - file_names # not yet tested
- flutter_style_todos
- hash_and_equals
- implementation_imports
# - invariant_booleans # too many false positives: https://github.com/dart-lang/linter/issues/811
@ -128,6 +131,7 @@ linter:
# - prefer_function_declarations_over_variables # not yet tested
- prefer_generic_function_type_aliases
- prefer_initializing_formals
# - prefer_int_literals # not yet tested
# - prefer_interpolation_to_compose_strings # not yet tested
- prefer_is_empty
- prefer_is_not_empty
@ -140,6 +144,7 @@ linter:
- recursive_getters
- slash_for_doc_comments
- sort_constructors_first
- sort_pub_dependencies
- sort_unnamed_constructors_first
- super_goes_last
- test_types_in_equals

View file

@ -970,7 +970,7 @@ mixin WidgetInspectorService {
getter: () async => _trackRebuildDirtyWidgets,
setter: (bool value) async {
if (value == _trackRebuildDirtyWidgets) {
return null;
return;
}
_rebuildStats.resetCounts();
_trackRebuildDirtyWidgets = value;
@ -979,10 +979,11 @@ mixin WidgetInspectorService {
debugOnRebuildDirtyWidget = _onRebuildWidget;
// Trigger a rebuild so there are baseline stats for rebuilds
// performed by the app.
return forceRebuild();
await forceRebuild();
return;
} else {
debugOnRebuildDirtyWidget = null;
return null;
return;
}
},
);

View file

@ -563,10 +563,10 @@ void main() {
golden: 'TestTree#00000(stringProperty1: value1, doubleProperty1: 42.5, roundedProperty: 0.3, nullProperty: null, <root node>)',
);
// TODO(jacobr): this is an ugly test case.
// There isn't anything interesting for this case as the children look the
// same with and without children. TODO(jacobr): this is an ugly test case.
// only difference is odd not clearly desirable density of B3 being right
// next to node C.
// same with and without children. Only difference is odd not clearly
// desirable density of B3 being right next to node C.
goldenStyleTest(
'single line last child',
style: DiagnosticsTreeStyle.sparse,

View file

@ -97,7 +97,7 @@ Future<void> run(List<String> args) async {
}
// Put the tester shell where runTests expects it.
// TODO(tvolkert,garymm): Switch to a Fuchsia-specific Artifacts impl.
// TODO(garymm): Switch to a Fuchsia-specific Artifacts impl.
final Link testerDestLink =
fs.link(artifacts.getArtifactPath(Artifact.flutterTester));
testerDestLink.parent.createSync(recursive: true);

View file

@ -19,7 +19,7 @@ import '../run_hot.dart';
import '../runner/flutter_command.dart';
import 'daemon.dart';
// TODO(flutter/flutter#23031): Test this.
// TODO(mklim): Test this, flutter/flutter#23031.
abstract class RunCommandBase extends FlutterCommand {
// Used by run and drive commands.
RunCommandBase({ bool verboseHelp = false }) {

View file

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// ignore_for_file: flutter_style_todos
import 'dart:async';
import 'dart:collection';

View file

@ -297,7 +297,7 @@ Future<XcodeBuildResult> buildXcodeProject({
if (!_checkXcodeVersion())
return XcodeBuildResult(success: false);
// TODO(cbracken) remove when https://github.com/flutter/flutter/issues/20685 is fixed.
// TODO(cbracken): remove when https://github.com/flutter/flutter/issues/20685 is fixed.
await setXcodeWorkspaceBuildSystem(
workspaceDirectory: app.project.xcodeWorkspace,
workspaceSettings: app.project.xcodeWorkspaceSharedSettings,
@ -458,7 +458,7 @@ Future<XcodeBuildResult> buildXcodeProject({
if (line == 'all done') {
// Free pipe file.
tempDir?.deleteSync(recursive: true);
return null;
return;
}
} else {
initialBuildStatus.cancel();
@ -469,7 +469,7 @@ Future<XcodeBuildResult> buildXcodeProject({
);
}
}
return listenToScriptOutputLine();
await listenToScriptOutputLine();
}
// Trigger the start of the pipe -> stdout loop. Ignore exceptions.

View file

@ -12,7 +12,7 @@ import 'globals.dart';
import 'resident_runner.dart';
import 'tracing.dart';
// TODO(flutter/flutter#23031): Test this.
// TODO(mklim): Test this, flutter/flutter#23031.
class ColdRunner extends ResidentRunner {
ColdRunner(
List<FlutterDevice> devices, {

View file

@ -48,7 +48,7 @@ class DeviceReloadReport {
List<Map<String, dynamic>> reports; // List has one report per Flutter view.
}
// TODO(flutter/flutter#23031): Test this.
// TODO(mklim): Test this, flutter/flutter#23031.
class HotRunner extends ResidentRunner {
HotRunner(
List<FlutterDevice> devices, {

View file

@ -102,7 +102,7 @@ const Duration kLongRequestTimeout = Duration(minutes: 1);
/// Used for RPC requests that should never take a long time.
const Duration kShortRequestTimeout = Duration(seconds: 5);
// TODO(flutter/flutter#23031): Test this.
// TODO(mklim): Test this, flutter/flutter#23031.
/// A connection to the Dart VM Service.
class VMService {
VMService(