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

Support NuGet lockfiles (Updated) #9678

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

na1307
Copy link
Contributor

@na1307 na1307 commented May 6, 2024

Fix #1303

Since #6031 was last updated, Dependabot NuGet logic has been rewritten as C#, so I've put this PR up.

I'm familiar with C#, but not with Ruby. I don't know how to add a test for this. Any advice is welcome.

@na1307 na1307 requested review from a team as code owners May 6, 2024 08:46
@github-actions github-actions bot added the L: dotnet:nuget NuGet packages via nuget or dotnet label May 6, 2024
@mheguy-flo
Copy link

mheguy-flo commented May 27, 2024

The linting failure for fetch_files is because your changes pushed the complexity over the limit.
You should be able to replace this block:

        fetched_files = []
        fetched_files += project_files
        fetched_files += directory_build_files
        fetched_files += imported_property_files

        fetched_files += packages_config_files
        fetched_files += nuget_config_files
        fetched_files += packages_lock_files
        fetched_files << global_json if global_json
        fetched_files << dotnet_tools_json if dotnet_tools_json
        fetched_files << packages_props if packages_props

with this:

  fetched_files = [
    *project_files,
    *directory_build_files,
    *imported_property_files,
    *packages_config_files,
    *nuget_config_files,
    *packages_lock_files,
    global_json,
    dotnet_tools_json,
    packages_props
  ].compact

and that should reduce the complexity.
We use the splat operator * instead of appending to a list.
And we call compact to remove nils instead of checking individually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L: dotnet:nuget NuGet packages via nuget or dotnet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for NuGet package lock files
2 participants