Skip to content

Commit

Permalink
HdfConverter: SARIF location improvements (#2704)
Browse files Browse the repository at this point in the history
* Hdf: SourceLocation's Line and Ref are optional

Signed-off-by: Craig Andrews <[email protected]>

* HdfConverter: Set ArtifactLocation and Region using SourceLocation

Signed-off-by: Craig Andrews <[email protected]>

* HdfConverter: GitHub requires the uri to have a non-empty string value

GitHub Advanced Security code scanning requires
'physicalLocation.artifactLocation.uri' to have a non-empty string
value.

Signed-off-by: Craig Andrews <[email protected]>

* Update release notes.

---------

Signed-off-by: Craig Andrews <[email protected]>
Co-authored-by: Michael C. Fanning <[email protected]>
  • Loading branch information
candrews and michaelcfanning authored Aug 23, 2023
1 parent ff8c721 commit 84d2047
Show file tree
Hide file tree
Showing 4 changed files with 203 additions and 203 deletions.
4 changes: 2 additions & 2 deletions ReleaseHistory.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SARIF Package Release History (SDK, Driver, Converters, and Multitool)
## Unreleased

## **v4.3.1** UNRELEASED
* BUG: Improve `HdfConverter` ensure uri data is populated and to provide location and region data property from `SourceLocation`. [#2704](https://github.com/microsoft/sarif-sdk/pull/2704)
* BUG: Correct `run.language` regex in JSON schema. [#2708]https://github.com/microsoft/sarif-sdk/pull/2708

## **v4.3.0** [Sdk](https://www.nuget.org/packages/Sarif.Sdk/v4.3.0) | [Driver](https://www.nuget.org/packages/Sarif.Driver/v4.3.0) | [Converters](https://www.nuget.org/packages/Sarif.Converters/v4.3.0) | [Multitool](https://www.nuget.org/packages/Sarif.Multitool/v4.3.0) | [Multitool Library](https://www.nuget.org/packages/Sarif.Multitool.Library/v4.3.0)
Expand Down
6 changes: 3 additions & 3 deletions src/Sarif.Converters/HdfConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,14 @@ private static (ReportingDescriptor, IList<Result>) SarifRuleAndResultFromHdfCon
{
ArtifactLocation = new ArtifactLocation
{
Uri = new Uri(".", UriKind.Relative),
Uri = new Uri(execJsonControl.SourceLocation.Ref ?? "file:///", UriKind.RelativeOrAbsolute),
UriBaseId = "ROOTPATH",
},
Region = new Region
{
StartLine = 1,
StartLine = execJsonControl.SourceLocation.Line ?? 1,
StartColumn = 1,
EndLine = 1,
EndLine = execJsonControl.SourceLocation.Line ?? 1,
EndColumn = 1,
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/Sarif.Converters/HdfModel/SourceLocation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ public partial class SourceLocation
/// <summary>
/// The line at which this statement is located in the file
/// </summary>
[JsonProperty("line", Required = Required.Default)]
public double Line { get; set; }
[JsonProperty("line", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)]
public int? Line { get; set; }

/// <summary>
/// Path to the file that this statement originates from
/// </summary>
[JsonProperty("ref", Required = Required.Default)]
[JsonProperty("ref", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)]
public string Ref { get; set; }
}
}
Loading

0 comments on commit 84d2047

Please sign in to comment.