Exemplo n.º 1
0
        /// <summary>
        /// Adds the default option for highlights - currently set to SUGGESTION.
        /// </summary>
        /// <param name="highlightManager">
        /// The highlight manager.
        /// </param>
        private static void AddDefaultOption(HighlightingSettingsManager highlightManager)
        {
            const string RuleName    = "Default Violation Severity";
            const string GroupName   = "StyleCop - Defaults (Requires VS Restart)";
            const string Description =
                "Sets the default severity for StyleCop violations. This will be used for any Violation where you have not explicitly set a severity. <strong>Changes to this setting will not take effect until the next time you start Visual Studio.</strong>";
            const string HighlightID = DefaultSeverityId;

            if (!SettingExists(highlightManager, HighlightID))
            {
                highlightManager.RegisterConfigurableSeverity(HighlightID, GroupName, RuleName, Description, Severity.SUGGESTION);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Registers the rule configurations.
        /// </summary>
        /// <param name="highlightManager">
        /// The highlight manager.
        /// </param>
        /// <param name="analyzerRulesDictionary">
        /// The analyzer rules dictionary.
        /// </param>
        /// <param name="defaultSeverity">
        /// The default severity.
        /// </param>
        private void RegisterRuleConfigurations(
            HighlightingSettingsManager highlightManager, Dictionary <SourceAnalyzer, List <StyleCopRule> > analyzerRulesDictionary, Severity defaultSeverity)
        {
            foreach (KeyValuePair <SourceAnalyzer, List <StyleCopRule> > analyzerRule in analyzerRulesDictionary)
            {
                string analyzerName = SplitCamelCase(analyzerRule.Key.Name);
                string groupName    = string.Format(GroupTitleTemplate, analyzerName);
                List <StyleCopRule> analyzerRules = analyzerRule.Value;

                foreach (StyleCopRule rule in analyzerRules)
                {
                    string ruleName    = rule.RuleID + ":" + " " + SplitCamelCase(rule.Name);
                    string highlightID = GetHighlightID(rule.RuleID);

                    if (!SettingExists(highlightManager, highlightID))
                    {
                        highlightManager.RegisterConfigurableSeverity(highlightID, groupName, ruleName, rule.Description, defaultSeverity);
                    }
                }
            }
        }
        /// <summary>
        /// Registers the rule configurations.
        /// </summary>
        /// <param name="highlightManager">
        /// The highlight manager.
        /// </param>
        /// <param name="analyzerRulesDictionary">
        /// The analyzer rules dictionary.
        /// </param>
        /// <param name="defaultSeverity">
        /// The default severity.
        /// </param>
        private void RegisterRuleConfigurations(
            HighlightingSettingsManager highlightManager, Dictionary<SourceAnalyzer, List<StyleCopRule>> analyzerRulesDictionary, Severity defaultSeverity)
        {
            foreach (KeyValuePair<SourceAnalyzer, List<StyleCopRule>> analyzerRule in analyzerRulesDictionary)
            {
                string analyzerName = SplitCamelCase(analyzerRule.Key.Name);
                string groupName = string.Format(GroupTitleTemplate, analyzerName);
                List<StyleCopRule> analyzerRules = analyzerRule.Value;

                foreach (StyleCopRule rule in analyzerRules)
                {
                    string ruleName = rule.RuleID + ":" + " " + SplitCamelCase(rule.Name);
                    string highlightID = GetHighlightID(rule.RuleID);

                    if (!SettingExists(highlightManager, highlightID))
                    {
                        highlightManager.RegisterConfigurableSeverity(highlightID, groupName, ruleName, rule.Description, defaultSeverity);
                    }
                }
            }
        }
        /// <summary>
        /// Adds the default option for highlights - currently set to SUGGESTION.
        /// </summary>
        /// <param name="highlightManager">
        /// The highlight manager.
        /// </param>
        private static void AddDefaultOption(HighlightingSettingsManager highlightManager)
        {
            const string RuleName = "Default Violation Severity";
            const string GroupName = "StyleCop - Defaults (Requires VS Restart)";
            const string Description =
                "Sets the default severity for StyleCop violations. This will be used for any Violation where you have not explicitly set a severity. <strong>Changes to this setting will not take effect until the next time you start Visual Studio.</strong>";
            const string HighlightID = DefaultSeverityId;

            if (!SettingExists(highlightManager, HighlightID))
            {
                highlightManager.RegisterConfigurableSeverity(HighlightID, GroupName, RuleName, Description, Severity.SUGGESTION);
            }
        }