예제 #1
0
        public static CodeFlowLocationCollection ToCodeFlowLocationCollection(this CodeFlow codeFlow)
        {
            if (codeFlow == null)
            {
                return(null);
            }

            var model = new CodeFlowLocationCollection(codeFlow.Message.Text);

            if (codeFlow.ThreadFlows?[0]?.Locations != null)
            {
                foreach (CodeFlowLocation location in codeFlow.ThreadFlows[0].Locations)
                {
                    // TODO we are not yet properly hardened against locationless
                    // code locations (and what this means is also in flux as
                    // far as SARIF producers). For now we skip these.
                    if (location.Location?.PhysicalLocation == null)
                    {
                        continue;
                    }

                    model.Add(location.ToCodeFlowLocationModel());
                }
            }

            return(model);
        }
예제 #2
0
 internal SarifErrorListItem()
 {
     Locations        = new CodeFlowLocationCollection(string.Empty);
     RelatedLocations = new CodeFlowLocationCollection(string.Empty);
     CallTrees        = new CallTreeCollection();
     Stacks           = new ObservableCollection <StackCollection>();
     Fixes            = new ObservableCollection <FixModel>();
 }