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 a filter for namespaces

See original GitHub issue

Describe the bug Our assembly has internal .NUnit classes in the same assembly as the actual code. To get proper code coverage reports I would like to exclude *.NUnit.* classes as they skew the metrics. I tried this with a -classfilters:-*.NUnit.* argument but this didn’t work.

Debugging the issue, I found that the class filter is called with ClassName and not FullName I misinterpreted that class name does not include namespace. I managed to sort of get what I needed by using -classfilters:-*Fixture, but that doesn’t catch all test classes.

To not break existing functionality, can we add an -namespacefilters argument?

I don’t mind contributing this functionality myself.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
manfred-brandscommented, Sep 8, 2020

Release 4.6.7 includes the fix.

Works properly with my original filter: -*.NUnit.*

0reactions
manfred-brandscommented, Sep 8, 2020

I guess adding a separate namespace filter is obsolete. But thanks for your effort! It is obsolete, but was a good exercise going through the code structure.

I only had suggested it based upon the one parser I was using and I didn’t want to break that functionality, not realising that it was the only parser behaving that way. Maybe you can update the documentation to say that the class filter works on the full class name including namespace.

You probably want to fix the broken parsers:

The LCovParser and GCovParser actually pass the fileName + extension to the class filter:

   string className = fileName.Substring(fileName.LastIndexOf(Path.DirectorySeparatorChar) + 1);

Use string className = Path.GetFileNameWithoutExtension(fileName); instead.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to "filter" and "format" namespaces based on the ...
I want to filter namespaces based on the annotation. I do not want namespace which has annotation as components\.gke\.io/layer=="addon" . I ...
Read more >
Using namespaces vs. metadata filtering - Support
This article will discuss the advantages and disadvantages of using namespaces and metadata filtering in your application.
Read more >
How to Filter Namespace in Filebeat Kubernetes: A Guide
Replace "your-namespace" with the namespace you want to filter. Step 3: Apply the Configuration. After you've made the changes, save the file ...
Read more >
Microsoft.AspNetCore.Mvc.Filters Namespace
An interface for filter metadata which can create an instance of an executable filter. IFilterMetadata. Marker interface for filters handled in the MVC ......
Read more >
System.Web.Mvc.Filters Namespace
Explore all classes and interfaces of the System.Web.Mvc.Filters namespace. ... Defines a filter that performs authentication. IOverrideFilter.
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