Exemple #1
0
        /// <summary>
        /// Loads the settings from the document.
        /// </summary>
        /// <param name="document">
        /// The settings document.
        /// </param>
        /// <param name="settings">
        /// Stores the settings.
        /// </param>
        public static void Load(XmlDocument document, Settings settings)
        {
            Param.AssertNotNull(document, "document");
            Param.AssertNotNull(settings, "settings");

            // Move the StatementMustNotUseUnnecessaryParenthesis rule from the ReadabilityRules analyzer to the MaintainabilityRules analyzer
            // if it exists.
            MoveRuleToNewAnalyzer(
                document,
                "Microsoft.SourceAnalysis.CSharp.ReadabilityRules",
                "Microsoft.SourceAnalysis.CSharp.MaintainabilityRules",
                "StatementMustNotUseUnnecessaryParenthesis");

            // If the PublicAndProtectedOnly property exists on the DocumentationRules analyzer, rename it to IgnorePrivates.
            V102Settings.ChangeAnalyzerSettingName(document, "Microsoft.SourceAnalysis.CSharp.DocumentationRules", "PublicAndProtectedOnly", "IgnorePrivates");

            // Forward this call to the V4.3 rule class for parsing.
            V104Settings.Load(document, settings);
        }
Exemple #2
0
        /// <summary>
        /// Loads the settings from the document.
        /// </summary>
        /// <param name="document">
        /// The settings document.
        /// </param>
        /// <param name="settings">
        /// Stores the settings.
        /// </param>
        public static void Load(XmlDocument document, Settings settings)
        {
            Param.AssertNotNull(document, "document");
            Param.AssertNotNull(settings, "settings");

            // If the PublicAndProtectedOnly property exists on the Documentation analyzer, rename it to IgnorePrivates.
            V102Settings.ChangeAnalyzerSettingName(document, "StyleCop.CSharp.Documentation", "PublicAndProtectedOnly", "IgnorePrivates");

            // Add the global settings if there are any.
            XmlNode globalSettingsNode = document.DocumentElement["GlobalSettings"];

            if (globalSettingsNode != null)
            {
                LoadPropertyCollection(globalSettingsNode, settings.GlobalSettings, settings.Core.PropertyDescriptors, null);
            }

            // Load the parser settings.
            LoadParserSettings(document, settings);

            // Load the analyzers under this parser.
            LoadAnalyzerSettings(document, settings);
        }