question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for exclude by attribute

See original GitHub issue

As of now, coverlet could exclude any classes/methods/properties decorated with ExcludeFromCodeCoverage attribute. However, it does not applicable for code annotated by other attributes like GeneratedCodeAttribute nor CompilerGeneratedAttribute. In short, it does not allow user to exclude with arbitrary attribute. This is one of most common feature for other coverage tool (e.g. dotcover) that I usually use.

There are already demands to this feature, as listed below:

  • #194 - CompilerGeneratedAttribute
  • #125 - GeneratedCodeAttribute

The feature will have the following criteria:

  1. Add additional argument parameter --exclude-by-attribute for CLI tool
  2. Add additional MSBUILD property ExcludeByAttribute
  3. Existing implementation to exclude code annotated by ExcludeByCodeCoverage remains as is
  4. Exclusion list could be arbitrary specified in multiple, delimited by ,, just like existing Exclude list.
  5. Any code, i.e.: classes, properties, and methods annotated with listed attributes, will be ignored from coverage.
  6. The behavior of criteria 5 above, will be similar to how existing ExcludeByCodeCoverage works.

TQ.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
amweisscommented, Nov 20, 2018

I believe this is working as part of the build tasks now, @nordinrahman and @tonerdo is there anything left needed to merge #233 ?

1reaction
amweisscommented, Nov 5, 2018

@nordinrahman if you can, please try to clone my PR (#233) and see if it meets your needs, it passed the basic tests but I’m struggling a bit to see good ways to test it while in development.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add support for exclude by attribute · Issue #232 · coverlet- ...
As of now, coverlet could exclude any classes/methods/properties decorated with ExcludeFromCodeCoverage attribute.
Read more >
Exclude attribute value
Hi! Is thare any way to exclude products with attribute value? Let say I have attribute status. It has few numeric values to...
Read more >
Attribute Rules - Exclude from Application Evaluation
When unchecked, "Exclude from Application Evaluation" property tells the application that its "safe" to execute this rule locally before sending ...
Read more >
Code coverage - attribute driven exclusion - SonarCloud
I am really struggling to find any support around attribute driven exclusions - or any support at all really for !java users…
Read more >
ObfuscationAttribute.Exclude Property (System.Reflection)
Gets or sets a Boolean value indicating whether the obfuscation tool should exclude the type or member from obfuscation.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found