From 53c28106f017cc965bfb472123a3b42cd467cf14 Mon Sep 17 00:00:00 2001 From: Pavel Mikula <57188685+pavel-mikula-sonarsource@users.noreply.github.com> Date: Thu, 23 Jan 2025 17:23:02 +0100 Subject: [PATCH] NET-1032 AnalysisContext: Rename SyntaxTree to Tree --- .../AnalysisContext/IReportingContext.cs | 2 +- .../SonarAnalyzer.Core/AnalysisContext/IssueReporter.cs | 2 +- .../AnalysisContext/ReportingContext.cs | 9 +++------ 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/analyzers/src/SonarAnalyzer.Core/AnalysisContext/IReportingContext.cs b/analyzers/src/SonarAnalyzer.Core/AnalysisContext/IReportingContext.cs index a3b1e00f39e..fe98ee9a4d4 100644 --- a/analyzers/src/SonarAnalyzer.Core/AnalysisContext/IReportingContext.cs +++ b/analyzers/src/SonarAnalyzer.Core/AnalysisContext/IReportingContext.cs @@ -18,7 +18,7 @@ namespace SonarAnalyzer.Core.AnalysisContext; public interface IReportingContext { - SyntaxTree SyntaxTree { get; } + SyntaxTree Tree { get; } Diagnostic Diagnostic { get; } void ReportDiagnostic(Diagnostic diagnostic); diff --git a/analyzers/src/SonarAnalyzer.Core/AnalysisContext/IssueReporter.cs b/analyzers/src/SonarAnalyzer.Core/AnalysisContext/IssueReporter.cs index 0678d8d6d79..70dc4c9b9f8 100644 --- a/analyzers/src/SonarAnalyzer.Core/AnalysisContext/IssueReporter.cs +++ b/analyzers/src/SonarAnalyzer.Core/AnalysisContext/IssueReporter.cs @@ -77,7 +77,7 @@ public static void ReportIssueCore(Func 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); } diff --git a/analyzers/src/SonarAnalyzer.Core/AnalysisContext/ReportingContext.cs b/analyzers/src/SonarAnalyzer.Core/AnalysisContext/ReportingContext.cs index 8294421c940..7f47b614165 100644 --- a/analyzers/src/SonarAnalyzer.Core/AnalysisContext/ReportingContext.cs +++ b/analyzers/src/SonarAnalyzer.Core/AnalysisContext/ReportingContext.cs @@ -20,7 +20,7 @@ public class ReportingContext : IReportingContext { private readonly Action roslynReportDiagnostic; - public SyntaxTree SyntaxTree { get; } + public SyntaxTree Tree { get; } public Diagnostic Diagnostic { get; } public Compilation Compilation { get; } @@ -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 roslynReportDiagnostic, - Compilation compilation, - SyntaxTree syntaxTree) + internal ReportingContext(Diagnostic diagnostic, Action roslynReportDiagnostic, Compilation compilation, SyntaxTree tree) { Diagnostic = diagnostic; this.roslynReportDiagnostic = roslynReportDiagnostic; Compilation = compilation; - SyntaxTree = syntaxTree; + Tree = tree; } public void ReportDiagnostic(Diagnostic diagnostic) =>