Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/DemaConsulting.SpdxTool/Commands/AddPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public static void Add(SpdxDocument doc, SpdxPackage package)
{
// Copy the new package
p = package.DeepCopy();
doc.Packages = doc.Packages.Append(p).ToArray();
doc.Packages = [..doc.Packages.Append(p)];
}
}

Expand Down Expand Up @@ -232,24 +232,24 @@ public static SpdxPackage ParsePackage(string command, YamlMappingNode packageMa
// Append the PURL if specified
var purl = GetMapString(packageMap, "purl", variables);
if (!string.IsNullOrEmpty(purl))
package.ExternalReferences = package.ExternalReferences.Append(
package.ExternalReferences = [..package.ExternalReferences.Append(
new SpdxExternalReference
{
Category = SpdxReferenceCategory.PackageManager,
Type = "purl",
Locator = purl
}).ToArray();
})];

// Append the CPE23 if specified
var cpe23 = GetMapString(packageMap, "cpe23", variables);
if (!string.IsNullOrEmpty(cpe23))
package.ExternalReferences = package.ExternalReferences.Append(
package.ExternalReferences = [..package.ExternalReferences.Append(
new SpdxExternalReference
{
Category = SpdxReferenceCategory.Security,
Type = "cpe23Type",
Locator = cpe23
}).ToArray();
})];

// Return the package
return package;
Expand Down
6 changes: 3 additions & 3 deletions src/DemaConsulting.SpdxTool/Commands/CopyPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public static void Copy(SpdxDocument fromDoc, SpdxDocument toDoc, string package
toPackage = fromPackage.DeepCopy();
toPackage.FilesAnalyzed = false;
toPackage.HasFiles = [];
toDoc.Packages = toDoc.Packages.Append(toPackage).ToArray();
toDoc.Packages = [..toDoc.Packages.Append(toPackage)];
}

// Skip if we don't need to copy files
Expand Down Expand Up @@ -255,12 +255,12 @@ public static void Copy(SpdxDocument fromDoc, SpdxDocument toDoc, string package
{
// Append copy to the to-document
toFile = fromFile.DeepCopy();
toDoc.Files = toDoc.Files.Append(toFile).ToArray();
toDoc.Files = [..toDoc.Files.Append(toFile)];
}
}

// Add the new files
toPackage.HasFiles = toPackage.HasFiles.Concat(newFiles).ToArray();
toPackage.HasFiles = [..toPackage.HasFiles.Concat(newFiles)];
}

/// <summary>
Expand Down
12 changes: 4 additions & 8 deletions src/DemaConsulting.SpdxTool/Commands/Diagram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,11 @@ public override void Run(string[] args)
var tools = false;
foreach (var option in args.Skip(2))
{
switch (option)
tools = option switch
{
case "tools":
tools = true;
break;

default:
throw new CommandUsageException($"'diagram' command invalid option {option}");
}
"tools" => true,
_ => throw new CommandUsageException($"'diagram' command invalid option {option}")
};
}

// Generate the diagram
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="MSTest.TestAdapter" Version="3.6.0" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.6.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.1" />
</ItemGroup>

<ItemGroup>
Expand Down