-
Notifications
You must be signed in to change notification settings - Fork 143
SCAN4NET-80 Coverage Exclusions: Apply more granular approach #2196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SCAN4NET-80 Coverage Exclusions: Apply more granular approach #2196
Conversation
return coveragePaths.Where(x => x is not null).ToArray(); | ||
} | ||
|
||
private static string CoveragePaths(List<Property> localProperties, IDictionary<string, string> serverProperties, string propertyName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the main difference.
We take into account local and server settings on an individual property level.
This will help when we implement the directory exclusion for dotCover
.
Tests/SonarScanner.MSBuild.PreProcessor.Test/AnalysisConfigGeneratorTests.cs
Outdated
Show resolved
Hide resolved
Tests/SonarScanner.MSBuild.PreProcessor.Test/AnalysisConfigGeneratorTests.cs
Outdated
Show resolved
Hide resolved
Tests/SonarScanner.MSBuild.PreProcessor.Test/AnalysisConfigGeneratorTests.cs
Outdated
Show resolved
Hide resolved
// The idea is that we are manually adding the coverage paths to the exclusions, so that they do not appear on the analysis. | ||
private static void HandleCoverageExclusions(AnalysisConfig config, ProcessedArgs localSettings, IDictionary<string, string> serverProperties) | ||
private static class CoverageExclusions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that it's a class now. What do you think about:
- extracting it outside of the parent class
- move it to another file
- rename it to coverage exclusions processor and make it an instance type instead of static
- passing it to the constructor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I prefer to leave it private in here, mainly for the following reasons:
- This class is tightly coupled with how we generate the AnalysisConfig
- The test scaffolding needed is more or less the same for
GenerateFile
andUpdateConfig
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I've left two small comments.
Tests/SonarScanner.MSBuild.PreProcessor.Test/AnalysisConfigGeneratorTests.cs
Outdated
Show resolved
Hide resolved
Tests/SonarScanner.MSBuild.PreProcessor.Test/AnalysisConfigGeneratorTests.cs
Outdated
Show resolved
Hide resolved
|
SCAN4NET-80
This PR is mostly a cleanup, to help with implementing the next one soon.
It also adds a more granular approach on which coverage paths to use, as before it was an all-or-nothing approach between local and server-side settings.