fossas / fossa-cli

Fast, portable and reliable dependency analysis for any codebase. Supports license & vulnerability scanning for large monoliths. Language-agnostic; integrates with 20+ build systems.
https://fossa.com
Other
1.29k stars 173 forks source link

NuGet strategy consolidation #1461

Open JeffreyHuynh1 opened 3 months ago

JeffreyHuynh1 commented 3 months ago

Overview

All of the CLI’s nuget strategies run everytime fossa analyze is run. This causes duplicate information to be uploaded on almost every run. The worst part of this is that one of the strategies analyzes a lockfile with determined versions and the other analyzes a manifest with versions that may not be present in the final build.

From Nugets website

The project.json file maintains a list of packages used in a project, known as a package management format. It supersedes packages.config but is in turn superseded by PackageReference with NuGet 4.0+.

https://fossa.com/blog/managing-dependencies-net-csproj-packagesconfig/

Acceptance criteria

Documentation is updated to display what the fallback order is.

Testing plan

Risks

[Question] - Was looking into writing an integration test to test the case where we have both .csproj files (triggers PackageReference strategy) and project.assets.json files, that way we can test out the consolidation changes in this pr. After looking at our integration tests, it looks like we test against open source repos , the issue with project.assets.json files is that they are not typically included in open source repos as they are generated automatically by the .NET SDK during the restore process. We also didn't have an existing integration test for the project.assets.json strategy either. I feel like we should still have a test for this but am unsure on the best way to go about it. Should I just clone a repo, generate a project.assets.json file and push those changes to a new repo so that we can test against for our tests?

Metrics

References

Checklist