Skip to content

Commit

Permalink
fixing an instance error in NugetDevDependencyParser and the check fo…
Browse files Browse the repository at this point in the history
…r null in test case
  • Loading branch information
adityanarayanp committed Nov 9, 2023
1 parent c087efd commit fd4b61e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/LCT.Common/FileOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public Bom CombineComponentsFromExistingBOM(Bom components, string filePath)

comparisonData.Components = comparisonData.Components?.GroupBy(x => new { x.Name, x.Version }).Select(y => y.First()).ToList();

if (comparisonData.Dependencies.Count > 0)
if (comparisonData.Dependencies != null && comparisonData.Dependencies.Count > 0)
{
comparisonData.Dependencies.AddRange(components.Dependencies);
}
Expand Down
4 changes: 3 additions & 1 deletion src/LCT.PackageIdentifier/NugetDevDependencyParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ public static NugetDevDependencyParser Instance
}
}

public static List<Container> Parse(string configFile)
#pragma warning disable CA1822 // Mark members as static
public List<Container> Parse(string configFile)
#pragma warning restore CA1822 // Mark members as static
{
List<Container> containerList = new();

Expand Down
3 changes: 2 additions & 1 deletion src/LCT.PackageIdentifier/NugetProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,8 @@ private static string ReferenceTagDetailsForPackageReference(XmlNode childNode,

private static List<NugetPackage> ParseAssetFile(string configFile)
{
List<Container> containers = NugetDevDependencyParser.Parse(configFile);
NugetDevDependencyParser nugetDevDependencyParser = NugetDevDependencyParser.Instance;
List<Container> containers = nugetDevDependencyParser.Parse(configFile);
return ConvertContainerAsNugetPackage(containers, configFile);
}

Expand Down

0 comments on commit fd4b61e

Please sign in to comment.