Repository: VeryGoodOpenSource/very_good_cli (dart)

Issue:
fix: license check should not treat lack of dependencies as an error
### Description

If the license checker is run on a package with no direct dependencies it exits with a non-zero exit code (treated as an error). This is not correct behavior imo because if a package has no direct dependencies it should still be considered as passing the license check.

### Steps To Reproduce

1. Create a package with a single internal path dependency
2. Run the license check command
3. Observe the error: `No hosted dependencies found in ./path/to/package of type: direct-main.`

### Expected Behavior

I'd expect the case with no dependencies that match the type to be considered passing since no dependencies means the package isn't violating any licensing rules.

### Additional Context

_No response_

Pull request:
<!--
  Thanks for contributing!
  Provide a description of your changes below and a general summary in the title
  Please look at the following checklist to ensure that your PR can be accepted quickly:
-->

## Status

**READY**

## Description

<!--- Describe your changes in detail -->
- fix: license check should exit 0 when no dependencies found (closes #1260)

## Type of Change

<!--- Put an `x` in all the boxes that apply: -->

- [ ] ✨ New feature (non-breaking change which adds functionality)
- [X] 🛠️ Bug fix (non-breaking change which fixes an issue)
- [ ] ❌ Breaking change (fix or feature that would cause existing functionality to change)
- [ ] 🧹 Code refactor
- [ ] ✅ Build configuration change
- [ ] 📝 Documentation
- [ ] 🗑️ Chore


<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **Bug Fixes**
	- Improved behavior when no hosted dependencies are detected by logging an informational message and returning a success exit code.
- **Tests**
	- Updated test expectations to reflect the adjusted logging, exit status, and command-line usage message order.
	- Enhanced usage string formatting for better readability in test outputs.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Patch:
diff --git a/lib/src/commands/packages/commands/check/commands/licenses.dart b/lib/src/commands/packages/commands/check/commands/licenses.dart
index 721a8934c..50b6d0a15 100644
--- a/lib/src/commands/packages/commands/check/commands/licenses.dart
+++ b/lib/src/commands/packages/commands/check/commands/licenses.dart
@@ -203,10 +203,10 @@ class PackagesCheckLicensesCommand extends Command<int> {
 
     if (filteredDependencies.isEmpty) {
       progress.cancel();
-      _logger.err(
+      _logger.info(
         '''No hosted dependencies found in $targetPath of type: ${dependencyTypes.stringify()}.''',
       );
-      return ExitCode.usage.code;
+      return ExitCode.success.code;
     }
 
     final packageConfig = await _tryFindPackageConfig(targetDirectory);


Test patch:
diff --git a/test/src/commands/packages/commands/check/commands/licenses_test.dart b/test/src/commands/packages/commands/check/commands/licenses_test.dart
index 9a0347089..543dbe128 100644
--- a/test/src/commands/packages/commands/check/commands/licenses_test.dart
+++ b/test/src/commands/packages/commands/check/commands/licenses_test.dart
@@ -1428,13 +1428,13 @@ void main() {
               ],
             );
 
-            final errorMessage =
+            final expectedMessage =
                 '''No hosted dependencies found in ${tempDirectory.path} of type: direct-main.''';
-            verify(() => logger.err(errorMessage)).called(1);
+            verify(() => logger.info(expectedMessage)).called(1);
 
             verify(() => progress.cancel()).called(1);
 
-            expect(result, equals(ExitCode.usage.code));
+            expect(result, equals(ExitCode.success.code));
           }),
         );
       });
@@ -1512,13 +1512,13 @@ void main() {
             [...commandArguments, tempDirectory.path],
           );
 
-          final errorMessage =
+          final expectedMessage =
               '''No hosted dependencies found in ${tempDirectory.path} of type: direct-main.''';
-          verify(() => logger.err(errorMessage)).called(1);
+          verify(() => logger.info(expectedMessage)).called(1);
 
           verify(() => progress.cancel()).called(1);
 
-          expect(result, equals(ExitCode.usage.code));
+          expect(result, equals(ExitCode.success.code));
         }),
       );