public void RewriteUri_RewritesAllFiles(int fileCount) { Random random = RandomSarifLogGenerator.GenerateRandomAndLog(this.output); List <SarifLog> logs = new List <SarifLog>(); for (int i = 0; i < fileCount; i++) { logs.Add(RandomSarifLogGenerator.GenerateSarifLogWithRuns(random, random.Next(10))); } bool rebaseRelativeUris = false; IActionWrapper <SarifLog> RewriteUri = SarifLogProcessorFactory.GetActionStage(SarifLogAction.RebaseUri, new string[] { "SRCROOT", rebaseRelativeUris.ToString(), @"C:\src\" }); IEnumerable <SarifLog> rewrittenLogs = RewriteUri.Act(logs.AsEnumerable()); rewrittenLogs.Should().HaveCount(logs.Count); // We just check that the log rewriter hit each run. We'll test the RewriteUriVisitor more comprehensively in its own test class. foreach (SarifLog rewrittenLog in rewrittenLogs) { if (rewrittenLog.Runs != null) { foreach (Run run in rewrittenLog.Runs) { run.OriginalUriBaseIds.Should().ContainKey("SRCROOT"); } } } }
public SarifLogPipeline(List <SarifLogActionTuple> actions) { this.Actions = actions; _pipeline = new GenericActionPipeline <SarifLog>(Actions.Select(a => SarifLogProcessorFactory.GetActionStage(a.Action, a.Parameters))); }
public static IEnumerable <SarifLog> MakeUrisAbsolute(this IEnumerable <SarifLog> sarifLogs) { return(SarifLogProcessorFactory.GetActionStage(SarifLogAction.MakeUrisAbsolute).Act(sarifLogs)); }
public static IEnumerable <SarifLog> RebaseUri(this IEnumerable <SarifLog> sarifLog, string basePathToken, bool rebaseRelativeUris, Uri uri) { return(SarifLogProcessorFactory.GetActionStage(SarifLogAction.RebaseUri, basePathToken, rebaseRelativeUris.ToString(), uri.AbsoluteUri).Act(sarifLog)); }
public static SarifLog Merge(this IEnumerable <SarifLog> sarifLog) { return(((GenericFoldAction <SarifLog>)SarifLogProcessorFactory.GetActionStage(SarifLogAction.Merge)).Fold(sarifLog)); }
public static IEnumerable <SarifLog> InsertOptionalData(this IEnumerable <SarifLog> sarifLogs, OptionallyEmittedData optionalData) { return(SarifLogProcessorFactory.GetActionStage(SarifLogAction.InsertOptionalData, optionalData.ToString()).Act(sarifLogs)); }
public static SarifLog Merge(this IEnumerable <SarifLog> sarifLog, bool mergeEmptyLogs = true) { return(((GenericFoldAction <SarifLog>)SarifLogProcessorFactory.GetActionStage(SarifLogAction.Merge, mergeEmptyLogs.ToString())).Fold(sarifLog)); }