Skip to content

GeneratedCodeAttribute #125

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

Closed
kimbell opened this issue Jun 20, 2018 · 5 comments
Closed

GeneratedCodeAttribute #125

kimbell opened this issue Jun 20, 2018 · 5 comments

Comments

@kimbell
Copy link

kimbell commented Jun 20, 2018

Tried out this functionality and love the approach.

When running the coverage through coverlet, I noticed a significant drop compared to when running under Resharper.

My project has a lot of auto-generated code for WCF and Swagger clients. These are marked with the GeneratedCodeAttribute. It would be a good idea to add this to the list of attributes that excludes code.

@tonerdo
Copy link
Collaborator

tonerdo commented Jun 20, 2018

Hi @kimbell, take a look at this https://github.com/tonerdo/coverlet#excluding-from-coverage to get an idea how to ignore your generated code. Let me know if you need any help

@kimbell
Copy link
Author

kimbell commented Jun 21, 2018

We have multiple projects and we use cake as the build system. One of our goals is to keep the cake file the same across each project so that it's easy to update things.

If we need to exclude namespaces, we would need some way of keeping that configuration external to the cake file. It's possible, but seems like a bit of a hassle. This would also mean that you would have to ensure that the code is generating code into namespaces you don't use for your custom code. This is also possible, but not very intuitive.

Would it be possible to provide as list of attributes that should be used for exclusion on the command line?

What is the argument for not excluding generated code?

@tonerdo
Copy link
Collaborator

tonerdo commented Jun 22, 2018

Why not just exclude the generated files using the ExcludeByFile property? https://github.com/tonerdo/coverlet#source-files

@kimbell
Copy link
Author

kimbell commented Jun 22, 2018

ExcludeByFile is an option, but I would still have to maintain a list for each project if I am to share the build configuration. Doable, but nice to avoid if possible.

@MarcoRossignoli
Copy link
Collaborator

You can now use p:ExcludeByAttribute feature https://github.com/tonerdo/coverlet/blob/589e210e740bbf243cb0e57acbff7bf4e1ea8a66/Documentation/MSBuildIntegration.md#attributes

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

No branches or pull requests

3 participants