public static BaselineState CreateBaselineState(BaselineStateVersionOne v1BaselineState)
        {
            switch (v1BaselineState)
            {
            case BaselineStateVersionOne.Absent:
                return(BaselineState.Absent);

            case BaselineStateVersionOne.Existing:
                return(BaselineState.Unchanged);

            case BaselineStateVersionOne.New:
                return(BaselineState.New);

            default:
                return(BaselineState.None);
            }
        }
Beispiel #2
0
        private void Init(string ruleId, string ruleKey, ResultLevelVersionOne level, string message, FormattedRuleMessageVersionOne formattedRuleMessage, IEnumerable <LocationVersionOne> locations, string snippet, string id, string toolFingerprintContribution, IEnumerable <StackVersionOne> stacks, IEnumerable <CodeFlowVersionOne> codeFlows, IEnumerable <AnnotatedCodeLocationVersionOne> relatedLocations, SuppressionStatesVersionOne suppressionStates, BaselineStateVersionOne baselineState, IEnumerable <FixVersionOne> fixes, IDictionary <string, SerializedPropertyInfo> properties)
        {
            RuleId  = ruleId;
            RuleKey = ruleKey;
            Level   = level;
            Message = message;
            if (formattedRuleMessage != null)
            {
                FormattedRuleMessage = new FormattedRuleMessageVersionOne(formattedRuleMessage);
            }

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

                Locations = destination_0;
            }

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

                Stacks = destination_1;
            }

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

                CodeFlows = destination_2;
            }

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

                RelatedLocations = destination_3;
            }

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

                Fixes = destination_4;
            }

            if (properties != null)
            {
                Properties = new Dictionary <string, SerializedPropertyInfo>(properties);
            }
        }
Beispiel #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ResultVersionOne" /> 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 ResultVersionOne(string ruleId, string ruleKey, ResultLevelVersionOne level, string message, FormattedRuleMessageVersionOne formattedRuleMessage, IEnumerable <LocationVersionOne> locations, string snippet, string id, string toolFingerprintContribution, IEnumerable <StackVersionOne> stacks, IEnumerable <CodeFlowVersionOne> codeFlows, IEnumerable <AnnotatedCodeLocationVersionOne> relatedLocations, SuppressionStatesVersionOne suppressionStates, BaselineStateVersionOne baselineState, IEnumerable <FixVersionOne> fixes, IDictionary <string, SerializedPropertyInfo> properties)
 {
     Init(ruleId, ruleKey, level, message, formattedRuleMessage, locations, snippet, id, toolFingerprintContribution, stacks, codeFlows, relatedLocations, suppressionStates, baselineState, fixes, properties);
 }