Skip to content

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

Merged

Conversation

gregory-paidis-sonarsource
Copy link
Contributor

@gregory-paidis-sonarsource gregory-paidis-sonarsource commented Sep 16, 2024

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.

@terraform-techuser terraform-techuser changed the title Coverage Exclusions: Apply more granular approach SCAN4NET-80 Coverage Exclusions: Apply more granular approach Sep 16, 2024
return coveragePaths.Where(x => x is not null).ToArray();
}

private static string CoveragePaths(List<Property> localProperties, IDictionary<string, string> serverProperties, string propertyName)
Copy link
Contributor Author

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.

// 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

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

Copy link
Contributor Author

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 and UpdateConfig

Copy link
Member

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.

Copy link

@gregory-paidis-sonarsource gregory-paidis-sonarsource merged commit 8212179 into master Sep 17, 2024
14 checks passed
@gregory-paidis-sonarsource gregory-paidis-sonarsource deleted the greg/coverage-exclusions-granularity branch September 17, 2024 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants