コード例 #1
0
            private static void AssertNoConvert(Expression <Action <IX> > expression)
            {
                var visitor = new FilteringVisitor(e => e.NodeType == ExpressionType.Convert);

                visitor.Visit(expression.Body);
                Assert.False(visitor.Result.Any());
            }
コード例 #2
0
        /// <summary>
        /// Filter the specified SARIF log to create a new log containing only those results for
        /// which the specified predicate returns true, and only those elements of run-level
        /// collections such as Run.Artifacts that are relevant to the filtered results.
        /// </summary>
        /// <param name="log">
        /// The log file to be filtered.
        /// </param>
        /// <param name="predicate">
        /// The predicate that selects the results in the filtered log file.
        /// </param>
        /// <returns>
        /// A new SARIF log containing only the filtered results, and only the relevant elements
        /// of the run-level collections.
        /// </returns>
        public static SarifLog Filter(SarifLog log, FilteringVisitor.IncludeResultPredicate predicate)
        {
            SarifLog newLog = log.DeepClone();

            var visitor = new FilteringVisitor(predicate);

            return(visitor.VisitSarifLog(newLog));
        }