Skip to content

Commit 5acb9d2

Browse files
committed
fix: license check should exit 0 when no dependencies found
1 parent 06daf69 commit 5acb9d2

File tree

3 files changed

+31
-31
lines changed

3 files changed

+31
-31
lines changed

lib/src/commands/packages/commands/check/commands/licenses.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,10 @@ class PackagesCheckLicensesCommand extends Command<int> {
202202

203203
if (filteredDependencies.isEmpty) {
204204
progress.cancel();
205-
_logger.err(
205+
_logger.info(
206206
'''No hosted dependencies found in $targetPath of type: ${dependencyTypes.stringify()}.''',
207207
);
208-
return ExitCode.usage.code;
208+
return ExitCode.success.code;
209209
}
210210

211211
final packageConfig = await _tryFindPackageConfig(targetDirectory);

test/src/commands/create/commands/flutter_plugin_test.dart

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,27 @@ class _FakeDirectoryGeneratorTarget extends Fake
2525
implements DirectoryGeneratorTarget {}
2626

2727
final expectedUsage = [
28-
'''
29-
Generate a Very Good Flutter plugin.
30-
31-
Usage: very_good create flutter_plugin <project-name> [arguments]
32-
-h, --help Print this usage information.
33-
-o, --output-directory The desired output directory when creating a new project.
34-
--description The description for this new project.
35-
(defaults to "A Very Good Project created by Very Good CLI.")
36-
--org-name The organization for this new project.
37-
(defaults to "com.example.verygoodcore")
38-
--publishable Whether the generated project is intended to be published.
39-
--platforms The platforms supported by the plugin. By default, all platforms are enabled. Example: --platforms=android,ios
40-
41-
[android] (default) The plugin supports the Android platform.
42-
[ios] (default) The plugin supports the iOS platform.
43-
[linux] (default) The plugin supports the Linux platform.
44-
[macos] (default) The plugin supports the macOS platform.
45-
[web] (default) The plugin supports the Web platform.
46-
[windows] (default) The plugin supports the Windows platform.
47-
48-
Run "very_good help" to see global options.''',
28+
// ignore: no_adjacent_strings_in_list
29+
'Generate a Very Good Flutter plugin.\n'
30+
'\n'
31+
'Usage: very_good create flutter_plugin <project-name> [arguments]\n'
32+
'-h, --help Print this usage information.\n'
33+
'''-o, --output-directory The desired output directory when creating a new project.\n'''
34+
' --description The description for this new project.\n'
35+
''' (defaults to "A Very Good Project created by Very Good CLI.")\n'''
36+
''' --org-name The organization for this new project.\n'''
37+
''' (defaults to "com.example.verygoodcore")\n'''
38+
''' --publishable Whether the generated project is intended to be published.\n'''
39+
''' --platforms The platforms supported by the plugin. By default, all platforms are enabled. Example: --platforms=android,ios\n'''
40+
'\n'
41+
''' [android] (default) The plugin supports the Android platform.\n'''
42+
' [ios] (default) The plugin supports the iOS platform.\n'
43+
' [web] (default) The plugin supports the Web platform.\n'
44+
''' [linux] (default) The plugin supports the Linux platform.\n'''
45+
''' [macos] (default) The plugin supports the macOS platform.\n'''
46+
''' [windows] (default) The plugin supports the Windows platform.\n'''
47+
'\n'
48+
'Run "very_good help" to see global options.'
4949
];
5050

5151
const pubspec = '''

test/src/commands/packages/commands/check/commands/licenses_test.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ const _expectedPackagesCheckLicensesUsage = [
3636
''' --ignore-retrieval-failures Disregard licenses that failed to be retrieved.\n'''
3737
''' --dependency-type The type of dependencies to check licenses for.\n'''
3838
'\n'
39-
''' [direct-dev] Check for direct dev dependencies.\n'''
4039
''' [direct-main] (default) Check for direct main dependencies.\n'''
41-
''' [direct-overridden] Check for direct overridden dependencies.\n'''
40+
''' [direct-dev] Check for direct dev dependencies.\n'''
4241
''' [transitive] Check for transitive dependencies.\n'''
42+
''' [direct-overridden] Check for direct overridden dependencies.\n'''
4343
'\n'
4444
''' --allowed Only allow the use of certain licenses.\n'''
4545
' --forbidden Deny the use of certain licenses.\n'
@@ -1384,13 +1384,13 @@ void main() {
13841384
],
13851385
);
13861386

1387-
final errorMessage =
1387+
final expectedMessage =
13881388
'''No hosted dependencies found in ${tempDirectory.path} of type: direct-main.''';
1389-
verify(() => logger.err(errorMessage)).called(1);
1389+
verify(() => logger.info(expectedMessage)).called(1);
13901390

13911391
verify(() => progress.cancel()).called(1);
13921392

1393-
expect(result, equals(ExitCode.usage.code));
1393+
expect(result, equals(ExitCode.success.code));
13941394
}),
13951395
);
13961396
});
@@ -1466,13 +1466,13 @@ void main() {
14661466
[...commandArguments, tempDirectory.path],
14671467
);
14681468

1469-
final errorMessage =
1469+
final expectedMessage =
14701470
'''No hosted dependencies found in ${tempDirectory.path} of type: direct-main.''';
1471-
verify(() => logger.err(errorMessage)).called(1);
1471+
verify(() => logger.info(expectedMessage)).called(1);
14721472

14731473
verify(() => progress.cancel()).called(1);
14741474

1475-
expect(result, equals(ExitCode.usage.code));
1475+
expect(result, equals(ExitCode.success.code));
14761476
}),
14771477
);
14781478

0 commit comments

Comments
 (0)