From d810ff251adde5855919a4db23cb633ca9000a6f Mon Sep 17 00:00:00 2001 From: mary-georgiou-sonarsource Date: Wed, 15 Mar 2023 14:40:15 +0100 Subject: [PATCH] put comment in a better position --- .../AnalysisContext/SonarAnalysisContextBase.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/analyzers/src/SonarAnalyzer.Common/AnalysisContext/SonarAnalysisContextBase.cs b/analyzers/src/SonarAnalyzer.Common/AnalysisContext/SonarAnalysisContextBase.cs index c7c86996388..144c6b41a3a 100644 --- a/analyzers/src/SonarAnalyzer.Common/AnalysisContext/SonarAnalysisContextBase.cs +++ b/analyzers/src/SonarAnalyzer.Common/AnalysisContext/SonarAnalysisContextBase.cs @@ -126,8 +126,10 @@ public bool HasMatchingScope(DiagnosticDescriptor descriptor) } private bool FileIsIncludedInAnalysis(SonarLintXmlReader sonarLintXml, string filePath) => - ProjectConfiguration().ProjectType != ProjectType.Unknown // If ProjectType != 'Unknown' we are in S4NET context and all files are analyzed. - // If ProjectType == 'Unknown' then we are in SonarLint or NuGet context and we need to check if the file has been excluded from analysis through SonarLint.xml. + // If ProjectType != 'Unknown' we are in S4NET context and all files are analyzed. + // If ProjectType == 'Unknown' then we are in SonarLint or NuGet context and + // we need to check if the file has been excluded from analysis through SonarLint.xml. + ProjectConfiguration().ProjectType != ProjectType.Unknown || (FileInclusionCache.GetValue(Compilation, _ => new()) is var cache && cache.GetOrAdd(filePath, _ => IsFileIncluded(sonarLintXml, filePath)));