Skip to content
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

ExcludeFromCodeCoverage annotation (better name than Generated) #1491

Open
Sti2nd opened this issue Jul 3, 2023 · 2 comments
Open

ExcludeFromCodeCoverage annotation (better name than Generated) #1491

Sti2nd opened this issue Jul 3, 2023 · 2 comments

Comments

@Sti2nd
Copy link

Sti2nd commented Jul 3, 2023

Scenario

  • JaCoCo version: all
  • Operating system: all
  • Tool integration: Maven
  • Description of your use case: Any application, like a Spring Boot app

Current Behaviour

Exclusions are supported in pom.xml and by string matching annotations on the word "Generated" according to Baeldung.com.

Wanted Behaviour

Exlusion based on an annotation with a better name. As inspiration; in .NET there are a C# attribute called ExcludeFromCodeCoverage.

Programmatic configuration is good. Adding a Generated annotation just to exclude from coverage doesn't make sense when the code is not generated. And the current implementation is flawed. An annotation to exclude classes makes sense.

Possible Workarounds

@undermark5
Copy link

It'd be really nice if you could configure your own custom annotations to be excluded. Being able to supply a list of excluded annotations via setting excludeAnnotations would be wonderful. Then the user can decide what annotations mark things as excluded.

I've got Composable Previews that I'd like to exclude from my codecov reports, but I'd like for them to live in the same file as the component they are a preview for. I can make an annotation, but these already have an annotation applied, and the code is also not generated either so requiring generated in the name leaves a bad taste.

@jdelga
Copy link

jdelga commented Feb 12, 2024

Instead of everybody creating a custom annotation that contains "Generated" with the only purpose of excluding it from coverage, it would be great to have one already defined by the library itself 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants