public static FailureLevel CreateReportingConfigurationDefaultLevel(ResultLevelVersionOne v1ResultLevel)
        {
            switch (v1ResultLevel)
            {
            case ResultLevelVersionOne.Error:
                return(FailureLevel.Error);

            case ResultLevelVersionOne.Pass:
                return(FailureLevel.Note);

            case ResultLevelVersionOne.Warning:
                return(FailureLevel.Warning);

            default:
                return(FailureLevel.Warning);
            }
        }
        public static ResultKind CreateResultKind(ResultLevelVersionOne v1ResultLevel)
        {
            switch (v1ResultLevel)
            {
            case ResultLevelVersionOne.Error:
                return(ResultKind.Fail);

            case ResultLevelVersionOne.Note:
                return(ResultKind.Fail);

            case ResultLevelVersionOne.Pass:
                return(ResultKind.Pass);

            case ResultLevelVersionOne.Warning:
                return(ResultKind.Fail);

            case ResultLevelVersionOne.NotApplicable:
                return(ResultKind.NotApplicable);

            default:
                return(ResultKind.Fail);
            }
        }
        public static FailureLevel CreateFailureLevel(ResultLevelVersionOne v1ResultLevel)
        {
            switch (v1ResultLevel)
            {
            case ResultLevelVersionOne.Error:
                return(FailureLevel.Error);

            case ResultLevelVersionOne.Note:
                return(FailureLevel.Note);

            case ResultLevelVersionOne.Pass:
                return(FailureLevel.None);

            case ResultLevelVersionOne.Warning:
                return(FailureLevel.Warning);

            case ResultLevelVersionOne.NotApplicable:
                return(FailureLevel.None);

            default:
                return(FailureLevel.Warning);
            }
        }
        private void Init(string id, string name, string shortDescription, string fullDescription, IDictionary <string, string> messageFormats, RuleConfigurationVersionOne configuration, ResultLevelVersionOne defaultLevel, Uri helpUri, IDictionary <string, SerializedPropertyInfo> properties)
        {
            Id               = id;
            Name             = name;
            ShortDescription = shortDescription;
            FullDescription  = fullDescription;
            if (messageFormats != null)
            {
                MessageFormats = new Dictionary <string, string>(messageFormats);
            }

            Configuration = configuration;
            DefaultLevel  = defaultLevel;
            if (helpUri != null)
            {
                HelpUri = new Uri(helpUri.OriginalString, helpUri.IsAbsoluteUri ? UriKind.Absolute : UriKind.Relative);
            }

            if (properties != null)
            {
                Properties = new Dictionary <string, SerializedPropertyInfo>(properties);
            }
        }
예제 #5
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);
            }
        }
예제 #6
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);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="RuleVersionOne" /> class from the supplied values.
 /// </summary>
 /// <param name="id">
 /// An initialization value for the <see cref="P: Id" /> property.
 /// </param>
 /// <param name="name">
 /// An initialization value for the <see cref="P: Name" /> property.
 /// </param>
 /// <param name="shortDescription">
 /// An initialization value for the <see cref="P: ShortDescription" /> property.
 /// </param>
 /// <param name="fullDescription">
 /// An initialization value for the <see cref="P: FullDescription" /> property.
 /// </param>
 /// <param name="messageFormats">
 /// An initialization value for the <see cref="P: MessageFormats" /> property.
 /// </param>
 /// <param name="configuration">
 /// An initialization value for the <see cref="P: Configuration" /> property.
 /// </param>
 /// <param name="defaultLevel">
 /// An initialization value for the <see cref="P: DefaultLevel" /> property.
 /// </param>
 /// <param name="helpUri">
 /// An initialization value for the <see cref="P: HelpUri" /> property.
 /// </param>
 /// <param name="properties">
 /// An initialization value for the <see cref="P: Properties" /> property.
 /// </param>
 public RuleVersionOne(string id, string name, string shortDescription, string fullDescription, IDictionary <string, string> messageFormats, RuleConfigurationVersionOne configuration, ResultLevelVersionOne defaultLevel, Uri helpUri, IDictionary <string, SerializedPropertyInfo> properties)
 {
     Init(id, name, shortDescription, fullDescription, messageFormats, configuration, defaultLevel, helpUri, properties);
 }