Skip to content

Commit

Permalink
Allow per-instance file regions cache to be set on InsertOptionalData…
Browse files Browse the repository at this point in the history
…Visitor. (#2543)
  • Loading branch information
michaelcfanning authored Sep 12, 2022
1 parent ce50a92 commit eb24e66
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/ReleaseHistory.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# SARIF Package Release History (SDK, Driver, Converters, and Multitool)

## Unreleased

* FEATURE: Allow initialization of file regions cache in `InsertOptionalDataVisitor` (previously initialized exclusively from `FileRegionsCache.Instance`).
* BUGFIX: Resolve issue where `match-results-forward` command fails to generate VersionControlDetails data. [#2487](https://github.com/microsoft/sarif-sdk/pull/2487)
* BUGFIX: Remove duplicated rule definitions when executing `match-results-forward` commands for results with sub-rule ids. [#2486](https://github.com/microsoft/sarif-sdk/pull/2486)
* BUGFIX: Update `merge` command to properly produce runs by tool and version when passed the `--merge-runs` argument. [#2488](https://github.com/microsoft/sarif-sdk/pull/2488)
Expand Down
7 changes: 4 additions & 3 deletions src/Sarif/Visitors/InsertOptionalDataVisitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public InsertOptionalDataVisitor(
IDictionary<string, ArtifactLocation> originalUriBaseIds = null,
IFileSystem fileSystem = null,
GitHelper.ProcessRunner processRunner = null,
IEnumerable<string> insertProperties = null)
IEnumerable<string> insertProperties = null,
FileRegionsCache fileRegionsCache = null)
{
_fileSystem = fileSystem ?? FileSystem.Instance;
_processRunner = processRunner;
Expand All @@ -53,6 +54,8 @@ public InsertOptionalDataVisitor(
_dataToInsert = dataToInsert;
_originalUriBaseIds = originalUriBaseIds;
_insertProperties = insertProperties ?? new List<string>();

_fileRegionsCache = fileRegionsCache ?? FileRegionsCache.Instance;
}

public override Run VisitRun(Run node)
Expand Down Expand Up @@ -111,8 +114,6 @@ public override PhysicalLocation VisitPhysicalLocation(PhysicalLocation node)
Region expandedRegion;
ArtifactLocation artifactLocation = node.ArtifactLocation;

_fileRegionsCache ??= FileRegionsCache.Instance;

if (artifactLocation.Uri == null && artifactLocation.Index >= 0)
{
// Uri is not stored at result level, but we have an index to go look in run.Artifacts
Expand Down

0 comments on commit eb24e66

Please sign in to comment.