Inheritance: ICloneable
        private void CreateRule(string language, DiagnosticDescriptor diag)
        {
            var repoid = "roslyn-" + language;

            var templaterule = new Rule();
            templaterule.Name = "Template Rule";
            templaterule.Key = "roslyn-cs:TemplateRule";

            var desc = string.Format("<p>{0}<a href=\"{1}\">Help Url</a></p>", (diag.Description.ToString()), diag.HelpLinkUri);
            var markdown = string.Format("*{0}* [Help Url]({1})", diag.Description.ToString(), diag.HelpLinkUri);

            var rule = new Rule();
            rule.HtmlDescription = desc;
            rule.MarkDownDescription = markdown;
            rule.Key = repoid + ":" + diag.Id;
            rule.Name = diag.Title.ToString();
            rule.Repo = repoid;
            rule.Severity = Severity.MAJOR;
            foreach (var error in this.rest.CreateRule(AuthtenticationHelper.AuthToken, rule, templaterule))
            {
                this.notificationManager.WriteMessage("Failed to create rule: " + error);
            }
        }
        private void UpdateRuleData(Rule rule)
        {
            if (rule.IsParamsRetrivedFromServer)
            {
                return;
            }

            this.service.UpdateRuleData(this.conf, rule);
        }
 /// <summary>
 /// The merge rule.
 /// </summary>
 /// <param name="rule">
 /// The rule.
 /// </param>
 public void MergeRule(Rule rule)
 {
     this.Key = rule.Key;
     this.Name = rule.Name;
     this.HtmlDescription = rule.HtmlDescription;
     this.MarkDownDescription = rule.MarkDownDescription;
     this.ConfigKey = rule.ConfigKey;
     this.Category = rule.Category;
     this.Subcategory = rule.Subcategory;
     this.RemediationFactorTxt = rule.RemediationFactorTxt;
     this.RemediationFunction = rule.RemediationFunction;
     this.RemediationOffsetTxt = rule.RemediationOffsetTxt;
     this.Severity = rule.Severity;
     this.RemediationOffsetVal = rule.RemediationOffsetVal;
     this.RemediationFactorVal = rule.RemediationFactorVal;
     this.Repo = rule.Repo;
 }
        /// <summary>
        /// The create rule.
        /// </summary>
        /// <param name="rule">
        /// The rule.
        /// </param>
        public void AddRule(Rule rule)
        {
            if (rule.ConfigKey == null)
            {
                rule.ConfigKey = rule.Repo + ":" + rule.Key;
            }

            if (!this.Rules.ContainsKey(rule.ConfigKey))
            {
                this.Rules.Add(rule.ConfigKey, rule);
            }

            if (!string.IsNullOrEmpty(rule.InternalKey))
            {
                if (this.RulesByIternalKey.ContainsKey(rule.InternalKey))
                {
                    return;
                }

                this.RulesByIternalKey.Add(rule.InternalKey, rule);
            }
        }