From 217b2bdaa18de2bfddf213bc920b1337e77f1be3 Mon Sep 17 00:00:00 2001 From: Alexandre Ardhuin Date: Wed, 21 Mar 2018 07:10:14 +0100 Subject: [PATCH] add new lints of linter-0.1.44 and enable unnecessary_parenthesis (#15585) --- analysis_options.yaml | 2 ++ analysis_options_repo.yaml | 2 ++ packages/flutter/lib/src/material/slider_theme.dart | 2 +- packages/flutter_tools/lib/src/ios/mac.dart | 2 +- packages/flutter_tools/lib/src/vscode/vscode.dart | 4 ++-- .../flutter_tools/test/android/android_workflow_test.dart | 8 ++++---- 6 files changed, 12 insertions(+), 8 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index 78a2e88974a..14226330f01 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -63,6 +63,7 @@ linter: - avoid_init_to_null - avoid_null_checks_in_equality_operators # - avoid_positional_boolean_parameters # not yet tested + # - avoid_relative_lib_imports # not yet tested - avoid_return_types_on_setters # - avoid_returning_null # we do this commonly # - avoid_returning_this # https://github.com/dart-lang/linter/issues/842 @@ -141,6 +142,7 @@ linter: - unnecessary_null_aware_assignments - unnecessary_null_in_if_null_operators - unnecessary_overrides + - unnecessary_parenthesis # - unnecessary_statements # not yet tested - unnecessary_this - unrelated_type_equality_checks diff --git a/analysis_options_repo.yaml b/analysis_options_repo.yaml index 65ebfb7de59..e83d88044a6 100644 --- a/analysis_options_repo.yaml +++ b/analysis_options_repo.yaml @@ -56,6 +56,7 @@ linter: - avoid_init_to_null - avoid_null_checks_in_equality_operators # - avoid_positional_boolean_parameters # not yet tested + # - avoid_relative_lib_imports # not yet tested - avoid_return_types_on_setters # - avoid_returning_null # we do this commonly # - avoid_returning_this # https://github.com/dart-lang/linter/issues/842 @@ -134,6 +135,7 @@ linter: - unnecessary_null_aware_assignments - unnecessary_null_in_if_null_operators - unnecessary_overrides + - unnecessary_parenthesis # - unnecessary_statements # not yet tested - unnecessary_this - unrelated_type_equality_checks diff --git a/packages/flutter/lib/src/material/slider_theme.dart b/packages/flutter/lib/src/material/slider_theme.dart index 6824bb2c8f6..636373c0463 100644 --- a/packages/flutter/lib/src/material/slider_theme.dart +++ b/packages/flutter/lib/src/material/slider_theme.dart @@ -754,7 +754,7 @@ class PaddleSliderValueIndicatorShape extends SliderComponentShape { if (bottomRight.dx > parentBox.size.width - edgeMargin) { shift = parentBox.size.width - bottomRight.dx - edgeMargin; } - shift = (scale == 0.0 ? 0.0 : shift / scale); + shift = scale == 0.0 ? 0.0 : shift / scale; return shift; } diff --git a/packages/flutter_tools/lib/src/ios/mac.dart b/packages/flutter_tools/lib/src/ios/mac.dart index fd34572ceca..89497eb1d7d 100644 --- a/packages/flutter_tools/lib/src/ios/mac.dart +++ b/packages/flutter_tools/lib/src/ios/mac.dart @@ -248,7 +248,7 @@ Future buildXcodeProject({ appIosDirectory: appDirectory, iosEngineDir: flutterFrameworkDir(buildInfo.mode), isSwift: app.isSwift, - flutterPodChanged: (previousGeneratedXcconfig != currentGeneratedXcconfig), + flutterPodChanged: previousGeneratedXcconfig != currentGeneratedXcconfig, ); } diff --git a/packages/flutter_tools/lib/src/vscode/vscode.dart b/packages/flutter_tools/lib/src/vscode/vscode.dart index 7eace4cb2b3..28ed4ac23cf 100644 --- a/packages/flutter_tools/lib/src/vscode/vscode.dart +++ b/packages/flutter_tools/lib/src/vscode/vscode.dart @@ -155,7 +155,7 @@ class VsCode { static List _findInstalled( List<_VsCodeInstallLocation> allLocations) { - final Iterable<_VsCodeInstallLocation> searchLocations = + final Iterable<_VsCodeInstallLocation> searchLocations = _includeInsiders ? allLocations : allLocations.where((_VsCodeInstallLocation p) => p.isInsiders != true); @@ -175,7 +175,7 @@ class VsCode { @override String toString() => - 'VS Code ($version)${(_extensionVersion != Version.unknown ? ', Dart Code ($_extensionVersion)' : '')}'; + 'VS Code ($version)${_extensionVersion != Version.unknown ? ', Dart Code ($_extensionVersion)' : ''}'; static String _getVersionFromPackageJson(String packageJsonPath) { if (!fs.isFileSync(packageJsonPath)) diff --git a/packages/flutter_tools/test/android/android_workflow_test.dart b/packages/flutter_tools/test/android/android_workflow_test.dart index 19666f98e68..d5d65bf290f 100644 --- a/packages/flutter_tools/test/android/android_workflow_test.dart +++ b/packages/flutter_tools/test/android/android_workflow_test.dart @@ -42,7 +42,7 @@ void main() { MockAndroidSdk.createSdkDirectory(); when(sdk.sdkManagerPath).thenReturn('/foo/bar/sdkmanager'); final AndroidWorkflow androidWorkflow = new AndroidWorkflow(); - final LicensesAccepted result = await(androidWorkflow.licensesAccepted); + final LicensesAccepted result = await androidWorkflow.licensesAccepted; expect(result, equals(LicensesAccepted.unknown)); expect(processManager.commands.first, equals('/foo/bar/sdkmanager')); expect(processManager.commands.last, equals('--licenses')); @@ -63,7 +63,7 @@ void main() { ]); final AndroidWorkflow androidWorkflow = new AndroidWorkflow(); - final LicensesAccepted result = await(androidWorkflow.licensesAccepted); + final LicensesAccepted result = await androidWorkflow.licensesAccepted; expect(result, equals(LicensesAccepted.all)); }, overrides: { AndroidSdk: () => sdk, @@ -83,7 +83,7 @@ void main() { ]); final AndroidWorkflow androidWorkflow = new AndroidWorkflow(); - final LicensesAccepted result = await(androidWorkflow.licensesAccepted); + final LicensesAccepted result = await androidWorkflow.licensesAccepted; expect(result, equals(LicensesAccepted.some)); }, overrides: { AndroidSdk: () => sdk, @@ -103,7 +103,7 @@ void main() { ]); final AndroidWorkflow androidWorkflow = new AndroidWorkflow(); - final LicensesAccepted result = await(androidWorkflow.licensesAccepted); + final LicensesAccepted result = await androidWorkflow.licensesAccepted; expect(result, equals(LicensesAccepted.none)); }, overrides: { AndroidSdk: () => sdk,