enable lints prefer_spread_collections and prefer_inlined_adds (#35189)
This commit is contained in:
committed by
GitHub
parent
31cf49a9c9
commit
919dcf53f3
@@ -286,13 +286,14 @@ class SampleChecker {
|
||||
'--snapshot=$_snippetsSnapshotPath',
|
||||
'--snapshot-kind=app-jit',
|
||||
path.canonicalize(_snippetsExecutable),
|
||||
]..addAll(args),
|
||||
...args,
|
||||
],
|
||||
workingDirectory: workingDirectory,
|
||||
);
|
||||
} else {
|
||||
return Process.runSync(
|
||||
_dartExecutable,
|
||||
<String>[path.canonicalize(_snippetsSnapshotPath)]..addAll(args),
|
||||
<String>[path.canonicalize(_snippetsSnapshotPath), ...args],
|
||||
workingDirectory: workingDirectory,
|
||||
);
|
||||
}
|
||||
@@ -311,7 +312,8 @@ class SampleChecker {
|
||||
final List<String> args = <String>[
|
||||
'--output=${outputFile.absolute.path}',
|
||||
'--input=${inputFile.absolute.path}',
|
||||
]..addAll(snippet.args);
|
||||
...snippet.args,
|
||||
];
|
||||
print('Generating snippet for ${snippet.start?.filename}:${snippet.start?.line}');
|
||||
final ProcessResult process = _runSnippetsScript(args);
|
||||
if (process.exitCode != 0) {
|
||||
@@ -854,9 +856,11 @@ class Section {
|
||||
),
|
||||
);
|
||||
}
|
||||
return Section(<Line>[Line(prefix)]
|
||||
..addAll(codeLines)
|
||||
..add(Line(postfix)));
|
||||
return Section(<Line>[
|
||||
Line(prefix),
|
||||
...codeLines,
|
||||
Line(postfix),
|
||||
]);
|
||||
}
|
||||
Line get start => code.firstWhere((Line line) => line.filename != null);
|
||||
final List<Line> code;
|
||||
@@ -868,8 +872,8 @@ class Section {
|
||||
/// analyzed.
|
||||
class Snippet {
|
||||
Snippet({this.start, List<String> input, List<String> args, this.serial}) {
|
||||
this.input = <String>[]..addAll(input);
|
||||
this.args = <String>[]..addAll(args);
|
||||
this.input = input.toList();
|
||||
this.args = args.toList();
|
||||
}
|
||||
final Line start;
|
||||
final int serial;
|
||||
|
||||
@@ -260,7 +260,9 @@ Future<EvalResult> _evalCommand(String executable, List<String> arguments, {
|
||||
Future<void> _runFlutterAnalyze(String workingDirectory, {
|
||||
List<String> options = const <String>[],
|
||||
}) {
|
||||
return runCommand(flutter, <String>['analyze', '--dartdocs']..addAll(options),
|
||||
return runCommand(
|
||||
flutter,
|
||||
<String>['analyze', '--dartdocs', ...options],
|
||||
workingDirectory: workingDirectory,
|
||||
);
|
||||
}
|
||||
@@ -456,7 +458,10 @@ List<T> _deepSearch<T>(Map<T, Set<T>> map, T start, [ Set<T> seen ]) {
|
||||
final List<T> result = _deepSearch<T>(
|
||||
map,
|
||||
key,
|
||||
(seen == null ? <T>{start} : Set<T>.from(seen))..add(key),
|
||||
<T>{
|
||||
if (seen == null) start else ...seen,
|
||||
key,
|
||||
},
|
||||
);
|
||||
if (result != null) {
|
||||
result.insert(0, start);
|
||||
|
||||
@@ -381,14 +381,14 @@ class ArchiveCreator {
|
||||
|
||||
Future<String> _runFlutter(List<String> args, {Directory workingDirectory}) {
|
||||
return _processRunner.runProcess(
|
||||
<String>[_flutter]..addAll(args),
|
||||
<String>[_flutter, ...args],
|
||||
workingDirectory: workingDirectory ?? flutterRoot,
|
||||
);
|
||||
}
|
||||
|
||||
Future<String> _runGit(List<String> args, {Directory workingDirectory}) {
|
||||
return _processRunner.runProcess(
|
||||
<String>['git']..addAll(args),
|
||||
<String>['git', ...args],
|
||||
workingDirectory: workingDirectory ?? flutterRoot,
|
||||
);
|
||||
}
|
||||
@@ -574,14 +574,14 @@ class ArchivePublisher {
|
||||
}) async {
|
||||
if (platform.isWindows) {
|
||||
return _processRunner.runProcess(
|
||||
<String>['python', path.join(platform.environment['DEPOT_TOOLS'], 'gsutil.py'), '--']..addAll(args),
|
||||
<String>['python', path.join(platform.environment['DEPOT_TOOLS'], 'gsutil.py'), '--', ...args],
|
||||
workingDirectory: workingDirectory,
|
||||
failOk: failOk,
|
||||
);
|
||||
}
|
||||
|
||||
return _processRunner.runProcess(
|
||||
<String>['gsutil.py', '--']..addAll(args),
|
||||
<String>['gsutil.py', '--', ...args],
|
||||
workingDirectory: workingDirectory,
|
||||
failOk: failOk,
|
||||
);
|
||||
|
||||
@@ -3,7 +3,7 @@ description: Scripts which run on bots.
|
||||
|
||||
environment:
|
||||
# The pub client defaults to an <2.0.0 sdk constraint which we need to explicitly overwrite.
|
||||
sdk: ">=2.2.0 <3.0.0"
|
||||
sdk: ">=2.2.2 <3.0.0"
|
||||
|
||||
dependencies:
|
||||
path: 1.6.2
|
||||
|
||||
@@ -220,7 +220,7 @@ Future<void> _runToolCoverage() async {
|
||||
final List<String> testGroup = tests[i];
|
||||
await runCommand(
|
||||
dart,
|
||||
<String>[path.join('tool', 'tool_coverage.dart'), '--']..addAll(testGroup),
|
||||
<String>[path.join('tool', 'tool_coverage.dart'), '--', ...testGroup],
|
||||
workingDirectory: toolRoot,
|
||||
environment: <String, String>{
|
||||
'FLUTTER_ROOT': flutterRoot,
|
||||
@@ -791,7 +791,7 @@ Future<void> _runFlutterTest(String workingDirectory, {
|
||||
Map<String, String> environment,
|
||||
List<String> tests = const <String>[],
|
||||
}) async {
|
||||
final List<String> args = <String>['test']..addAll(options);
|
||||
final List<String> args = <String>['test', ...options];
|
||||
if (flutterTestArgs != null && flutterTestArgs.isNotEmpty)
|
||||
args.addAll(flutterTestArgs);
|
||||
|
||||
|
||||
@@ -35,8 +35,7 @@ class FakeProcessManager extends Mock implements ProcessManager {
|
||||
set fakeResults(Map<String, List<ProcessResult>> value) {
|
||||
_fakeResults = <String, List<ProcessResult>>{};
|
||||
for (String key in value.keys) {
|
||||
_fakeResults[key] = <ProcessResult>[]
|
||||
..addAll(value[key] ?? <ProcessResult>[ProcessResult(0, 0, '', '')]);
|
||||
_fakeResults[key] = (value[key] ?? <ProcessResult>[ProcessResult(0, 0, '', '')]).toList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -334,7 +334,7 @@ class ArchiveUnpublisher {
|
||||
bool failOk = false,
|
||||
bool confirm = false,
|
||||
}) async {
|
||||
final List<String> command = <String>['gsutil', '--']..addAll(args);
|
||||
final List<String> command = <String>['gsutil', '--', ...args];
|
||||
if (confirm) {
|
||||
return _processRunner.runProcess(
|
||||
command,
|
||||
@@ -358,7 +358,7 @@ class ArchiveUnpublisher {
|
||||
print(' $file');
|
||||
}
|
||||
}
|
||||
await _runGsUtil(<String>['rm']..addAll(files), failOk: true, confirm: confirmed);
|
||||
await _runGsUtil(<String>['rm', ...files], failOk: true, confirm: confirmed);
|
||||
}
|
||||
|
||||
Future<String> _cloudReplaceDest(String src, String dest) async {
|
||||
|
||||
Reference in New Issue
Block a user