Skip to content

Commit

Permalink
Fix #1584: Multitool Transform can't upgrade "http://json.schemastore…
Browse files Browse the repository at this point in the history
  • Loading branch information
Larry Golding authored Aug 19, 2019
1 parent 4f9e92c commit 439258b
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/ReleaseHistory.md
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@
* BUGFIX: Validation rule `SARIF1015` incorrectly required `originalUriBaseIds` to be contain URIs. https://github.com/microsoft/sarif-sdk/issues/1485
* BUGFIX: Multitool transform mishandled dottedQuadFileVersion. https://github.com/microsoft/sarif-sdk/issues/1532
* BUGFIX: Restore missing FxCop converter unit test. https://github.com/microsoft/sarif-sdk/issues/1575
* BUGFIX: Multitool transform could not upgrade SARIF files from the sarif-2.1.0-rtm.1 schema. https://github.com/microsoft/sarif-sdk/issues/1584
* BUGFIX: Multitool merge command produced invalid SARIF if there were 0 input files. https://github.com/microsoft/sarif-sdk/issues/1592
* BUGFIX: FortifyFpr converter produced invalid SARIF. https://github.com/microsoft/sarif-sdk/issues/1593
* BUGFIX: FxCop converter produced empty `result.message` objects. https://github.com/microsoft/sarif-sdk/issues/1594
Expand Down
5 changes: 5 additions & 0 deletions src/Sarif/Writers/PrereleaseCompatibilityTransformer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,18 @@ public static SarifLog UpdateToCurrentVersion(
goto case "http://json.schemastore.org/sarif-2.1.0-rtm.0";
}
case "http://json.schemastore.org/sarif-2.1.0-rtm.0":
case "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.0.json":
{
modifiedLog |= ApplyRtm1Changes(sarifLog);
goto case "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.4.json";
}
case "http://json.schemastore.org/sarif-2.1.0-rtm.4":
case "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.4.json":
case "http://json.schemastore.org/sarif-2.1.0-rtm.3":
case "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.3.json":
case "http://json.schemastore.org/sarif-2.1.0-rtm.2":
case "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.2.json":
case "http://json.schemastore.org/sarif-2.1.0-rtm.1":
case "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.1.json":
{
modifiedLog |= ApplyRtm2and3Changes(sarifLog);
Expand Down
4 changes: 4 additions & 0 deletions src/Test.UnitTests.Sarif/Test.UnitTests.Sarif.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<None Remove="TestData\PrereleaseCompatibilityTransformer\ExpectedOutputs\OneRunWithBasicInvocation.sarif" />
<None Remove="TestData\PrereleaseCompatibilityTransformer\ExpectedOutputs\OneRunWithInvocationExitCode.sarif" />
<None Remove="TestData\PrereleaseCompatibilityTransformer\ExpectedOutputs\OneRunWithRedactionToken.sarif" />
<None Remove="TestData\PrereleaseCompatibilityTransformer\ExpectedOutputs\Rtm1SchemaLocation.sarif" />
<None Remove="TestData\PrereleaseCompatibilityTransformer\ExpectedOutputs\RunResources.sarif" />
<None Remove="TestData\PrereleaseCompatibilityTransformer\ExpectedOutputs\ThreadFlowLocationWithKind.sarif" />
<None Remove="TestData\PrereleaseCompatibilityTransformer\ExpectedOutputs\ToolWithLanguage.sarif" />
Expand All @@ -44,6 +45,7 @@
<None Remove="TestData\PrereleaseCompatibilityTransformer\Inputs\OneRunWithBasicInvocation.sarif" />
<None Remove="TestData\PrereleaseCompatibilityTransformer\Inputs\OneRunWithInvocationExitCode.sarif" />
<None Remove="TestData\PrereleaseCompatibilityTransformer\Inputs\OneRunWithRedactionToken.sarif" />
<None Remove="TestData\PrereleaseCompatibilityTransformer\Inputs\Rtm1SchemaLocation.sarif" />
<None Remove="TestData\PrereleaseCompatibilityTransformer\Inputs\RunResources.sarif" />
<None Remove="TestData\PrereleaseCompatibilityTransformer\Inputs\ThreadFlowLocationWithKind.sarif" />
<None Remove="TestData\PrereleaseCompatibilityTransformer\Inputs\ToolWithLanguage.sarif" />
Expand Down Expand Up @@ -77,6 +79,8 @@
<EmbeddedResource Include="TestData\Map\Sample.json">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="TestData\PrereleaseCompatibilityTransformer\ExpectedOutputs\Rtm1SchemaLocation.sarif" />
<EmbeddedResource Include="TestData\PrereleaseCompatibilityTransformer\Inputs\Rtm1SchemaLocation.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\NonDottedQuadFileVersion.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\ResultLocationsAsEmptyArray.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\Inputs\NonDottedQuadFileVersion.sarif" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"$schema": "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.4.json",
"version": "2.1.0",
"runs": [
{
"tool": {
"driver": {
"name": "CodeScanner"
}
},
"results": [],
"columnKind": "utf16CodeUnits"
}
],
"properties": {
"comment": "Regression test for #1584: Multitool Transform can't upgrade 'http://json.schemastore.org/sarif-2.1.0-rtm.1' schema"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"$schema": "http://json.schemastore.org/sarif-2.1.0-rtm.1",
"version": "2.1.0",
"runs": [
{
"tool": {
"driver": {
"name": "CodeScanner"
}
},
"results": [],
"columnKind": "utf16CodeUnits"
}
],
"properties": {
"comment": "Regression test for #1584: Multitool Transform can't upgrade 'http://json.schemastore.org/sarif-2.1.0-rtm.1' schema"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,13 @@ public void PrereleaseCompatibilityTransformer_ThreadFlowLocationWithKind()
RunTest("ThreadFlowLocationWithKind.sarif");
}

[Fact]
[Trait(TestTraits.Bug, "1584")]
public void PrereleaseCompatibilityTransformer_Rtm1SchemaLocation()
{
RunTest("Rtm1SchemaLocation.sarif");
}

[Fact]
public void PrereleaseCompatibilityTransformer_FromSarifV1()
{
Expand Down

0 comments on commit 439258b

Please sign in to comment.