Closed tonyhallett closed 4 months ago
OK I see the problem. From my point of view we should adapt the documentation and/or consider implementing also the fully qualified attribute name. I don't have any details about why it was decided in the past for coverlet to only check the attribute name. Maybe forgotten to consider or the one implementing this didn't see the need for it. But from my point of view, it wouldn't be much implementation effort to additionally check for the fully qualified name.
I just wonder about the use cases a bit? The only thing I can think of is someone having two attributes with the same name in different namespaces of his application and wants to exclude both of them.
@MarcoRossignoli @Bertk What do you think? Should we implement this? Even if it is just one use case I can think of, it seems valid to me.
Changing the documentation is probably sufficient. Having two similarly named attribute types serving different purposes seems highly unlikely. Bringing it to your attention as it is a bug given the documentation. Fine Code Coverage has been following the documentation all this time. I expect that the only time you would encounter this bug is with .Net Framework where you cannot apply ExcludeFromCodeCoverage at the assembly level. You create and apply your own exclusion attribute and decide to qualify in coverlet.
@daveMueller I think full name shall be supported.
I don't recall but maybe we did some regression here, we could support full name too.
OK I work on this...
Describe the bug From https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/GlobalTool.md
To Reproduce Create a custom attribute, apply it at any level. Supply fully qualified through one of the drivers
Expected behavior Is it excluded
Actual behavior Is not excluded
Additional context https://github.com/coverlet-coverage/coverlet/blob/a0bd87d70f899d955891956ce4173e8bf31c16b0/src/coverlet.core/Instrumentation/Instrumenter.cs#L775
None of the Instrumenter tests supply the attributesToIgnore as fully qualified e.g https://github.com/coverlet-coverage/coverlet/blob/a0bd87d70f899d955891956ce4173e8bf31c16b0/test/coverlet.core.tests/Instrumentation/InstrumenterTests.cs#L150