Пример #1
0
 public UserSettings(DisplayLanguageSetting languageSetting,
                     ToDoListSettings todoSettings,
                     CodeInspectionSettings codeInspectionSettings)
 {
     LanguageSetting        = languageSetting;
     ToDoListSettings       = todoSettings;
     CodeInspectionSettings = codeInspectionSettings;
 }
Пример #2
0
 public UserSettings(DisplayLanguageSetting languageSetting,
                     ToDoListSettings todoSettings, 
                     CodeInspectionSettings codeInspectionSettings)
 {
     LanguageSetting = languageSetting;
     ToDoListSettings = todoSettings;
     CodeInspectionSettings = codeInspectionSettings;
 }
        public CodeInspectionSettings Create(IEnumerable <IInspection> inspections)
        {
            if (inspections == null)
            {
                return(null);
            }

            _inspections = inspections;
            var prototype = new CodeInspectionSettings(GetDefaultCodeInspections());

            return(_persister.Load(prototype) ?? prototype);
        }
Пример #4
0
 public UserSettings(GeneralSettings generalSettings,
                     ToDoListSettings todoSettings,
                     CodeInspectionSettings codeInspectionSettings,
                     UnitTestSettings unitTestSettings,
                     IndenterSettings indenterSettings)
 {
     GeneralSettings        = generalSettings;
     ToDoListSettings       = todoSettings;
     CodeInspectionSettings = codeInspectionSettings;
     UnitTestSettings       = unitTestSettings;
     IndenterSettings       = indenterSettings;
 }
Пример #5
0
 public UserSettings(GeneralSettings generalSettings,
                     HotkeySettings hotkeySettings,
                     ToDoListSettings todoSettings,
                     CodeInspectionSettings codeInspectionSettings,
                     UnitTestSettings unitTestSettings,
                     IndenterSettings indenterSettings,
                     WindowSettings windowSettings)
 {
     GeneralSettings        = generalSettings;
     HotkeySettings         = hotkeySettings;
     ToDoListSettings       = todoSettings;
     CodeInspectionSettings = codeInspectionSettings;
     UnitTestSettings       = unitTestSettings;
     IndenterSettings       = indenterSettings;
     WindowSettings         = windowSettings;
 }
        private Configuration GetNondefaultConfig()
        {
            var inspectionSettings = new CodeInspectionSettings
            {
                CodeInspections = new[]
                {
                    new CodeInspectionSetting("DoNotShowInspection", "Do not show me", CodeInspectionType.LanguageOpportunities, CodeInspectionSeverity.DoNotShow, CodeInspectionSeverity.Warning),
                    new CodeInspectionSetting("HintInspection", "I'm a hint", CodeInspectionType.LanguageOpportunities, CodeInspectionSeverity.Hint, CodeInspectionSeverity.Suggestion),
                    new CodeInspectionSetting("SuggestionInspection", "I'm a suggestion", CodeInspectionType.MaintainabilityAndReadabilityIssues, CodeInspectionSeverity.Suggestion, CodeInspectionSeverity.Hint),
                    new CodeInspectionSetting("WarningInspection", "I'm a warning", CodeInspectionType.CodeQualityIssues, CodeInspectionSeverity.Warning, CodeInspectionSeverity.Error),
                    new CodeInspectionSetting("ErrorInspection", "FIX ME!", CodeInspectionType.CodeQualityIssues, CodeInspectionSeverity.Error, CodeInspectionSeverity.DoNotShow),
                    new CodeInspectionSetting("NondefaultSeverityInspection", "I do not have my original severity", CodeInspectionType.LanguageOpportunities, CodeInspectionSeverity.Warning, CodeInspectionSeverity.Error)
                }
            };

            var userSettings = new UserSettings(null, null, inspectionSettings, null, null);
            return new Configuration(userSettings);
        }
        private Configuration GetNondefaultConfig()
        {
            var generalSettings = new Rubberduck.Settings.GeneralSettings
            {
                Language = new DisplayLanguageSetting("sv-SE"),
                HotkeySettings = new[]
                {
                    new HotkeySetting{Name="IndentProcedure", IsEnabled=false, Key1="CTRL-C"},
                    new HotkeySetting{Name="IndentModule", IsEnabled=false, Key1="CTRL-X"}
                },
                AutoSaveEnabled = true,
                AutoSavePeriod = 5
            };

            var todoSettings = new ToDoListSettings
            {
                ToDoMarkers = new[]
                {
                    new ToDoMarker("PLACEHOLDER ")
                }
            };

            var inspections = Inspections().Select(i => new CodeInspectionSetting(i)).ToArray();
            inspections[0].Severity = CodeInspectionSeverity.Warning;
            inspections[1].Severity = CodeInspectionSeverity.Suggestion;
            inspections[2].Severity = CodeInspectionSeverity.Hint;
            inspections[3].Severity = CodeInspectionSeverity.Error;
            inspections[4].Severity = CodeInspectionSeverity.DoNotShow;
            inspections[5].Severity = CodeInspectionSeverity.Error;

            var inspectionSettings = new CodeInspectionSettings
            {
                CodeInspections = inspections
            };

            var unitTestSettings = new Rubberduck.Settings.UnitTestSettings
            {
                BindingMode = BindingMode.EarlyBinding,
                AssertMode = AssertMode.PermissiveAssert,
                ModuleInit = false,
                MethodInit = false,
                DefaultTestStubInNewModule = true
            };

            var indenterSettings = new Rubberduck.Settings.IndenterSettings
            {
                IndentEntireProcedureBody = false,
                IndentFirstCommentBlock = false,
                IndentFirstDeclarationBlock = false,
                AlignCommentsWithCode = false,
                AlignContinuations = false,
                IgnoreOperatorsInContinuations = false,
                IndentCase = true,
                ForceDebugStatementsInColumn1 = true,
                ForceCompilerDirectivesInColumn1 = true,
                IndentCompilerDirectives = false,
                AlignDims = true,
                AlignDimColumn = 16,
                EnableUndo = false,
                EndOfLineCommentStyle = Rubberduck.SmartIndenter.EndOfLineCommentStyle.Absolute,
                EndOfLineCommentColumnSpaceAlignment = 60,
                IndentSpaces = 2
            };

            var userSettings = new UserSettings(generalSettings, todoSettings, inspectionSettings, unitTestSettings, indenterSettings);
            return new Configuration(userSettings);
        }
        private Configuration GetDefaultConfig()
        {
            var generalSettings = new Rubberduck.Settings.GeneralSettings
            {
                Language = new DisplayLanguageSetting("en-US"),
                HotkeySettings = new[]
                {
                    new HotkeySetting{Name="IndentProcedure", IsEnabled=true, Key1="^P"},
                    new HotkeySetting{Name="IndentModule", IsEnabled=true, Key1="^M"}
                },
                AutoSaveEnabled = false,
                AutoSavePeriod = 10
            };

            var todoSettings = new ToDoListSettings
            {
                ToDoMarkers = new[]
                {
                    new ToDoMarker("NOTE "),
                    new ToDoMarker("TODO "),
                    new ToDoMarker("BUG ")
                }
            };

            var inspectionSettings = new CodeInspectionSettings
            {
                CodeInspections = Inspections().Select(i => new CodeInspectionSetting(i)).ToArray()
            };

            var unitTestSettings = new Rubberduck.Settings.UnitTestSettings
            {
                BindingMode = BindingMode.LateBinding,
                AssertMode = AssertMode.StrictAssert,
                ModuleInit = true,
                MethodInit = true,
                DefaultTestStubInNewModule = false
            };

            var indenterSettings = new Rubberduck.Settings.IndenterSettings
            {
                IndentEntireProcedureBody = true,
                IndentFirstCommentBlock = true,
                IndentFirstDeclarationBlock = true,
                AlignCommentsWithCode = true,
                AlignContinuations = true,
                IgnoreOperatorsInContinuations = true,
                IndentCase = false,
                ForceDebugStatementsInColumn1 = false,
                ForceCompilerDirectivesInColumn1 = false,
                IndentCompilerDirectives = true,
                AlignDims = false,
                AlignDimColumn = 15,
                EnableUndo = true,
                EndOfLineCommentStyle = Rubberduck.SmartIndenter.EndOfLineCommentStyle.AlignInColumn,
                EndOfLineCommentColumnSpaceAlignment = 50,
                IndentSpaces = 4
            };

            var userSettings = new UserSettings(generalSettings, todoSettings, inspectionSettings, unitTestSettings, indenterSettings);
            return new Configuration(userSettings);
        }
 public void Save(CodeInspectionSettings settings)
 {
     _persister.Save(settings);
 }