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

return counts from RestoreTask for PackageReference projects #6049

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

zivkan
Copy link
Member

@zivkan zivkan commented Sep 24, 2024

Bug

Fixes: NuGet/Home#13778

Description

Add properties output properties RestoreProjectCount, RestoreSkippedCount, and RestoreProjectsAuditedCount to RestoreTask (non-static graph version). Static graph version will be implemented later, and including packages.config projects is waiting for customer feedback.

The tests demonstrate how to to fail a restore if NuGetAudit was not enabled for at least 1 project.

PR Checklist

@zivkan zivkan requested a review from a team as a code owner September 24, 2024 03:53
jeffkl
jeffkl previously approved these changes Sep 24, 2024
@@ -51,6 +51,9 @@ internal class AuditUtility
internal int DistinctAdvisoriesSuppressedCount { get; private set; }
internal int TotalWarningsSuppressedCount { get; private set; }

/// <inheritdoc cref="RestoreSummary.AuditRan"/>
internal bool AuditRan { get; private set; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just have CheckPackageVulnerabilitiesAsync() return Task<bool> and then save the value here to be returned. Just my vote

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, it's pretty much done that way anyways in the 3 places we return.

@@ -51,6 +51,9 @@ internal class AuditUtility
internal int DistinctAdvisoriesSuppressedCount { get; private set; }
internal int TotalWarningsSuppressedCount { get; private set; }

/// <inheritdoc cref="RestoreSummary.AuditRan"/>
internal bool AuditRan { get; private set; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, it's pretty much done that way anyways in the 3 places we return.

@@ -138,7 +138,8 @@ static bool HasProjectToRestore(DependencyGraphSpec dgSpec, bool restorePackages

try
{
bool result = await BuildTasksUtility.RestoreAsync(
// todo: need to return Restore task output properties, like in NuGet.targets
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO's need to be linked to issues.

Sorry I missed this in the first review.

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.

Detect if restore used NuGetAudit or not for PackageReference projects
3 participants