enable lint prefer_equal_for_default_values (#18156)

This commit is contained in:
Alexandre Ardhuin
2018-06-05 08:50:40 +02:00
committed by GitHub
parent 6be81ebf9b
commit 09276bea25
390 changed files with 1920 additions and 1920 deletions

View File

@@ -78,9 +78,9 @@ Branch fromBranchName(String name) {
class ProcessRunner {
ProcessRunner({
ProcessManager processManager,
this.subprocessOutput: true,
this.subprocessOutput = true,
this.defaultWorkingDirectory,
this.platform: const LocalPlatform(),
this.platform = const LocalPlatform(),
}) : processManager = processManager ?? const LocalProcessManager() {
environment = new Map<String, String>.from(platform.environment);
}
@@ -112,7 +112,7 @@ class ProcessRunner {
Future<String> runProcess(
List<String> commandLine, {
Directory workingDirectory,
bool failOk: false,
bool failOk = false,
}) async {
workingDirectory ??= defaultWorkingDirectory ?? Directory.current;
if (subprocessOutput) {
@@ -193,8 +193,8 @@ class ArchiveCreator {
this.revision,
this.branch, {
ProcessManager processManager,
bool subprocessOutput: true,
this.platform: const LocalPlatform(),
bool subprocessOutput = true,
this.platform = const LocalPlatform(),
HttpReader httpReader,
}) : assert(revision.length == 40),
flutterRoot = new Directory(path.join(tempDir.path, 'flutter')),
@@ -430,8 +430,8 @@ class ArchivePublisher {
this.version,
this.outputFile, {
ProcessManager processManager,
bool subprocessOutput: true,
this.platform: const LocalPlatform(),
bool subprocessOutput = true,
this.platform = const LocalPlatform(),
}) : assert(revision.length == 40),
platformName = platform.operatingSystem.toLowerCase(),
metadataGsPath = '$gsReleaseFolder/${getMetadataFilename(platform)}',
@@ -528,7 +528,7 @@ class ArchivePublisher {
Future<String> _runGsUtil(
List<String> args, {
Directory workingDirectory,
bool failOk: false,
bool failOk = false,
}) async {
return _processRunner.runProcess(
<String>['gsutil']..addAll(args),

View File

@@ -274,7 +274,7 @@ class EvalResult {
Future<EvalResult> _evalCommand(String executable, List<String> arguments, {
String workingDirectory,
Map<String, String> environment,
bool skip: false,
bool skip = false,
}) async {
final String commandDescription = '${path.relative(executable, from: workingDirectory)} ${arguments.join(' ')}';
final String relativeWorkingDir = path.relative(workingDirectory);
@@ -315,10 +315,10 @@ Future<EvalResult> _evalCommand(String executable, List<String> arguments, {
Future<Null> _runCommand(String executable, List<String> arguments, {
String workingDirectory,
Map<String, String> environment,
bool expectFailure: false,
bool printOutput: true,
bool skip: false,
Duration timeout: _kLongTimeout,
bool expectFailure = false,
bool printOutput = true,
bool skip = false,
Duration timeout = _kLongTimeout,
}) async {
final String commandDescription = '${path.relative(executable, from: workingDirectory)} ${arguments.join(' ')}';
final String relativeWorkingDir = path.relative(workingDirectory);
@@ -364,11 +364,11 @@ Future<Null> _runCommand(String executable, List<String> arguments, {
Future<Null> _runFlutterTest(String workingDirectory, {
String script,
bool expectFailure: false,
bool printOutput: true,
List<String> options: const <String>[],
bool skip: false,
Duration timeout: _kLongTimeout,
bool expectFailure = false,
bool printOutput = true,
List<String> options = const <String>[],
bool skip = false,
Duration timeout = _kLongTimeout,
}) {
final List<String> args = <String>['test']..addAll(options);
if (flutterTestArgs != null && flutterTestArgs.isNotEmpty)
@@ -385,7 +385,7 @@ Future<Null> _runFlutterTest(String workingDirectory, {
}
Future<Null> _runFlutterAnalyze(String workingDirectory, {
List<String> options: const <String>[]
List<String> options = const <String>[]
}) {
return _runCommand(flutter, <String>['analyze']..addAll(options),
workingDirectory: workingDirectory,
@@ -464,7 +464,7 @@ bool _matches<T>(List<T> a, List<T> b) {
final RegExp _importPattern = new RegExp(r"import 'package:flutter/([^.]+)\.dart'");
final RegExp _importMetaPattern = new RegExp(r"import 'package:meta/meta.dart'");
Set<String> _findDependencies(String srcPath, List<String> errors, { bool checkForMeta: false }) {
Set<String> _findDependencies(String srcPath, List<String> errors, { bool checkForMeta = false }) {
return new Directory(srcPath).listSync(recursive: true).where((FileSystemEntity entity) {
return entity is File && path.extension(entity.path) == '.dart';
}).map<Set<String>>((FileSystemEntity entity) {

View File

@@ -144,7 +144,7 @@ class _TaskRunner {
/// A result of running a single task.
class TaskResult {
/// Constructs a successful result.
TaskResult.success(this.data, {this.benchmarkScoreKeys: const <String>[]})
TaskResult.success(this.data, {this.benchmarkScoreKeys = const <String>[]})
: this.succeeded = true,
this.message = 'success' {
const JsonEncoder prettyJson = const JsonEncoder.withIndent(' ');

View File

@@ -22,7 +22,7 @@ const Duration taskTimeoutWithGracePeriod = const Duration(minutes: 26);
///
/// Running the task in [silent] mode will suppress standard output from task
/// processes and only print standard errors.
Future<Map<String, dynamic>> runTask(String taskName, { bool silent: false }) async {
Future<Map<String, dynamic>> runTask(String taskName, { bool silent = false }) async {
final String taskExecutable = 'bin/tasks/$taskName.dart';
if (!file(taskExecutable).existsSync())

View File

@@ -231,7 +231,7 @@ Future<int> exec(
String executable,
List<String> arguments, {
Map<String, String> environment,
bool canFail: false,
bool canFail = false,
}) async {
final Process process = await startProcess(executable, arguments, environment: environment);
@@ -266,7 +266,7 @@ Future<String> eval(
String executable,
List<String> arguments, {
Map<String, String> environment,
bool canFail: false,
bool canFail = false,
}) async {
final Process process = await startProcess(executable, arguments, environment: environment);
@@ -297,8 +297,8 @@ Future<String> eval(
}
Future<int> flutter(String command, {
List<String> options: const <String>[],
bool canFail: false,
List<String> options = const <String>[],
bool canFail = false,
Map<String, String> environment,
}) {
final List<String> args = <String>[command]..addAll(options);
@@ -308,8 +308,8 @@ Future<int> flutter(String command, {
/// Runs a `flutter` command and returns the standard output as a string.
Future<String> evalFlutter(String command, {
List<String> options: const <String>[],
bool canFail: false,
List<String> options = const <String>[],
bool canFail = false,
Map<String, String> environment,
}) {
final List<String> args = <String>[command]..addAll(options);

View File

@@ -12,13 +12,13 @@ import '../framework/framework.dart';
import '../framework/ios.dart';
import '../framework/utils.dart';
TaskFunction createGalleryTransitionTest({ bool semanticsEnabled: false }) {
TaskFunction createGalleryTransitionTest({ bool semanticsEnabled = false }) {
return new GalleryTransitionTest(semanticsEnabled: semanticsEnabled);
}
class GalleryTransitionTest {
GalleryTransitionTest({ this.semanticsEnabled: false });
GalleryTransitionTest({ this.semanticsEnabled = false });
final bool semanticsEnabled;

View File

@@ -16,7 +16,7 @@ import '../framework/utils.dart';
final Directory _editedFlutterGalleryDir = dir(path.join(Directory.systemTemp.path, 'edited_flutter_gallery'));
final Directory flutterGalleryDir = dir(path.join(flutterDirectory.path, 'examples/flutter_gallery'));
TaskFunction createHotModeTest({ bool isPreviewDart2: true }) {
TaskFunction createHotModeTest({ bool isPreviewDart2 = true }) {
return () async {
final Device device = await devices.workingDevice;
await device.unlock();

View File

@@ -23,7 +23,7 @@ TaskFunction createMicrobenchmarkTask() {
final Device device = await devices.workingDevice;
await device.unlock();
Future<Map<String, double>> _runMicrobench(String benchmarkPath, {bool previewDart2: true}) async {
Future<Map<String, double>> _runMicrobench(String benchmarkPath, {bool previewDart2 = true}) async {
Future<Map<String, double>> _run() async {
print('Running $benchmarkPath');
final Directory appDir = dir(
@@ -86,9 +86,9 @@ TaskFunction createMicrobenchmarkTask() {
}
Future<Process> _startFlutter({
String command: 'run',
List<String> options: const <String>[],
bool canFail: false,
String command = 'run',
List<String> options = const <String>[],
bool canFail = false,
Map<String, String> environment,
}) {
final List<String> args = <String>['run']..addAll(options);

View File

@@ -108,7 +108,7 @@ TaskFunction createBasicMaterialCompileTest() {
class StartupTest {
static const Duration _startupTimeout = const Duration(minutes: 5);
const StartupTest(this.testDirectory, { this.reportMetrics: true });
const StartupTest(this.testDirectory, { this.reportMetrics = true });
final String testDirectory;
final bool reportMetrics;
@@ -221,7 +221,7 @@ class CompileTest {
);
}
static Future<Map<String, dynamic>> _compileAot({ bool previewDart2: true }) async {
static Future<Map<String, dynamic>> _compileAot({ bool previewDart2 = true }) async {
// Generate blobs instead of assembly.
await flutter('clean');
final Stopwatch watch = new Stopwatch()..start();
@@ -258,7 +258,7 @@ class CompileTest {
return metrics;
}
static Future<Map<String, dynamic>> _compileApp({ bool previewDart2: true }) async {
static Future<Map<String, dynamic>> _compileApp({ bool previewDart2 = true }) async {
await flutter('clean');
final Stopwatch watch = new Stopwatch();
int releaseSizeInBytes;
@@ -299,7 +299,7 @@ class CompileTest {
};
}
static Future<Map<String, dynamic>> _compileDebug({ bool previewDart2: true }) async {
static Future<Map<String, dynamic>> _compileDebug({ bool previewDart2 = true }) async {
await flutter('clean');
final Stopwatch watch = new Stopwatch();
final List<String> options = <String>['--debug'];

View File

@@ -181,7 +181,7 @@ class CardCollectionState extends State<CardCollection> {
});
}
Widget buildDrawerCheckbox(String label, bool value, void callback(), { bool enabled: true }) {
Widget buildDrawerCheckbox(String label, bool value, void callback(), { bool enabled = true }) {
return new ListTile(
onTap: enabled ? callback : null,
title: new Text(label),
@@ -192,7 +192,7 @@ class CardCollectionState extends State<CardCollection> {
);
}
Widget buildDrawerColorRadioItem(String label, MaterialColor itemValue, MaterialColor currentValue, ValueChanged<MaterialColor> onChanged, { IconData icon, bool enabled: true }) {
Widget buildDrawerColorRadioItem(String label, MaterialColor itemValue, MaterialColor currentValue, ValueChanged<MaterialColor> onChanged, { IconData icon, bool enabled = true }) {
return new ListTile(
leading: new Icon(icon),
title: new Text(label),
@@ -205,7 +205,7 @@ class CardCollectionState extends State<CardCollection> {
);
}
Widget buildDrawerDirectionRadioItem(String label, DismissDirection itemValue, DismissDirection currentValue, ValueChanged<DismissDirection> onChanged, { IconData icon, bool enabled: true }) {
Widget buildDrawerDirectionRadioItem(String label, DismissDirection itemValue, DismissDirection currentValue, ValueChanged<DismissDirection> onChanged, { IconData icon, bool enabled = true }) {
return new ListTile(
leading: new Icon(icon),
title: new Text(label),
@@ -218,7 +218,7 @@ class CardCollectionState extends State<CardCollection> {
);
}
Widget buildFontRadioItem(String label, TextAlign itemValue, TextAlign currentValue, ValueChanged<TextAlign> onChanged, { IconData icon, bool enabled: true }) {
Widget buildFontRadioItem(String label, TextAlign itemValue, TextAlign currentValue, ValueChanged<TextAlign> onChanged, { IconData icon, bool enabled = true }) {
return new ListTile(
leading: new Icon(icon),
title: new Text(label),

View File

@@ -42,7 +42,7 @@ class ExampleDragTargetState extends State<ExampleDragTarget> {
}
class Dot extends StatefulWidget {
const Dot({ Key key, this.color, this.size, this.child, this.tappable: false }) : super(key: key);
const Dot({ Key key, this.color, this.size, this.child, this.tappable = false }) : super(key: key);
final Color color;
final double size;
@@ -77,8 +77,8 @@ class ExampleDragSource extends StatelessWidget {
const ExampleDragSource({
Key key,
this.color,
this.heavy: false,
this.under: true,
this.heavy = false,
this.under = true,
this.child
}) : super(key: key);

View File

@@ -59,9 +59,9 @@ class _MarkerPainter extends CustomPainter {
class Marker extends StatelessWidget {
const Marker({
Key key,
this.type: MarkerType.touch,
this.type = MarkerType.touch,
this.position,
this.size: 40.0,
this.size = 40.0,
}) : super(key: key);
final Offset position;

View File

@@ -1060,7 +1060,7 @@ class _PaintingState extends State<Painting> with SingleTickerProviderStateMixin
}
}
String zalgo(math.Random random, int targetLength, { bool includeSpacingCombiningMarks: false, String base }) {
String zalgo(math.Random random, int targetLength, { bool includeSpacingCombiningMarks = false, String base }) {
// The following three tables are derived from UnicodeData.txt:
// http://unicode.org/Public/UNIDATA/UnicodeData.txt
// There are three groups, character classes Mc, Me, and Mn.

View File

@@ -313,7 +313,7 @@ List<Directory> findPackages() {
/// Returns import or on-disk paths for all libraries in the Flutter SDK.
///
/// diskPath toggles between import paths vs. disk paths.
Iterable<String> libraryRefs({ bool diskPath: false }) sync* {
Iterable<String> libraryRefs({ bool diskPath = false }) sync* {
for (Directory dir in findPackages()) {
final String dirName = path.basename(dir.path);
for (FileSystemEntity file in new Directory('${dir.path}/lib').listSync()) {
@@ -336,7 +336,7 @@ Iterable<String> libraryRefs({ bool diskPath: false }) sync* {
}
}
void printStream(Stream<List<int>> stream, { String prefix: '', List<Pattern> filter: const <Pattern>[] }) {
void printStream(Stream<List<int>> stream, { String prefix = '', List<Pattern> filter = const <Pattern>[] }) {
assert(prefix != null);
assert(filter != null);
stream