Skip to content

Fix NuGet packages.lock.json parsing for Project and CentralTransitive types#5107

Open
marcoberger wants to merge 1 commit into
aboutcode-org:developfrom
SecuraPoint:fix-exception-on-nuget-dependency-types
Open

Fix NuGet packages.lock.json parsing for Project and CentralTransitive types#5107
marcoberger wants to merge 1 commit into
aboutcode-org:developfrom
SecuraPoint:fix-exception-on-nuget-dependency-types

Conversation

@marcoberger
Copy link
Copy Markdown

Summary

This fixes parsing of NuGet packages.lock.json files that contain dependency
entries with the Project or CentralTransitive type.

NuGet lockfiles can contain these dependency types in addition to Direct and
Transitive. Before this change, the parser raised an exception for any type
other than Direct or Transitive, which caused parsing to abort and prevented
packages from being reported.

The updated behavior is:

  • Direct entries are reported as direct dependencies.
  • Transitive entries are reported as transitive dependencies.
  • CentralTransitive entries are reported as transitive dependencies.
  • Project entries are skipped because they are project references, not NuGet
    package dependencies.

Tests

Added a unit test covering a NuGet packages.lock.json file with Direct,
Transitive, CentralTransitive, and Project entries.

Fixes #5106

Tasks

  • Reviewed contribution guidelines
  • PR is descriptively titled 📑 and links the original issue above 🔗
  • Tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR
    Run tests locally to check for errors.
  • Commits are in uniquely-named feature branch and has no merge conflicts 📁
  • Updated documentation pages (if applicable)
  • Updated CHANGELOG.rst (if applicable)

Support NuGet packages.lock.json files with Project and
CentralTransitive dependency entries.

* Skip Project entries because they are project references, not NuGet
  package dependencies.
* Treat CentralTransitive entries as transitive package dependencies.

This prevents parsing from aborting for lockfiles generated by projects
using project references and Central Package Management.

Signed-off-by: Marco Berger <marco@biberei.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NuGet packages.lock.json parser fails on Project and CentralTransitive dependency types

1 participant