Skip to content

Commit 2f0628f

Browse files
committed
chore: update SPDX licenses
1 parent 06daf69 commit 2f0628f

33 files changed

Lines changed: 1499 additions & 1497 deletions

lib/src/cli/cli.dart

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@ part 'git_cli.dart';
1919
const _asyncRunZoned = runZoned;
2020

2121
/// Type definition for [Process.run].
22-
typedef RunProcess = Future<ProcessResult> Function(
23-
String executable,
24-
List<String> arguments, {
25-
String? workingDirectory,
26-
bool runInShell,
27-
});
22+
typedef RunProcess =
23+
Future<ProcessResult> Function(
24+
String executable,
25+
List<String> arguments, {
26+
String? workingDirectory,
27+
bool runInShell,
28+
});
2829

2930
/// This class facilitates overriding [Process.run].
3031
/// It should be extended by another class in client code with overrides
@@ -47,10 +48,7 @@ abstract class ProcessOverrides {
4748
}
4849

4950
/// Runs [body] in a fresh [Zone] using the provided overrides.
50-
static R runZoned<R>(
51-
R Function() body, {
52-
RunProcess? runProcess,
53-
}) {
51+
static R runZoned<R>(R Function() body, {RunProcess? runProcess}) {
5452
final overrides = _ProcessOverridesScope(runProcess);
5553
return _asyncRunZoned(body, zoneValues: {_token: overrides});
5654
}

lib/src/cli/dart_cli.dart

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ part of 'cli.dart';
33
/// Dart CLI
44
class Dart {
55
/// Determine whether dart is installed.
6-
static Future<bool> installed({
7-
required Logger logger,
8-
}) async {
6+
static Future<bool> installed({required Logger logger}) async {
97
try {
108
await _Cmd.run('dart', ['--version'], logger: logger);
119
return true;
@@ -79,12 +77,13 @@ class Dart {
7977
}
8078

8179
final processes = _Cmd.runWhere(
82-
run: (entity) => _Cmd.run(
83-
'dart',
84-
['fix', '--apply'],
85-
workingDirectory: entity.parent.path,
86-
logger: logger,
87-
),
80+
run:
81+
(entity) => _Cmd.run(
82+
'dart',
83+
['fix', '--apply'],
84+
workingDirectory: entity.parent.path,
85+
logger: logger,
86+
),
8887
where: (entity) => !ignore.excludes(entity) && _isPubspec(entity),
8988
cwd: cwd,
9089
);

lib/src/cli/flutter_cli.dart

Lines changed: 52 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -79,22 +79,22 @@ class _CoverageMetrics {
7979
String? excludeFromCoverage,
8080
) {
8181
final glob = excludeFromCoverage != null ? Glob(excludeFromCoverage) : null;
82-
return records.fold<_CoverageMetrics>(
83-
const _CoverageMetrics._(),
84-
(current, record) {
85-
final found = record.lines?.found ?? 0;
86-
final hit = record.lines?.hit ?? 0;
87-
if (glob != null && record.file != null) {
88-
if (glob.matches(record.file!)) {
89-
return current;
90-
}
82+
return records.fold<_CoverageMetrics>(const _CoverageMetrics._(), (
83+
current,
84+
record,
85+
) {
86+
final found = record.lines?.found ?? 0;
87+
final hit = record.lines?.hit ?? 0;
88+
if (glob != null && record.file != null) {
89+
if (glob.matches(record.file!)) {
90+
return current;
9191
}
92-
return _CoverageMetrics._(
93-
totalFound: current.totalFound + found,
94-
totalHits: current.totalHits + hit,
95-
);
96-
},
97-
);
92+
}
93+
return _CoverageMetrics._(
94+
totalFound: current.totalFound + found,
95+
totalHits: current.totalHits + hit,
96+
);
97+
});
9898
}
9999

100100
final int totalHits;
@@ -105,22 +105,21 @@ class _CoverageMetrics {
105105

106106
/// Type definition for the [flutterTest] command
107107
/// from 'package:very_good_test_runner`.
108-
typedef FlutterTestRunner = Stream<TestEvent> Function({
109-
List<String>? arguments,
110-
String? workingDirectory,
111-
Map<String, String>? environment,
112-
bool runInShell,
113-
});
108+
typedef FlutterTestRunner =
109+
Stream<TestEvent> Function({
110+
List<String>? arguments,
111+
String? workingDirectory,
112+
Map<String, String>? environment,
113+
bool runInShell,
114+
});
114115

115116
/// A method which returns a [Future<MasonGenerator>] given a [MasonBundle].
116117
typedef GeneratorBuilder = Future<MasonGenerator> Function(MasonBundle);
117118

118119
/// Flutter CLI
119120
class Flutter {
120121
/// Determine whether flutter is installed.
121-
static Future<bool> installed({
122-
required Logger logger,
123-
}) async {
122+
static Future<bool> installed({required Logger logger}) async {
124123
try {
125124
await _Cmd.run('flutter', ['--version'], logger: logger);
126125
return true;
@@ -210,14 +209,10 @@ class Flutter {
210209
final path =
211210
relativePath == '.' ? '.' : '.${p.context.separator}$relativePath';
212211

213-
stdout?.call(
214-
'Running "flutter test" in $path ...\n',
215-
);
212+
stdout?.call('Running "flutter test" in $path ...\n');
216213

217214
if (!Directory(p.join(target.dir.absolute.path, 'test')).existsSync()) {
218-
stdout?.call(
219-
'No test folder found in $path\n',
220-
);
215+
stdout?.call('No test folder found in $path\n');
221216
return ExitCode.success.code;
222217
}
223218

@@ -312,22 +307,20 @@ Future<void> _verifyGitDependencies(
312307
final dependencies = pubspec.dependencies;
313308
final devDependencies = pubspec.devDependencies;
314309
final dependencyOverrides = pubspec.dependencyOverrides;
315-
final gitDependencies = [
316-
...dependencies.entries,
317-
...devDependencies.entries,
318-
...dependencyOverrides.entries,
319-
]
320-
.where((entry) => entry.value is GitDependency)
321-
.map((entry) => entry.value)
322-
.cast<GitDependency>()
323-
.toList();
310+
final gitDependencies =
311+
[
312+
...dependencies.entries,
313+
...devDependencies.entries,
314+
...dependencyOverrides.entries,
315+
]
316+
.where((entry) => entry.value is GitDependency)
317+
.map((entry) => entry.value)
318+
.cast<GitDependency>()
319+
.toList();
324320

325321
await Future.wait(
326322
gitDependencies.map(
327-
(dependency) => Git.reachable(
328-
dependency.url,
329-
logger: logger,
330-
),
323+
(dependency) => Git.reachable(dependency.url, logger: logger),
331324
),
332325
);
333326
}
@@ -376,7 +369,8 @@ Future<int> _flutterTest({
376369
final groups = <int, TestGroup>{};
377370
final tests = <int, Test>{};
378371
final failedTestErrorMessages = <String, List<String>>{};
379-
final sigintWatch = ProcessSignalOverrides.current?.sigintWatch ??
372+
final sigintWatch =
373+
ProcessSignalOverrides.current?.sigintWatch ??
380374
ProcessSignal.sigint.watch();
381375

382376
var successCount = 0;
@@ -395,13 +389,11 @@ Future<int> _flutterTest({
395389
final timerSubscription = Stream.periodic(
396390
const Duration(seconds: 1),
397391
(computationCount) => computationCount,
398-
).listen(
399-
(tick) {
400-
if (completer.isCompleted) return;
401-
final timeElapsed = Duration(seconds: tick).formatted();
402-
stdout('$clearLine$timeElapsed ...');
403-
},
404-
);
392+
).listen((tick) {
393+
if (completer.isCompleted) return;
394+
final timeElapsed = Duration(seconds: tick).formatted();
395+
stdout('$clearLine$timeElapsed ...');
396+
});
405397

406398
late final StreamSubscription<TestEvent> subscription;
407399
late final StreamSubscription<ProcessSignal> sigintWatchSubscription;
@@ -415,10 +407,7 @@ Future<int> _flutterTest({
415407

416408
subscription = testRunner(
417409
workingDirectory: cwd,
418-
arguments: [
419-
if (collectCoverage) '--coverage',
420-
...?arguments,
421-
],
410+
arguments: [if (collectCoverage) '--coverage', ...?arguments],
422411
runInShell: true,
423412
).listen(
424413
(event) {
@@ -506,17 +495,18 @@ Future<int> _flutterTest({
506495
final timeElapsed = Duration(milliseconds: event.time).formatted();
507496
final stats = computeStats();
508497
final truncatedTestName = testName.toSingleLine().truncated(
509-
_lineLength - (timeElapsed.length + stats.length + 2),
510-
);
498+
_lineLength - (timeElapsed.length + stats.length + 2),
499+
);
511500
stdout('''$clearLine$timeElapsed $stats: $truncatedTestName''');
512501
}
513502

514503
if (event is DoneTestEvent) {
515504
final timeElapsed = Duration(milliseconds: event.time).formatted();
516505
final stats = computeStats();
517-
final summary = event.success ?? false
518-
? lightGreen.wrap('All tests passed!')!
519-
: lightRed.wrap('Some tests failed.')!;
506+
final summary =
507+
event.success ?? false
508+
? lightGreen.wrap('All tests passed!')!
509+
: lightRed.wrap('Some tests failed.')!;
520510

521511
stdout('$clearLine${darkGray.wrap(timeElapsed)} $stats: $summary\n');
522512

@@ -570,9 +560,8 @@ String? _topGroupName(Test test, Map<int, TestGroup> groups) => test.groupIDs
570560
.map((groupID) => groups[groupID]?.name)
571561
.firstWhereOrNull((groupName) => groupName?.isNotEmpty ?? false);
572562

573-
Future<void> _cleanupOptimizerFile(String cwd) async => File(
574-
p.join(cwd, 'test', _testOptimizerFileName),
575-
).delete().ignore();
563+
Future<void> _cleanupOptimizerFile(String cwd) async =>
564+
File(p.join(cwd, 'test', _testOptimizerFileName)).delete().ignore();
576565

577566
final int _lineLength = () {
578567
try {

lib/src/cli/git_cli.dart

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,13 @@ Make sure the remote exists and you have the correct access rights.''';
2121
/// Git CLI
2222
class Git {
2323
/// Determine whether the [remote] is reachable.
24-
static Future<void> reachable(
25-
Uri remote, {
26-
required Logger logger,
27-
}) async {
24+
static Future<void> reachable(Uri remote, {required Logger logger}) async {
2825
try {
29-
await _Cmd.run(
30-
'git',
31-
['ls-remote', '$remote', '--exit-code'],
32-
logger: logger,
33-
);
26+
await _Cmd.run('git', [
27+
'ls-remote',
28+
'$remote',
29+
'--exit-code',
30+
], logger: logger);
3431
} catch (_) {
3532
throw UnreachableGitDependency(remote: remote);
3633
}

lib/src/command_runner.dart

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,12 @@ class VeryGoodCommandRunner extends CompletionCommandRunner<int> {
2222
Logger? logger,
2323
PubUpdater? pubUpdater,
2424
Map<String, String>? environment,
25-
}) : _logger = logger ?? Logger(),
26-
_pubUpdater = pubUpdater ?? PubUpdater(),
27-
_environment = environment ?? Platform.environment,
28-
super('very_good', '🦄 A Very Good Command-Line Interface') {
25+
}) : _logger = logger ?? Logger(),
26+
_pubUpdater = pubUpdater ?? PubUpdater(),
27+
_environment = environment ?? Platform.environment,
28+
super('very_good', '🦄 A Very Good Command-Line Interface') {
2929
argParser
30-
..addFlag(
31-
'version',
32-
negatable: false,
33-
help: 'Print the current version.',
34-
)
30+
..addFlag('version', negatable: false, help: 'Print the current version.')
3531
..addFlag(
3632
'verbose',
3733
help: 'Noisy logging, including all shell commands executed.',
@@ -139,31 +135,30 @@ class VeryGoodCommandRunner extends CompletionCommandRunner<int> {
139135
if (!isUpToDate) {
140136
_logger
141137
..info('')
142-
..info(
143-
'''
138+
..info('''
144139
${lightYellow.wrap('Update available!')} ${lightCyan.wrap(packageVersion)} \u2192 ${lightCyan.wrap(latestVersion)}
145140
${lightYellow.wrap('Changelog:')} ${lightCyan.wrap('https://github.com/verygoodopensource/very_good_cli/releases/tag/v$latestVersion')}
146-
Run ${lightCyan.wrap('very_good update')} to update''',
147-
);
141+
Run ${lightCyan.wrap('very_good update')} to update''');
148142
}
149143
} catch (_) {}
150144
}
151145

152146
void _showThankYou() {
153147
if (environment.containsKey('CI')) return;
154148

155-
final versionFile = File(
156-
path.join(_configDir.path, 'version'),
157-
)..createSync(recursive: true);
149+
final versionFile = File(path.join(_configDir.path, 'version'))
150+
..createSync(recursive: true);
158151

159152
if (versionFile.readAsStringSync() == packageVersion) return;
160153
versionFile.writeAsStringSync(packageVersion);
161154

162155
_logger.wrap(
163-
lightMagenta.wrap('''
156+
lightMagenta.wrap(
157+
'''
164158
165159
Thank you for using Very Good Ventures open source tools!
166-
Don't forget to fill out this form to get information on future updates and releases here: ${lightBlue.wrap(link(uri: Uri.parse('https://verygood.ventures/dev/tools/cli/subscribe')))}'''),
160+
Don't forget to fill out this form to get information on future updates and releases here: ${lightBlue.wrap(link(uri: Uri.parse('https://verygood.ventures/dev/tools/cli/subscribe')))}''',
161+
),
167162
print: _logger.info,
168163
);
169164
}

lib/src/commands/create/commands/create_subcommand.dart

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ abstract class CreateSubCommand extends Command<int> {
5151
required this.logger,
5252
@visibleForTesting required MasonGeneratorFromBundle? generatorFromBundle,
5353
@visibleForTesting required MasonGeneratorFromBrick? generatorFromBrick,
54-
}) : _generatorFromBundle = generatorFromBundle ?? MasonGenerator.fromBundle,
55-
_generatorFromBrick = generatorFromBrick ?? MasonGenerator.fromBrick {
54+
}) : _generatorFromBundle = generatorFromBundle ?? MasonGenerator.fromBundle,
55+
_generatorFromBrick = generatorFromBrick ?? MasonGenerator.fromBrick {
5656
argParser
5757
..addOption(
5858
'output-directory',
@@ -293,9 +293,7 @@ mixin MultiTemplates on CreateSubCommand {
293293
final templateName =
294294
argResults['template'] as String? ?? defaultTemplateName;
295295

296-
return templates.firstWhere(
297-
(element) => element.name == templateName,
298-
);
296+
return templates.firstWhere((element) => element.name == templateName);
299297
}
300298
}
301299

lib/src/commands/create/commands/flutter_app.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ class CreateFlutterApp extends CreateSubCommand with OrgName, MultiTemplates {
1313
}) {
1414
argParser.addOption(
1515
'application-id',
16-
help: 'The bundle identifier on iOS or application id on Android. '
16+
help:
17+
'The bundle identifier on iOS or application id on Android. '
1718
'(defaults to <org-name>.<project-name>)',
1819
);
1920
}

lib/src/commands/create/commands/flutter_plugin.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ class CreateFlutterPlugin extends CreateSubCommand with Publishable, OrgName {
1313
}) {
1414
argParser.addMultiOption(
1515
'platforms',
16-
help: 'The platforms supported by the plugin. By default, all platforms '
16+
help:
17+
'The platforms supported by the plugin. By default, all platforms '
1718
'are enabled. Example: --platforms=android,ios',
1819
defaultsTo: ['android', 'ios', 'web', 'linux', 'macos', 'windows'],
1920
allowed: ['android', 'ios', 'web', 'linux', 'macos', 'windows'],

0 commit comments

Comments
 (0)