public IssueProvider(CodeIssueProvider provider) { if (provider == null) { throw new ArgumentNullException("provider"); } this.ProviderType = provider.GetType(); var attributes = ProviderType.GetCustomAttributes(typeof(IssueDescriptionAttribute), true); Severity defaultSeverity = Severity.Hint; if (attributes.Length == 1) { this.Attribute = (IssueDescriptionAttribute)attributes[0]; defaultSeverity = this.Attribute.Severity; IsRedundancy = this.Attribute.Category == IssueCategories.RedundanciesInCode || this.Attribute.Category == IssueCategories.RedundanciesInDeclarations; } else { SD.Log.Warn("Issue provider without attribute: " + ProviderType); } var properties = PropertyService.NestedProperties("CSharpIssueSeveritySettings"); this.CurrentSeverity = properties.Get(ProviderType.FullName, defaultSeverity); }
public given_a_project() { tree = SyntaxTree.ParseCompilationUnit(Code); var mockDoc = mockRepos.Create <IDocument>(); mockDoc.Setup(x => x.GetSyntaxTree(It.IsAny <CancellationToken>())) .Returns(tree); document = mockDoc.Object; var mockEditFactory = mockRepos.Create <ICodeActionEditFactory>(); sut = new CodeIssueProvider(mockEditFactory.Object); }
public InspectorResults(CodeIssueProvider inspector, DomRegion region, string message, Severity level, IssueMarker mark, params GenericFix[] fixes) : base(region, message, level, mark, fixes) { this.Inspector = inspector; }
public static void AddProvider(CodeIssueProvider provider) { inspectors.Add(provider); }
protected static List <CodeIssue> GetIssuesWithSubIssue(CodeIssueProvider action, string input, string subIssue, out TestRefactoringContext context, bool expectErrors = false) { context = TestRefactoringContext.Create(input, expectErrors); return(new List <CodeIssue> (action.GetIssues(context, subIssue))); }
protected static List <CodeIssue> GetIssues(CodeIssueProvider action, string input, out TestRefactoringContext context, bool expectErrors = false, CSharpParser parser = null) { context = TestRefactoringContext.Create(input, expectErrors, parser); return(new List <CodeIssue> (action.GetIssues(context))); }