Skip to content

Commit

Permalink
NET-1032 AnalysisContext: Rename SyntaxTree to Tree
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-mikula-sonarsource authored and sonartech committed Jan 24, 2025
1 parent a11f629 commit 53c2810
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace SonarAnalyzer.Core.AnalysisContext;

public interface IReportingContext
{
SyntaxTree SyntaxTree { get; }
SyntaxTree Tree { get; }
Diagnostic Diagnostic { get; }

void ReportDiagnostic(Diagnostic diagnostic);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static void ReportIssueCore(Func<DiagnosticDescriptor, bool> hasMatchingS
}
// Standalone NuGet, Scanner run and SonarLint < 4.0 used with latest NuGet
if (!VbcHelper.IsTriggeringVbcError(reportingContext.Diagnostic)
&& (SonarAnalysisContext.ShouldDiagnosticBeReported?.Invoke(reportingContext.SyntaxTree, reportingContext.Diagnostic) ?? true))
&& (SonarAnalysisContext.ShouldDiagnosticBeReported?.Invoke(reportingContext.Tree, reportingContext.Diagnostic) ?? true))
{
reportingContext.ReportDiagnostic(reportingContext.Diagnostic);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class ReportingContext : IReportingContext
{
private readonly Action<Diagnostic> roslynReportDiagnostic;

public SyntaxTree SyntaxTree { get; }
public SyntaxTree Tree { get; }
public Diagnostic Diagnostic { get; }
public Compilation Compilation { get; }

Expand All @@ -42,15 +42,12 @@ public ReportingContext(SonarCodeBlockReportingContext context, Diagnostic diagn
public ReportingContext(SonarSemanticModelReportingContext context, Diagnostic diagnostic)
: this(diagnostic, context.Context.ReportDiagnostic, context.Compilation, context.Tree) { }

internal ReportingContext(Diagnostic diagnostic,
Action<Diagnostic> roslynReportDiagnostic,
Compilation compilation,
SyntaxTree syntaxTree)
internal ReportingContext(Diagnostic diagnostic, Action<Diagnostic> roslynReportDiagnostic, Compilation compilation, SyntaxTree tree)
{
Diagnostic = diagnostic;
this.roslynReportDiagnostic = roslynReportDiagnostic;
Compilation = compilation;
SyntaxTree = syntaxTree;
Tree = tree;
}

public void ReportDiagnostic(Diagnostic diagnostic) =>
Expand Down

0 comments on commit 53c2810

Please sign in to comment.