示例#1
0
            public Inspector(IGeneralConfigService configService, IInspectionProvider inspectionProvider)
            {
                _inspections = inspectionProvider.Inspections.ToList();

                _configService = configService;
                configService.SettingsChanged += ConfigServiceSettingsChanged;
            }
        public CodeInspectionConfigProvider(IPersistanceService<CodeInspectionSettings> persister, IInspectionProvider inspectionProvider)
        {
            _persister = persister;
            _foundInspectionNames = inspectionProvider.Inspections.Select(inspection => inspection.Name).ToHashSet();
            _defaultSettings = new DefaultSettings<CodeInspectionSettings>().Default;
            // Ignore settings for unknown inpections, for example when using the Experimental attribute
            _defaultSettings.CodeInspections = _defaultSettings.CodeInspections.Where(setting => _foundInspectionNames.Contains(setting.Name)).ToHashSet();

            var defaultNames = _defaultSettings.CodeInspections.Select(x => x.Name);
            var nonDefaultInspections = inspectionProvider.Inspections.Where(inspection => !defaultNames.Contains(inspection.Name));

            _defaultSettings.CodeInspections.UnionWith(nonDefaultInspections.Select(inspection => new CodeInspectionSetting(inspection)));
        }
示例#3
0
            public Inspector(IConfigurationService <CodeInspectionSettings> configService, IInspectionProvider inspectionProvider)
            {
                _inspections = inspectionProvider.Inspections.ToList();

                _configService = configService;
                configService.SettingsChanged += ConfigServiceSettingsChanged;
            }
        public CodeInspectionConfigProvider(IPersistenceService <CodeInspectionSettings> persister, IInspectionProvider inspectionProvider)
            : base(persister, new DefaultSettings <CodeInspectionSettings, Properties.CodeInspectionDefaults>())
        {
            foundInspectionNames = inspectionProvider.Inspections.Select(inspection => inspection.Name).ToHashSet();
            // Ignore settings for unknown inspections, for example when using the Experimental attribute
            Defaults.Default.CodeInspections = Defaults.Default.CodeInspections.Where(setting => foundInspectionNames.Contains(setting.Name)).ToHashSet();

            var defaultNames          = Defaults.Default.CodeInspections.Select(x => x.Name);
            var nonDefaultInspections = inspectionProvider.Inspections.Where(inspection => !defaultNames.Contains(inspection.Name));

            Defaults.Default.CodeInspections.UnionWith(nonDefaultInspections.Select(inspection => new CodeInspectionSetting(inspection)));
        }