Ejemplo n.º 1
0
        public bool Equals(Result x, Result y)
        {
            if (!object.ReferenceEquals(x, y))
            {
                // Rule ID should match
                if (x.RuleId != y.RuleId)
                {
                    return(false);
                }

                // Target file should match.
                if (!ArtifactLocationBaselineEquals.Instance.Equals(x.AnalysisTarget, y.AnalysisTarget))
                {
                    return(false);
                }

                // Locations should all be the same.
                if (!ListComparisonHelpers.CompareListsAsSets(x.Locations, y.Locations, LocationBaselineEquals.Instance))
                {
                    return(false);
                }

                // Related Locations should all be the same.
                if (!ListComparisonHelpers.CompareListsAsSets(x.RelatedLocations, y.RelatedLocations, LocationBaselineEquals.Instance))
                {
                    return(false);
                }

                // Fingerprints (values only, ignore keys) should be the same.
                if (!ListComparisonHelpers.CompareListsAsSets(x.Fingerprints?.Values?.ToList(), y.Fingerprints?.Values?.ToList(), StringComparer.Ordinal))
                {
                    return(false);
                }

                // Partial fingerprints (values only, ignore keys) should be the same.
                if (!ListComparisonHelpers.CompareListsAsSets(x.PartialFingerprints?.Values?.ToList(), y.PartialFingerprints?.Values?.ToList(), StringComparer.Ordinal))
                {
                    return(false);
                }

                // If stacks are present, we'll make sure they're the same
                if (!ListComparisonHelpers.CompareListsAsSets(x.Stacks, y.Stacks, StackBaselineEquals.Instance))
                {
                    return(false);
                }

                // If codeflows are present, we'll make sure they're the same.
                if (!ListComparisonHelpers.CompareListsAsSets(x.CodeFlows, y.CodeFlows, CodeFlowBaselineEqualityComparator.Instance))
                {
                    return(false);
                }
            }
            return(true);
        }
Ejemplo n.º 2
0
        public bool Equals(Annotation x, Annotation y)
        {
            if (!object.ReferenceEquals(x, y))
            {
                if (!ListComparisonHelpers.CompareListsAsSets(x.Locations, y.Locations, PhysicalLocationBaselineEquals.Instance))
                {
                    return(false);
                }

                if (x.Message != y.Message)
                {
                    return(false);
                }
            }
            return(true);
        }
Ejemplo n.º 3
0
        public bool Equals(Result x, Result y)
        {
            if (!object.ReferenceEquals(x, y))
            {
                // Rule ID/Key should match
                if (x.RuleId != y.RuleId || x.RuleKey != y.RuleKey)
                {
                    return(false);
                }

                // Locations should all be the same.
                if (!ListComparisonHelpers.CompareListsAsSets(x.Locations, y.Locations, LocationBaselineEquals.Instance))
                {
                    return(false);
                }

                // Related Locations should all be the same.
                if (!ListComparisonHelpers.CompareListsAsSets(x.RelatedLocations, y.RelatedLocations, AnnotatedCodeLocationBaselineEquals.DefaultInstance))
                {
                    return(false);
                }

                // Finger print contributions should be the same.
                if (x.ToolFingerprintContribution != y.ToolFingerprintContribution)
                {
                    return(false);
                }

                // If stacks are present, we'll make sure they're the same
                if (!ListComparisonHelpers.CompareListsAsSets(x.Stacks, y.Stacks, StackBaselineEquals.Instance))
                {
                    return(false);
                }

                // If codeflows are present, we'll make sure they're the same.
                if (!ListComparisonHelpers.CompareListsAsSets(x.CodeFlows, y.CodeFlows, CodeFlowBaselineEqualityComparator.Instance))
                {
                    return(false);
                }
            }
            return(true);
        }
Ejemplo n.º 4
0
        public bool Equals(AnnotatedCodeLocation x, AnnotatedCodeLocation y)
        {
            if (!object.ReferenceEquals(x, y))
            {
                if (x.FullyQualifiedLogicalName != y.FullyQualifiedLogicalName || x.LogicalLocationKey != y.LogicalLocationKey)
                {
                    return(false);
                }

                if (x.Importance != y.Importance)
                {
                    return(false);
                }

                if (x.Module != y.Module)
                {
                    return(false);
                }

                if (x.Kind != y.Kind)
                {
                    return(false);
                }

                if (x.Target != y.Target || x.TargetKey != y.TargetKey)
                {
                    return(false);
                }

                if (!PhysicalLocationBaselineEquals.Instance.Equals(x.PhysicalLocation, y.PhysicalLocation))
                {
                    return(false);
                }

                if (!ListComparisonHelpers.CompareListsAsSets(x.Annotations, y.Annotations, AnnotationBaselineEquals.Instance))
                {
                    return(false);
                }
            }
            return(true);
        }