Skip to content

Commit

Permalink
Review 1
Browse files Browse the repository at this point in the history
  • Loading branch information
gregory-paidis-sonarsource committed Aug 23, 2024
1 parent 8c6271d commit 830b5d8
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private static void AddSetting(AnalysisProperties properties, string id, string
}
}

// TODO:
// See https://sonarsource.atlassian.net/browse/SCAN4NET-29
// This method is a hack and should be removed when we properly support excluding coverage files in the scanner-engine.
// Instead, it should be replaced at the call site by "localSettings.CmdLineProperties.GetAllProperties()".
// The idea is that we are manually adding the coverage paths to the exclusions, so that they do not appear on the analysis.
Expand All @@ -121,9 +121,8 @@ private static List<Property> GetCommandLineProperties(ProcessedArgs localSettin
"sonar.cs.dotcover.reportsPaths",
"sonar.cs.opencover.reportsPaths",
];

var allProperties = localSettings.CmdLineProperties.GetAllProperties().ToList();
var coveragePaths = GetCoveragePaths();
var coveragePaths = string.Join(",", allProperties.Where(x => coveragePropertyNames.Contains(x.Id)).Select(x => x.Value));
if (!localSettings.ScanAllAnalysis // if scanAll analysis is disabled, we will not pick up the coverage files anyways
|| coveragePaths.Length == 0) // if there are no coverage files, there is nothing to exclude
{
Expand All @@ -140,8 +139,5 @@ private static List<Property> GetCommandLineProperties(ProcessedArgs localSettin
}

return allProperties;

string GetCoveragePaths() =>
string.Join(",", allProperties.Where(x => coveragePropertyNames.Contains(x.Id)).Select(x => x.Value));
}
}

0 comments on commit 830b5d8

Please sign in to comment.