Exemplo n.º 1
0
        public static AnnotatedCodeLocationCollection ToAnnotatedCodeLocationCollection(this CodeFlow codeFlow)
        {
            if (codeFlow == null)
            {
                return(null);
            }

            AnnotatedCodeLocationCollection model = new AnnotatedCodeLocationCollection(codeFlow.Message);

            if (codeFlow.Locations != null)
            {
                foreach (AnnotatedCodeLocation location in codeFlow.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.PhysicalLocation == null)
                    {
                        continue;
                    }

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

            return(model);
        }
Exemplo n.º 2
0
 internal SarifErrorListItem()
 {
     _locations        = new AnnotatedCodeLocationCollection(string.Empty);
     _relatedLocations = new AnnotatedCodeLocationCollection(string.Empty);
     _callTrees        = new CallTreeCollection();
     _stacks           = new ObservableCollection <StackCollection>();
     _fixes            = new ObservableCollection <FixModel>();
 }
Exemplo n.º 3
0
        public static AnnotatedCodeLocationCollection ToAnnotatedCodeLocationCollection(this CodeFlow codeFlow)
        {
            if (codeFlow == null)
            {
                return null;
            }

            AnnotatedCodeLocationCollection model = new AnnotatedCodeLocationCollection(codeFlow.Message);

            if (codeFlow.Locations != null)
            {
                foreach (AnnotatedCodeLocation location in codeFlow.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.PhysicalLocation == null) { continue; }

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

            return model;
        }