Skip to content

Commit

Permalink
cleanup test
Browse files Browse the repository at this point in the history
  • Loading branch information
Nigusu-Allehu committed Feb 5, 2025
1 parent c04b00f commit 0900223
Show file tree
Hide file tree
Showing 7 changed files with 5,572 additions and 253 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ internal class ListPackageArgs
public bool HighestPatch { get; }
public bool HighestMinor { get; }
public CancellationToken CancellationToken { get; }
public List<PackageSource> AuditSources { get; }
public IReadOnlyList<PackageSource> AuditSources { get; }

/// <summary>
/// A constructor for the arguments of list package
Expand Down Expand Up @@ -55,7 +55,7 @@ public ListPackageArgs(
bool prerelease,
bool highestPatch,
bool highestMinor,
List<PackageSource> auditSources,
IReadOnlyList<PackageSource> auditSources,
ILogger logger,
CancellationToken cancellationToken)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public static void Register(
prerelease.HasValue(),
highestPatch.HasValue(),
highestMinor.HasValue(),
provider.LoadAuditSources().ToList(),
provider.LoadAuditSources(),
logger,
CancellationToken.None);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ private async Task GetProjectMetadataAsync(
var projectName = project.GetPropertyValue(ProjectName);
ListPackageProjectModel projectModel = listPackageReportModel.CreateProjectReportData(projectPath: projectPath, projectName);

if (!IsProjectPackageReference(project, projectModel, projectPath))
if (!MSBuildAPIUtility.IsPackageReferenceProject(project))
{
projectModel.AddProjectInformation(problemType: ProblemType.Error,
string.Format(CultureInfo.CurrentCulture, Strings.Error_NotPRProject, projectPath));
return;
}

Expand Down Expand Up @@ -157,7 +159,7 @@ private static async Task GetVulnerabilitiesFromAuditSourcesAsync(
ListPackageProjectModel projectModel,
List<FrameworkPackages> frameworks)
{
var vulnerabilities = await GetVulnerabilityData(
List<IReadOnlyDictionary<string, IReadOnlyList<PackageVulnerabilityInfo>>> vulnerabilities = await GetVulnerabilityData(
projectModel,
listPackageReportModel,
listPackageArgs.AuditSources,
Expand Down Expand Up @@ -235,18 +237,6 @@ private static bool IsProjectAssetsFileValid(string assetsPath, string projectPa
}
}

private static bool IsProjectPackageReference(Project project, ListPackageProjectModel projectModel, string projectPath)
{
if (!MSBuildAPIUtility.IsPackageReferenceProject(project))
{
projectModel.AddProjectInformation(problemType: ProblemType.Error,
string.Format(CultureInfo.CurrentCulture, Strings.Error_NotPRProject, projectPath));
return false;
}

return true;
}

private static async Task<List<IReadOnlyDictionary<string, IReadOnlyList<PackageVulnerabilityInfo>>>> GetVulnerabilityData(
ListPackageProjectModel projectModel,
ListPackageReportModel reportModel,
Expand Down
Loading

0 comments on commit 0900223

Please sign in to comment.