Skip to content

fix: check licenses fails when project has "direct overridden" dependencies #901

@mvolpato

Description

@mvolpato

Description
When running very_good packages check licenses on a project whose pubspec.lock has "direct overridden" dependencies, the command fails with "Null check operator used on a null value".

Tested with very_good --version 0.18.0.

Steps To Reproduce

  1. Set a project with overridden dependencies;
  2. Run very_good packages check licenses;

Expected Behavior
A report on licenses for the project.

Actual Behaviour

Null check operator used on a null value
#0      StringToDependencyType.parseDependencyType (package:pubspec_lock/src/package_dependency/dependency_type/serializers.dart:31:67)
#1      loadPathPackageDependency (package:pubspec_lock/src/package_dependency/path_package_dependency/serializers.dart:42:54)
#2      loadPackageDependency (package:pubspec_lock/src/package_dependency/serializers.dart:45:35)
#3      MappedIterator.moveNext (dart:_internal/iterable.dart:403:20)
#4      WhereIterator.moveNext (dart:_internal/iterable.dart:450:22)
#5      Iterable.length (dart:core/iterable.dart:524:15)
#6      PackagesCheckLicensesCommand.run (package:very_good_cli/src/commands/packages/commands/check/commands/licenses.dart:221:90)
<asynchronous suspension>
#7      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#8      VeryGoodCommandRunner.runCommand (package:very_good_cli/src/command_runner.dart:126:18)
<asynchronous suspension>
#9      VeryGoodCommandRunner.run (package:very_good_cli/src/command_runner.dart:72:14)
<asynchronous suspension>
#10     main (file:///Users/michele/.pub-cache/hosted/pub.dev/very_good_cli-0.18.0/bin/very_good.dart:5:24)
<asynchronous suspension>

Additional Context
I removed all the "direct overridden" entries in my pubspec.lock and the command run successfully.

I think the issue might be fixed when a new version of pubspec_lock is released, see alexei-sintotski/pubspec_lock#33. This issue has a PR that solves it.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working as expectedexternal dependencyRequires changes in an external dependency

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions