Exemple #1
0
        public ComplexityAnalysisOptionPage(Lifetime lifetime, OptionsSettingsSmartContext optionsSettingsSmartContext,
                                            ILanguages languages, ILanguageManager languageManager)
            : base(lifetime, optionsSettingsSmartContext)
        {
            AddText("Specify cyclomatic complexity thresholds:");

            var thresholds = OptionsSettingsSmartContext.Schema.GetIndexedEntry((CyclomaticComplexityAnalysisSettings s) => s.Thresholds);

            var list = new List <LanguageSpecificComplexityProperties>();

            foreach (var languageType in languages.All.Where(languageManager.HasService <IControlFlowBuilder>).OrderBy(GetPresentableName))
            {
                var presentableName = GetPresentableName(languageType);
                var thing           = new LanguageSpecificComplexityProperties(lifetime, optionsSettingsSmartContext, thresholds, languageType.Name, presentableName, CyclomaticComplexityAnalysisSettings.DefaultThreshold);
                list.Add(thing);
            }

            // TODO: Do we want to add any keywords for the list view?
            // We would use OptionEntities.Add if the view model also implements IOptionEntity,
            // or use RegisterWord if we just want to add keyword(s)
            // (But the list view is just language name + threshold, so not very interesting)
            AddCustomOption(new ComplexityAnalysisOptionsViewModel(list));
            OptionEntities.Add(new HyperlinkOptionViewModel(lifetime, "What is a good threshold value?",
                                                            new DelegateCommand(() => Process.Start("https://github.com/JetBrains/resharper-cyclomatic-complexity/blob/master/docs/ThresholdGuidance.md#readme"))));
            FinishPage();
        }
        public ComplexityAnalysisOptionPage(Lifetime lifetime, OptionsSettingsSmartContext optionsSettingsSmartContext, 
                                        ILanguages languages, ILanguageManager languageManager)
            : base(lifetime, optionsSettingsSmartContext)
        {
            AddText("Specify cyclomatic complexity thresholds:");

              var thresholds = OptionsSettingsSmartContext.Schema.GetIndexedEntry((CyclomaticComplexityAnalysisSettings s) => s.Thresholds);

              var list = new List<LanguageSpecificComplexityProperties>();
              foreach (var languageType in languages.All.Where(languageManager.HasService<IControlFlowBuilder>).OrderBy(GetPresentableName))
              {
            var presentableName = GetPresentableName(languageType);
            var thing = new LanguageSpecificComplexityProperties(lifetime, optionsSettingsSmartContext, thresholds, languageType.Name, presentableName, CyclomaticComplexityAnalysisSettings.DefaultThreshold);
            list.Add(thing);
              }

              // TODO: Do we want to add any keywords for the list view?
              // We would use OptionEntities.Add if the view model also implements IOptionEntity,
              // or use RegisterWord if we just want to add keyword(s)
              // (But the list view is just language name + threshold, so not very interesting)
              AddCustomOption(new ComplexityAnalysisOptionsViewModel(list));
              OptionEntities.Add(new HyperlinkOptionViewModel(lifetime, "What is a good threshold value?",
            new DelegateCommand(() => Process.Start("https://github.com/JetBrains/resharper-cyclomatic-complexity/blob/master/docs/ThresholdGuidance.md#readme"))));
              FinishPage();
        }