コード例 #1
0
        internal static PropertyBag BuildDefaultPropertyBag()
        {
            PropertyBag allOptions = new PropertyBag();

            // The export command could be updated in the future to accept an arbitrary set
            // of analyzers for which to build an options XML file suitable for configuring them.
            // Currently, we perform discovery against the built-in CodeFormatter rules
            // and analyzers only.
            foreach (IOptionsProvider provider in FormattingEngine.GetOptionsProviders(DefaultCompositionAssemblies))
            {
                foreach (IOption option in provider.GetOptions())
                {
                    allOptions.SetProperty(option, option.DefaultValue);
                }
            }

            // TODO: this needs to be fixed. Instead of maintaining a hard-coded list of analyzers, that needs to
            //       be updated on adding a new check, we need to expose the analyzer name on an appropriate interface.
            //       Retrieving each of these bools populates the property bag with the default value of 'true'
            bool enabled;

            foreach (string analyzerName in AllAnalyzerNames)
            {
                enabled = allOptions.GetProperty(BuildDefaultEnabledProperty(analyzerName));
            }
            return(allOptions);
        }