public virtual FormattedRuleMessage VisitFormattedRuleMessage(FormattedRuleMessage node)
        {
            if (node != null)
            {
            }

            return(node);
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FormattedRuleMessage" /> class from the specified instance.
        /// </summary>
        /// <param name="other">
        /// The instance from which the new instance is to be initialized.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// Thrown if <paramref name="other" /> is null.
        /// </exception>
        public FormattedRuleMessage(FormattedRuleMessage other)
        {
            if (other == null)
            {
                throw new ArgumentNullException(nameof(other));
            }

            Init(other.FormatId, other.Arguments);
        }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FormattedRuleMessage" /> class from the specified instance.
        /// </summary>
        /// <param name="other">
        /// The instance from which the new instance is to be initialized.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// Thrown if <paramref name="other" /> is null.
        /// </exception>
        public FormattedRuleMessage(FormattedRuleMessage other)
        {
            if (other == null)
            {
                throw new ArgumentNullException(nameof(other));
            }

            Init(other.FormatId, other.Arguments);
        }
예제 #4
0
 public bool ValueEquals(FormattedRuleMessage other) => ValueComparer.Equals(this, other);
예제 #5
0
        private void Init(string ruleId, string ruleKey, ResultLevel level, string message, FormattedRuleMessage formattedRuleMessage, IEnumerable <Location> locations, string snippet, string id, string toolFingerprintContribution, IEnumerable <Stack> stacks, IEnumerable <CodeFlow> codeFlows, IEnumerable <AnnotatedCodeLocation> relatedLocations, SuppressionStates suppressionStates, BaselineState baselineState, IEnumerable <Fix> fixes, IDictionary <string, SerializedPropertyInfo> properties)
        {
            RuleId  = ruleId;
            RuleKey = ruleKey;
            Level   = level;
            Message = message;
            if (formattedRuleMessage != null)
            {
                FormattedRuleMessage = new FormattedRuleMessage(formattedRuleMessage);
            }

            if (locations != null)
            {
                var destination_0 = new List <Location>();
                foreach (var value_0 in locations)
                {
                    if (value_0 == null)
                    {
                        destination_0.Add(null);
                    }
                    else
                    {
                        destination_0.Add(new Location(value_0));
                    }
                }

                Locations = destination_0;
            }

            Snippet = snippet;
            Id      = id;
            ToolFingerprintContribution = toolFingerprintContribution;
            if (stacks != null)
            {
                var destination_1 = new List <Stack>();
                foreach (var value_1 in stacks)
                {
                    if (value_1 == null)
                    {
                        destination_1.Add(null);
                    }
                    else
                    {
                        destination_1.Add(new Stack(value_1));
                    }
                }

                Stacks = destination_1;
            }

            if (codeFlows != null)
            {
                var destination_2 = new List <CodeFlow>();
                foreach (var value_2 in codeFlows)
                {
                    if (value_2 == null)
                    {
                        destination_2.Add(null);
                    }
                    else
                    {
                        destination_2.Add(new CodeFlow(value_2));
                    }
                }

                CodeFlows = destination_2;
            }

            if (relatedLocations != null)
            {
                var destination_3 = new List <AnnotatedCodeLocation>();
                foreach (var value_3 in relatedLocations)
                {
                    if (value_3 == null)
                    {
                        destination_3.Add(null);
                    }
                    else
                    {
                        destination_3.Add(new AnnotatedCodeLocation(value_3));
                    }
                }

                RelatedLocations = destination_3;
            }

            SuppressionStates = suppressionStates;
            BaselineState     = baselineState;
            if (fixes != null)
            {
                var destination_4 = new List <Fix>();
                foreach (var value_4 in fixes)
                {
                    if (value_4 == null)
                    {
                        destination_4.Add(null);
                    }
                    else
                    {
                        destination_4.Add(new Fix(value_4));
                    }
                }

                Fixes = destination_4;
            }

            if (properties != null)
            {
                Properties = new Dictionary <string, SerializedPropertyInfo>(properties);
            }
        }
예제 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Result" /> class from the supplied values.
 /// </summary>
 /// <param name="ruleId">
 /// An initialization value for the <see cref="P: RuleId" /> property.
 /// </param>
 /// <param name="ruleKey">
 /// An initialization value for the <see cref="P: RuleKey" /> property.
 /// </param>
 /// <param name="level">
 /// An initialization value for the <see cref="P: Level" /> property.
 /// </param>
 /// <param name="message">
 /// An initialization value for the <see cref="P: Message" /> property.
 /// </param>
 /// <param name="formattedRuleMessage">
 /// An initialization value for the <see cref="P: FormattedRuleMessage" /> property.
 /// </param>
 /// <param name="locations">
 /// An initialization value for the <see cref="P: Locations" /> property.
 /// </param>
 /// <param name="snippet">
 /// An initialization value for the <see cref="P: Snippet" /> property.
 /// </param>
 /// <param name="id">
 /// An initialization value for the <see cref="P: Id" /> property.
 /// </param>
 /// <param name="toolFingerprintContribution">
 /// An initialization value for the <see cref="P: ToolFingerprintContribution" /> property.
 /// </param>
 /// <param name="stacks">
 /// An initialization value for the <see cref="P: Stacks" /> property.
 /// </param>
 /// <param name="codeFlows">
 /// An initialization value for the <see cref="P: CodeFlows" /> property.
 /// </param>
 /// <param name="relatedLocations">
 /// An initialization value for the <see cref="P: RelatedLocations" /> property.
 /// </param>
 /// <param name="suppressionStates">
 /// An initialization value for the <see cref="P: SuppressionStates" /> property.
 /// </param>
 /// <param name="baselineState">
 /// An initialization value for the <see cref="P: BaselineState" /> property.
 /// </param>
 /// <param name="fixes">
 /// An initialization value for the <see cref="P: Fixes" /> property.
 /// </param>
 /// <param name="properties">
 /// An initialization value for the <see cref="P: Properties" /> property.
 /// </param>
 public Result(string ruleId, string ruleKey, ResultLevel level, string message, FormattedRuleMessage formattedRuleMessage, IEnumerable <Location> locations, string snippet, string id, string toolFingerprintContribution, IEnumerable <Stack> stacks, IEnumerable <CodeFlow> codeFlows, IEnumerable <AnnotatedCodeLocation> relatedLocations, SuppressionStates suppressionStates, BaselineState baselineState, IEnumerable <Fix> fixes, IDictionary <string, SerializedPropertyInfo> properties)
 {
     Init(ruleId, ruleKey, level, message, formattedRuleMessage, locations, snippet, id, toolFingerprintContribution, stacks, codeFlows, relatedLocations, suppressionStates, baselineState, fixes, properties);
 }
예제 #7
0
        private void Init(string ruleId, ResultKind kind, string message, FormattedRuleMessage formattedRuleMessage, ISet <Location> locations, string codeSnippet, string toolFingerprint, ISet <Stack> stacks, ISet <CodeFlow> codeFlows, ISet <AnnotatedCodeLocation> relatedLocations, bool isSuppressedInSource, ISet <Fix> fixes, IDictionary <string, string> properties, ISet <string> tags)
        {
            RuleId  = ruleId;
            Kind    = kind;
            Message = message;
            if (formattedRuleMessage != null)
            {
                FormattedRuleMessage = new FormattedRuleMessage(formattedRuleMessage);
            }

            if (locations != null)
            {
                var destination_0 = new HashSet <Location>();
                foreach (var value_0 in locations)
                {
                    if (value_0 == null)
                    {
                        destination_0.Add(null);
                    }
                    else
                    {
                        destination_0.Add(new Location(value_0));
                    }
                }

                Locations = destination_0;
            }

            CodeSnippet     = codeSnippet;
            ToolFingerprint = toolFingerprint;
            if (stacks != null)
            {
                var destination_1 = new HashSet <Stack>();
                foreach (var value_1 in stacks)
                {
                    if (value_1 == null)
                    {
                        destination_1.Add(null);
                    }
                    else
                    {
                        destination_1.Add(new Stack(value_1));
                    }
                }

                Stacks = destination_1;
            }

            if (codeFlows != null)
            {
                var destination_2 = new HashSet <CodeFlow>();
                foreach (var value_2 in codeFlows)
                {
                    if (value_2 == null)
                    {
                        destination_2.Add(null);
                    }
                    else
                    {
                        destination_2.Add(new CodeFlow(value_2));
                    }
                }

                CodeFlows = destination_2;
            }

            if (relatedLocations != null)
            {
                var destination_3 = new HashSet <AnnotatedCodeLocation>();
                foreach (var value_3 in relatedLocations)
                {
                    if (value_3 == null)
                    {
                        destination_3.Add(null);
                    }
                    else
                    {
                        destination_3.Add(new AnnotatedCodeLocation(value_3));
                    }
                }

                RelatedLocations = destination_3;
            }

            IsSuppressedInSource = isSuppressedInSource;
            if (fixes != null)
            {
                var destination_4 = new HashSet <Fix>();
                foreach (var value_4 in fixes)
                {
                    if (value_4 == null)
                    {
                        destination_4.Add(null);
                    }
                    else
                    {
                        destination_4.Add(new Fix(value_4));
                    }
                }

                Fixes = destination_4;
            }

            if (properties != null)
            {
                Properties = new Dictionary <string, string>(properties);
            }

            if (tags != null)
            {
                var destination_5 = new HashSet <string>();
                foreach (var value_5 in tags)
                {
                    destination_5.Add(value_5);
                }

                Tags = destination_5;
            }
        }
예제 #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Result" /> class from the supplied values.
 /// </summary>
 /// <param name="ruleId">
 /// An initialization value for the <see cref="P: RuleId" /> property.
 /// </param>
 /// <param name="kind">
 /// An initialization value for the <see cref="P: Kind" /> property.
 /// </param>
 /// <param name="message">
 /// An initialization value for the <see cref="P: Message" /> property.
 /// </param>
 /// <param name="formattedRuleMessage">
 /// An initialization value for the <see cref="P: FormattedRuleMessage" /> property.
 /// </param>
 /// <param name="locations">
 /// An initialization value for the <see cref="P: Locations" /> property.
 /// </param>
 /// <param name="codeSnippet">
 /// An initialization value for the <see cref="P: CodeSnippet" /> property.
 /// </param>
 /// <param name="toolFingerprint">
 /// An initialization value for the <see cref="P: ToolFingerprint" /> property.
 /// </param>
 /// <param name="stacks">
 /// An initialization value for the <see cref="P: Stacks" /> property.
 /// </param>
 /// <param name="codeFlows">
 /// An initialization value for the <see cref="P: CodeFlows" /> property.
 /// </param>
 /// <param name="relatedLocations">
 /// An initialization value for the <see cref="P: RelatedLocations" /> property.
 /// </param>
 /// <param name="isSuppressedInSource">
 /// An initialization value for the <see cref="P: IsSuppressedInSource" /> property.
 /// </param>
 /// <param name="fixes">
 /// An initialization value for the <see cref="P: Fixes" /> property.
 /// </param>
 /// <param name="properties">
 /// An initialization value for the <see cref="P: Properties" /> property.
 /// </param>
 /// <param name="tags">
 /// An initialization value for the <see cref="P: Tags" /> property.
 /// </param>
 public Result(string ruleId, ResultKind kind, string message, FormattedRuleMessage formattedRuleMessage, ISet <Location> locations, string codeSnippet, string toolFingerprint, ISet <Stack> stacks, ISet <CodeFlow> codeFlows, ISet <AnnotatedCodeLocation> relatedLocations, bool isSuppressedInSource, ISet <Fix> fixes, IDictionary <string, string> properties, ISet <string> tags)
 {
     Init(ruleId, kind, message, formattedRuleMessage, locations, codeSnippet, toolFingerprint, stacks, codeFlows, relatedLocations, isSuppressedInSource, fixes, properties, tags);
 }
예제 #9
0
        public override int GetHashCode()
        {
            int result = 17;

            unchecked
            {
                if (RuleId != null)
                {
                    result = (result * 31) + RuleId.GetHashCode();
                }

                result = (result * 31) + Kind.GetHashCode();
                if (Message != null)
                {
                    result = (result * 31) + Message.GetHashCode();
                }

                if (FormattedRuleMessage != null)
                {
                    result = (result * 31) + FormattedRuleMessage.GetHashCode();
                }

                if (Locations != null)
                {
                    foreach (var value_0 in Locations)
                    {
                        result = result * 31;
                        if (value_0 != null)
                        {
                            result = (result * 31) + value_0.GetHashCode();
                        }
                    }
                }

                if (CodeSnippet != null)
                {
                    result = (result * 31) + CodeSnippet.GetHashCode();
                }

                if (ToolFingerprint != null)
                {
                    result = (result * 31) + ToolFingerprint.GetHashCode();
                }

                if (Stacks != null)
                {
                    foreach (var value_1 in Stacks)
                    {
                        result = result * 31;
                        if (value_1 != null)
                        {
                            result = (result * 31) + value_1.GetHashCode();
                        }
                    }
                }

                if (CodeFlows != null)
                {
                    foreach (var value_2 in CodeFlows)
                    {
                        result = result * 31;
                        if (value_2 != null)
                        {
                            result = (result * 31) + value_2.GetHashCode();
                        }
                    }
                }

                if (RelatedLocations != null)
                {
                    foreach (var value_3 in RelatedLocations)
                    {
                        result = result * 31;
                        if (value_3 != null)
                        {
                            result = (result * 31) + value_3.GetHashCode();
                        }
                    }
                }

                result = (result * 31) + IsSuppressedInSource.GetHashCode();
                if (Fixes != null)
                {
                    foreach (var value_4 in Fixes)
                    {
                        result = result * 31;
                        if (value_4 != null)
                        {
                            result = (result * 31) + value_4.GetHashCode();
                        }
                    }
                }

                if (Properties != null)
                {
                    // Use xor for dictionaries to be order-independent.
                    int xor_0 = 0;
                    foreach (var value_5 in Properties)
                    {
                        xor_0 ^= value_5.Key.GetHashCode();
                        if (value_5.Value != null)
                        {
                            xor_0 ^= value_5.Value.GetHashCode();
                        }
                    }

                    result = (result * 31) + xor_0;
                }

                if (Tags != null)
                {
                    foreach (var value_6 in Tags)
                    {
                        result = result * 31;
                        if (value_6 != null)
                        {
                            result = (result * 31) + value_6.GetHashCode();
                        }
                    }
                }
            }

            return(result);
        }
예제 #10
0
 public bool ValueEquals(FormattedRuleMessage other) => ValueComparer.Equals(this, other);
예제 #11
0
        private void Init(string ruleId, string ruleKey, ResultLevel level, string message, FormattedRuleMessage formattedRuleMessage, IEnumerable<Location> locations, string snippet, string id, string toolFingerprintContribution, IEnumerable<Stack> stacks, IEnumerable<CodeFlow> codeFlows, IEnumerable<AnnotatedCodeLocation> relatedLocations, SuppressionStates suppressionStates, BaselineState baselineState, IEnumerable<Fix> fixes, IDictionary<string, SerializedPropertyInfo> properties)
        {
            RuleId = ruleId;
            RuleKey = ruleKey;
            Level = level;
            Message = message;
            if (formattedRuleMessage != null)
            {
                FormattedRuleMessage = new FormattedRuleMessage(formattedRuleMessage);
            }

            if (locations != null)
            {
                var destination_0 = new List<Location>();
                foreach (var value_0 in locations)
                {
                    if (value_0 == null)
                    {
                        destination_0.Add(null);
                    }
                    else
                    {
                        destination_0.Add(new Location(value_0));
                    }
                }

                Locations = destination_0;
            }

            Snippet = snippet;
            Id = id;
            ToolFingerprintContribution = toolFingerprintContribution;
            if (stacks != null)
            {
                var destination_1 = new List<Stack>();
                foreach (var value_1 in stacks)
                {
                    if (value_1 == null)
                    {
                        destination_1.Add(null);
                    }
                    else
                    {
                        destination_1.Add(new Stack(value_1));
                    }
                }

                Stacks = destination_1;
            }

            if (codeFlows != null)
            {
                var destination_2 = new List<CodeFlow>();
                foreach (var value_2 in codeFlows)
                {
                    if (value_2 == null)
                    {
                        destination_2.Add(null);
                    }
                    else
                    {
                        destination_2.Add(new CodeFlow(value_2));
                    }
                }

                CodeFlows = destination_2;
            }

            if (relatedLocations != null)
            {
                var destination_3 = new List<AnnotatedCodeLocation>();
                foreach (var value_3 in relatedLocations)
                {
                    if (value_3 == null)
                    {
                        destination_3.Add(null);
                    }
                    else
                    {
                        destination_3.Add(new AnnotatedCodeLocation(value_3));
                    }
                }

                RelatedLocations = destination_3;
            }

            SuppressionStates = suppressionStates;
            BaselineState = baselineState;
            if (fixes != null)
            {
                var destination_4 = new List<Fix>();
                foreach (var value_4 in fixes)
                {
                    if (value_4 == null)
                    {
                        destination_4.Add(null);
                    }
                    else
                    {
                        destination_4.Add(new Fix(value_4));
                    }
                }

                Fixes = destination_4;
            }

            if (properties != null)
            {
                Properties = new Dictionary<string, SerializedPropertyInfo>(properties);
            }
        }
예제 #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Result" /> class from the supplied values.
 /// </summary>
 /// <param name="ruleId">
 /// An initialization value for the <see cref="P: RuleId" /> property.
 /// </param>
 /// <param name="ruleKey">
 /// An initialization value for the <see cref="P: RuleKey" /> property.
 /// </param>
 /// <param name="level">
 /// An initialization value for the <see cref="P: Level" /> property.
 /// </param>
 /// <param name="message">
 /// An initialization value for the <see cref="P: Message" /> property.
 /// </param>
 /// <param name="formattedRuleMessage">
 /// An initialization value for the <see cref="P: FormattedRuleMessage" /> property.
 /// </param>
 /// <param name="locations">
 /// An initialization value for the <see cref="P: Locations" /> property.
 /// </param>
 /// <param name="snippet">
 /// An initialization value for the <see cref="P: Snippet" /> property.
 /// </param>
 /// <param name="id">
 /// An initialization value for the <see cref="P: Id" /> property.
 /// </param>
 /// <param name="toolFingerprintContribution">
 /// An initialization value for the <see cref="P: ToolFingerprintContribution" /> property.
 /// </param>
 /// <param name="stacks">
 /// An initialization value for the <see cref="P: Stacks" /> property.
 /// </param>
 /// <param name="codeFlows">
 /// An initialization value for the <see cref="P: CodeFlows" /> property.
 /// </param>
 /// <param name="relatedLocations">
 /// An initialization value for the <see cref="P: RelatedLocations" /> property.
 /// </param>
 /// <param name="suppressionStates">
 /// An initialization value for the <see cref="P: SuppressionStates" /> property.
 /// </param>
 /// <param name="baselineState">
 /// An initialization value for the <see cref="P: BaselineState" /> property.
 /// </param>
 /// <param name="fixes">
 /// An initialization value for the <see cref="P: Fixes" /> property.
 /// </param>
 /// <param name="properties">
 /// An initialization value for the <see cref="P: Properties" /> property.
 /// </param>
 public Result(string ruleId, string ruleKey, ResultLevel level, string message, FormattedRuleMessage formattedRuleMessage, IEnumerable<Location> locations, string snippet, string id, string toolFingerprintContribution, IEnumerable<Stack> stacks, IEnumerable<CodeFlow> codeFlows, IEnumerable<AnnotatedCodeLocation> relatedLocations, SuppressionStates suppressionStates, BaselineState baselineState, IEnumerable<Fix> fixes, IDictionary<string, SerializedPropertyInfo> properties)
 {
     Init(ruleId, ruleKey, level, message, formattedRuleMessage, locations, snippet, id, toolFingerprintContribution, stacks, codeFlows, relatedLocations, suppressionStates, baselineState, fixes, properties);
 }