Commit 610955f8 authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

upgrade to linter-0.1.30 (#9297)

* upgrade to linter-0.1.30

* add prefer_is_empty lint
* add directives_ordering lint
* add no_adjacent_strings_in_list lint
* add no_duplicate_case_values lint
* add prefer_collection_literals lint
* add prefer_const_constructors lint
* add prefer_contains lint
* add prefer_initializing_formals lint
* add unnecessary_null_aware_assignments lint
* add unnecessary_null_in_if_null_operators lint
parent 361afef3
......@@ -74,11 +74,14 @@ linter:
- await_only_futures
- camel_case_types
# - constant_identifier_names # https://github.com/dart-lang/linter/issues/204
- directives_ordering
- empty_catches
- empty_constructor_bodies
- implementation_imports
- library_names
- library_prefixes
- no_adjacent_strings_in_list
- no_duplicate_case_values
- non_constant_identifier_names
# - one_member_abstracts # too many false positives
# - only_throw_errors # https://github.com/flutter/flutter/issues/5792
......@@ -87,7 +90,12 @@ linter:
- package_prefixed_library_names
# - parameter_assignments # we do this commonly
# - prefer_final_fields # https://github.com/dart-lang/sdk/issues/29197
- prefer_collection_literals
- prefer_const_constructors
- prefer_contains
- prefer_final_locals
- prefer_initializing_formals
- prefer_is_empty
- prefer_is_not_empty
# - public_member_api_docs # this is the only difference from .analysis_options_repo
- slash_for_doc_comments
......@@ -99,6 +107,8 @@ linter:
# - unawaited_futures # https://github.com/flutter/flutter/issues/5793
- unnecessary_brace_in_string_interp
- unnecessary_getters_setters
- unnecessary_null_aware_assignments
- unnecessary_null_in_if_null_operators
# === pub rules ===
- package_names
......@@ -72,11 +72,14 @@ linter:
- await_only_futures
- camel_case_types
# - constant_identifier_names # https://github.com/dart-lang/linter/issues/204
- directives_ordering
- empty_catches
- empty_constructor_bodies
- implementation_imports
- library_names
- library_prefixes
- no_adjacent_strings_in_list
- no_duplicate_case_values
- non_constant_identifier_names
# - one_member_abstracts # too many false positives
# - only_throw_errors # https://github.com/flutter/flutter/issues/5792
......@@ -85,7 +88,12 @@ linter:
- package_prefixed_library_names
# - parameter_assignments # we do this commonly
# - prefer_final_fields # https://github.com/dart-lang/sdk/issues/29197
- prefer_collection_literal
- prefer_const_constructors
- prefer_contains
- prefer_final_locals
- prefer_initializing_formals
- prefer_is_empty
- prefer_is_not_empty
- public_member_api_docs # this is the only difference from .analysis_options
- slash_for_doc_comments
......@@ -95,8 +103,10 @@ linter:
# - type_annotate_public_apis # subset of always_specify_types
- type_init_formals
# - unawaited_futures # https://github.com/flutter/flutter/issues/5793
- unnecessary_brace_in_string_interp
- unnecessary_brace_in_string_interps
- unnecessary_getters_setters
- unnecessary_null_aware_assignments
- unnecessary_null_in_if_null_operators
# === pub rules ===
- package_names
......@@ -60,7 +60,7 @@ class ComplexLayoutState extends State<ComplexLayout> {
title: const Text('Advanced Layout'),
actions: <Widget>[
new IconButton(
icon: new Icon(Icons.create),
icon: const Icon(Icons.create),
tooltip: 'Search',
onPressed: () {
print('Pressed search');
......@@ -386,11 +386,11 @@ class ItemImageBox extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
new IconButton(
icon: new Icon(Icons.edit),
icon: const Icon(Icons.edit),
onPressed: () { print('Pressed edit button'); }
),
new IconButton(
icon: new Icon(Icons.zoom_in),
icon: const Icon(Icons.zoom_in),
onPressed: () { print('Pressed zoom button'); }
),
]
......@@ -578,7 +578,7 @@ class GalleryDrawer extends StatelessWidget {
children: <Widget>[
new FancyDrawerHeader(),
new ListTile(
leading: new Icon(Icons.brightness_5),
leading: const Icon(Icons.brightness_5),
title: const Text('Light'),
onTap: () { _changeTheme(context, true); },
selected: ComplexLayoutApp.of(context).lightTheme,
......@@ -589,7 +589,7 @@ class GalleryDrawer extends StatelessWidget {
),
),
new ListTile(
leading: new Icon(Icons.brightness_7),
leading: const Icon(Icons.brightness_7),
title: const Text('Dark'),
onTap: () { _changeTheme(context, false); },
selected: !ComplexLayoutApp.of(context).lightTheme,
......@@ -601,7 +601,7 @@ class GalleryDrawer extends StatelessWidget {
),
new Divider(),
new ListTile(
leading: new Icon(Icons.hourglass_empty),
leading: const Icon(Icons.hourglass_empty),
title: const Text('Animate Slowly'),
selected: timeDilation != 1.0,
onTap: () { ComplexLayoutApp.of(context).toggleAnimationSpeed(); },
......
......@@ -108,7 +108,7 @@ class CardCollectionState extends State<CardCollection> {
buildFontRadioItem("Right-align text", TextAlign.right, _textAlign, _changeTextAlign, icon: Icons.format_align_right, enabled: !_editable),
new Divider(),
new ListTile(
leading: new Icon(Icons.dvr),
leading: const Icon(Icons.dvr),
onTap: () { debugDumpApp(); debugDumpRenderTree(); },
title: const Text('Dump App to Console'),
),
......@@ -281,7 +281,7 @@ class CardCollectionState extends State<CardCollection> {
}
// TODO(abarth): This icon is wrong in RTL.
Widget leftArrowIcon = new Icon(Icons.arrow_back, size: 36.0);
Widget leftArrowIcon = const Icon(Icons.arrow_back, size: 36.0);
if (_dismissDirection == DismissDirection.startToEnd)
leftArrowIcon = new Opacity(opacity: 0.1, child: leftArrowIcon);
......
......@@ -452,7 +452,7 @@ class _AnimationDemoState extends State<AnimationDemo> with TickerProviderStateM
floatingActionButton: new Builder(
builder: (BuildContext context) {
return new FloatingActionButton(
child: new Icon(Icons.refresh),
child: const Icon(Icons.refresh),
onPressed: () {
_play(_allDemos[DefaultTabController.of(context).index]);
},
......
......@@ -92,7 +92,7 @@ class PageViewAppState extends State<PageViewApp> {
onTap: switchScrollDirection,
),
new ListTile(
leading: new Icon(Icons.more_vert),
leading: const Icon(Icons.more_vert),
selected: scrollDirection == Axis.vertical,
trailing: const Text('Vertical Layout'),
onTap: switchScrollDirection,
......
......@@ -22,6 +22,13 @@
/// initialized with those features.
library rendering;
export 'package:flutter/foundation.dart' show
VoidCallback,
ValueChanged,
ValueGetter,
ValueSetter;
export 'package:vector_math/vector_math_64.dart' show Matrix4;
export 'src/rendering/animated_size.dart';
export 'src/rendering/binding.dart';
export 'src/rendering/block.dart';
......@@ -57,10 +64,3 @@ export 'src/rendering/view.dart';
export 'src/rendering/viewport.dart';
export 'src/rendering/viewport_offset.dart';
export 'src/rendering/wrap.dart';
export 'package:flutter/foundation.dart' show
VoidCallback,
ValueChanged,
ValueGetter,
ValueSetter;
export 'package:vector_math/vector_math_64.dart' show Matrix4;
......@@ -467,7 +467,7 @@ class _MonthPickerState extends State<MonthPicker> {
top: 0.0,
left: 8.0,
child: new IconButton(
icon: new Icon(Icons.chevron_left),
icon: const Icon(Icons.chevron_left),
tooltip: 'Previous month',
onPressed: _isDisplayingFirstMonth ? null : _handlePreviousMonth,
),
......@@ -476,7 +476,7 @@ class _MonthPickerState extends State<MonthPicker> {
top: 0.0,
right: 8.0,
child: new IconButton(
icon: new Icon(Icons.chevron_right),
icon: const Icon(Icons.chevron_right),
tooltip: 'Next month',
onPressed: _isDisplayingLastMonth ? null : _handleNextMonth,
),
......
......@@ -9,8 +9,8 @@ import 'dart:typed_data';
import 'package:flutter/foundation.dart';
import 'package:http/http.dart' as http;
import 'platform_messages.dart';
import 'http_client.dart';
import 'platform_messages.dart';
/// A collection of resources used by the application.
///
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'platform_channel.dart';
import 'message_codecs.dart';
import 'platform_channel.dart';
/// Platform channels used by the Flutter system.
class SystemChannels {
......
......@@ -7,9 +7,9 @@ import 'dart:ui' show TextAffinity, hashValues;
import 'package:flutter/foundation.dart';
import 'message_codec.dart';
import 'system_channels.dart';
import 'text_editing.dart';
import 'message_codec.dart';
export 'dart:ui' show TextAffinity;
......
......@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:typed_data';
import 'package:flutter/foundation.dart';
import 'package:test/test.dart';
import 'dart:typed_data';
void main() {
group('Write and read buffer round-trip', () {
test('of single byte', () {
......@@ -77,4 +77,4 @@ void main() {
expect(readDoubles[1], isNaN);
});
});
}
\ No newline at end of file
}
......@@ -4,8 +4,8 @@
import 'dart:async';
import '../base/io.dart';
import '../base/file_system.dart';
import '../base/io.dart';
import '../base/os.dart';
import '../base/platform.dart';
import '../base/process.dart';
......@@ -50,7 +50,7 @@ class AndroidWorkflow extends DoctorValidator implements Workflow {
final String javaHomeOutput = runCheckedSync(<String>['/usr/libexec/java_home'], hideStdout: true);
if (javaHomeOutput != null) {
final List<String> javaHomeOutputSplit = javaHomeOutput.split('\n');
if ((javaHomeOutputSplit != null) && (javaHomeOutputSplit.length > 0)) {
if ((javaHomeOutputSplit != null) && (javaHomeOutputSplit.isNotEmpty)) {
final String javaHome = javaHomeOutputSplit[0].trim();
return fs.path.join(javaHome, 'bin', 'java');
}
......
......@@ -74,7 +74,7 @@ class FuchsiaReloadCommand extends FlutterCommand {
// Find the network ports used on the device by VM service instances.
final List<int> servicePorts = await _getServicePorts();
if (servicePorts.length == 0) {
if (servicePorts.isEmpty) {
throwToolExit("Couldn't find any running Observatory instances.");
}
for (int port in servicePorts) {
......@@ -85,7 +85,7 @@ class FuchsiaReloadCommand extends FlutterCommand {
// ports, and find the Isolates that are running the target app.
final String isolateName = "$_binaryName\$main";
final List<int> targetPorts = await _filterPorts(servicePorts, isolateName);
if (targetPorts.length == 0) {
if (targetPorts.isEmpty) {
throwToolExit("No VMs found running $_binaryName");
}
for (int port in targetPorts) {
......@@ -110,7 +110,7 @@ class FuchsiaReloadCommand extends FlutterCommand {
// Find ports where there is a view isolate with the given name
Future<List<int>> _filterPorts(List<int> ports, String isolateFilter) async {
final List<int> result = new List<int>();
final List<int> result = <int>[];
for (int port in ports) {
final String addr = "http://$_address:$port";
final Uri uri = Uri.parse(addr);
......@@ -206,7 +206,7 @@ class FuchsiaReloadCommand extends FlutterCommand {
final FuchsiaDeviceCommandRunner runner =
new FuchsiaDeviceCommandRunner(_fuchsiaRoot);
final List<String> lsOutput = await runner.run("ls /tmp/dart.services");
final List<int> ports = new List<int>();
final List<int> ports = <int>[];
for (String s in lsOutput) {
final String trimmed = s.trim();
final int lastSpace = trimmed.lastIndexOf(' ');
......
......@@ -8,11 +8,11 @@ import 'dart:convert' show JSON;
import 'package:meta/meta.dart';
import '../application_package.dart';
import '../base/context.dart';
import '../base/common.dart';
import '../base/context.dart';
import '../base/file_system.dart';
import '../base/logger.dart';
import '../base/io.dart';
import '../base/logger.dart';
import '../base/platform.dart';
import '../base/process.dart';
import '../base/process_manager.dart';
......
......@@ -18,7 +18,7 @@ dependencies:
intl: '>=0.14.0 <0.15.0'
json_rpc_2: ^2.0.0
json_schema: 1.0.6
linter: 0.1.30-alpha.1
linter: 0.1.30
meta: ^1.0.4
mustache: ^0.2.5
package_config: '>=0.1.5 <2.0.0'
......
......@@ -2,13 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter_tools/src/version.dart';
import 'package:mockito/mockito.dart';
import 'package:test/test.dart';
import 'package:flutter_tools/src/version.dart';
import '../context.dart';
import '../common.dart';
import '../context.dart';
import 'flutter_command_test.dart';
void main() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment