Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
mvolpato opened this issue Dec 1, 2023 · 4 comments · Fixed by #930
Closed

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

mvolpato opened this issue Dec 1, 2023 · 4 comments · Fixed by #930
Assignees
Labels
bug Something isn't working as expected external dependency Requires changes in an external dependency

Comments

@mvolpato
Copy link

mvolpato commented Dec 1, 2023

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.

@mvolpato mvolpato added the bug Something isn't working as expected label Dec 1, 2023
@alestiago
Copy link
Contributor

alestiago commented Dec 1, 2023

Hi @mvolpato ! Thanks for opening an issue and letting us know 💙

I did manage to get this to reproduce. However, only when I specified a dependency_override of a dependency that was not in dependencies.

For example, the following doesn't throw:

Valid dependency override
name: foo

environment:
  sdk: ">=3.0.0 <4.0.0"

dependencies:
  postgrest_errors:
    path: ../foo2

dependency_overrides:
  postgrest_errors: ^0.1.0

Whereas, the following does:

Invalid usage of dependency override
name: foo

environment:
  sdk: ">=3.0.0 <4.0.0"

# dependencies:
#   postgrest_errors:
#     path: ../foo2

dependency_overrides:
  postgrest_errors: ^0.1.0

Can you try ensuring those dependencies in your dependency_overrides also have an occurrence in dependencies and report back your results?

@alestiago alestiago added waiting for response Waiting for follow up external dependency Requires changes in an external dependency labels Dec 1, 2023
@alestiago alestiago moved this from Needs Triage to Community in VGV Open Source 🦄 🧙🌟 Dec 1, 2023
@alestiago alestiago moved this from Community to Needs Triage in VGV Open Source 🦄 🧙🌟 Dec 1, 2023
@mvolpato
Copy link
Author

mvolpato commented Dec 1, 2023

Hi @alestiago, all my overrides are path dependencies managed with melos. We do not set specific dependency_overrides: in any pubspec.yaml file.

@alestiago alestiago removed the waiting for response Waiting for follow up label Dec 1, 2023
@BeatriceMitchell BeatriceMitchell moved this from Needs Triage to Backlog in VGV Open Source 🦄 🧙🌟 Dec 4, 2023
@md-weber
Copy link

I can confirm this issue when using melos and local packages. Working on Version 0.19.0.
Interestingly the packages the main app depends on runs smooth. All other apps that depend on the packages fail.

@alestiago
Copy link
Contributor

alestiago commented Dec 19, 2023

This should be fixed in the next release, to keep an eye on the latest releases refer to the Very Good CLI Releases page.


Edit: 0.19.1 is out and should fix this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as expected external dependency Requires changes in an external dependency
Projects
Development

Successfully merging a pull request may close this issue.

3 participants