private StyleCopApi CreateApiObject() { return(new StyleCopApi( this.componentLifetime, StyleCopCoreFactory.Create(this.componentLifetime, this.settingsStore, this.fileSystemTracker), this.fileSystemTracker)); }
/// <summary> /// Initializes a new instance of the <see cref="DocumentationRulesConfiguration"/> class. /// </summary> /// <param name="file"> /// The file to get the configuration for. /// </param> public DocumentationRulesConfiguration(IPsiSourceFile file) { this.settings = new StyleCopSettings(StyleCopCoreFactory.Create()).GetSettings(file.ToProjectFile()); this.file = file; // Default for this property is false BooleanProperty property = this.GetStyleCopRuleProperty <BooleanProperty>("IgnorePrivates"); this.IgnorePrivates = property == null ? false : property.Value; // Default for this property is true property = this.GetStyleCopRuleProperty <BooleanProperty>("IncludeFields"); this.RequireFields = property == null ? true : property.Value; // Default for this property is false property = this.GetStyleCopRuleProperty <BooleanProperty>("IgnoreInternals"); this.IgnoreInternals = property == null ? false : property.Value; StringProperty stringProperty = this.GetStyleCopRuleProperty <StringProperty>("CompanyName"); this.CompanyName = stringProperty != null ? stringProperty.Value : string.Empty; stringProperty = this.GetStyleCopRuleProperty <StringProperty>("Copyright"); FileInfo fileInfo = file.ToProjectFile().Location.ToFileInfo(); this.Copyright = stringProperty != null?StyleCop.Utils.ReplaceTokenVariables(stringProperty.Value, fileInfo) : string.Empty; }
/// <summary> /// Initializes a new instance of the HighlightingRegistering class. /// </summary> /// <param name="settingsStore">The settings store.</param> /// <param name="fileSystemTracker"> /// The file System Tracker. /// </param> public HighlightingRegistering(ISettingsStore settingsStore, IFileSystemTracker fileSystemTracker) { // TODO: We shouldn't be doing any of this at runtime, especially not on each load // Registering highlightings should happen declaratively // Create this instance directly, rather than use the pool, because the pool needs to // be per-solution, as it caches settings for files in the solution Lifetimes.Using( temporaryLifetime => { // We don't really need the file system tracker - it's only used when we get // settings, which we don't do as part of highlighting initialisation StyleCopCore core = StyleCopCoreFactory.Create(temporaryLifetime, settingsStore, fileSystemTracker); this.Register(core); }); }
/// <summary> /// Initializes a new instance of the <see cref="DocumentationRulesConfiguration"/> class. /// </summary> /// <param name="file"> /// The file to get the configuration for. /// </param> public DocumentationRulesConfiguration(IProjectFile file) { this.settings = new StyleCopSettings(StyleCopCoreFactory.Create()).GetSettings(file); // Default for this property is false BooleanProperty property = this.GetStyleCopRuleProperty <BooleanProperty>("IgnorePrivates"); this.IgnorePrivates = property == null ? false : property.Value; // Default for this property is true property = this.GetStyleCopRuleProperty <BooleanProperty>("IncludeFields"); this.RequireFields = property == null ? true : property.Value; // Default for this property is false property = this.GetStyleCopRuleProperty <BooleanProperty>("IgnoreInternals"); this.IgnoreInternals = property == null ? false : property.Value; StringProperty stringProperty = this.GetStyleCopRuleProperty <StringProperty>("CompanyName"); this.CompanyName = stringProperty != null ? stringProperty.Value : string.Empty; stringProperty = this.GetStyleCopRuleProperty <StringProperty>("Copyright"); this.Copyright = stringProperty != null ? stringProperty.Value : string.Empty; }