[Question] [Possible Issue] exclude-by-attributes does not work for classes and globals
See original GitHub issueHello,
while setting up the code coverage in my code using coverlet i found the problem below.
When using --exclude-by-attribute 'Obsolete,GeneratedCode,CompilerGenerated'
It will not exclude files like Resource Designer files (The generated files from .resx)
The generated file is like this:
namespace NameSpace.Resources {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class Exceptions {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Exceptions() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("NameSpace.Resources.Exceptions", typeof(Exceptions).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to Please see inner errors property..
/// </summary>
public static string ApiValidation_Default_Error_Message {
get {
return ResourceManager.GetString("ApiValidation_Default_Error_Message", resourceCulture);
}
}
}
}
Any help or clarification will be very much appreciated.
Best,
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
[Question] [Possible Issue] exclude-by-attributes does not ...
Hello, while setting up the code coverage in my code using coverlet i found the problem below. When using --exclude-by-attribute 'Obsolete ...
Read more >python - global variable not working properly inside class
1. The data variable is not global it's in the containing functions scope/closure - you need to use nonlocal instead of global. –...
Read more >object oriented - Module with globals or Class with attributes?
So my question is: What is the best practice in this situation. Do I keep writing code that are modules using global variables...
Read more >Global Variables are not declared after reopening the file
Open workflow with an error. Click on the activity using the variable. Repeat for all the errors. I decided to use global variables...
Read more >Using and Creating Global Variables in Your Python ...
In this tutorial, you'll learn how to use global variables in Python functions using the global keyword or the built-in globals() function.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello @MarcoRossignoli , So after digging around i found why it is failing. The short answer is that the documentation is not up to date. The long answer is that the parameter can only ever take one attribute and if you want more than that you just copy the parameter as many times as you want.
Documentation example:
coverlet .... --exclude-by-attribute 'Obsolete,GeneratedCode,CompilerGenerated'
Actual working sample:
coverlet ... --exclude-by-attribute 'Obsolete' --exclude-by-attribute'GeneratedCode' --exclude-by-attribute 'CompilerGenerated'
Also here you can see the repository with the examples and more info: Coverlet-issue-592
Best,
Yep seem a documentation issue, thanks for reporting!