Skip to content
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

Exclude C# auto-generated files #229

Closed
ghost opened this issue Feb 18, 2021 · 4 comments
Closed

Exclude C# auto-generated files #229

ghost opened this issue Feb 18, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@ghost
Copy link

ghost commented Feb 18, 2021

Describe the bug
In C#/.NET Projects auto-generated files are marked on top of a file with a comment:

// <auto-generated />

This is especially the case if you use the OR-Mapper Entity Framework where a lot of this auto-generated files are created in larger projects (due to database-Migration files) resulting in a unrealistic LOC result (e.g. in one project >50% of the "total" LOC are actually auto-generated).
Files cannot be simply git-ignored because these files are necessary.

To Reproduce

  1. Run scc on a folder containing a C# sharp file with the <auto-generated /> comment
  2. Result also counts these files in

Expected behavior
C# Files with the <auto-generated /> header shouldn't be counted. Similar to the lock-files issue #206 but with C# files.

Desktop (please complete the following information):

  • OS: Windows 10
  • scc version 2.13.0
@ghost ghost changed the title Should exclude C# auto-generated files Exclude C# auto-generated files Feb 18, 2021
boyter added a commit that referenced this issue Feb 18, 2021
@boyter
Copy link
Owner

boyter commented Feb 18, 2021

So this is already possible right now with the right command line options. Not quite the same as #206 because that was looking at the extension. So if you want this right now,

 scc --generated-markers "<auto-generated />" --no-min-gen

or if you have multiple

scc --generated-markers "<auto-generated />","do not edit" --no-min-gen

What I can do however is add <auto-generated /> into the default list so you can then run like so

scc --no-min-gen

So its more natural. Note that if minified enabled by this is picking up things you want counted you can tweak the line length to something stupidly large.

scc --no-min-gen --min-gen-line-length 500000000

For the moment I have added <auto-generated /> into the list of special strings scc looks for 36a3fd2

@boyter boyter added the enhancement New feature or request label Feb 18, 2021
@ghost
Copy link
Author

ghost commented Feb 19, 2021

Thanks for the quick reply. Really appreciate it!

I guess it's fine using --generated-markers for now but I would consider it adding it to the default list and then only having to specify the --no-min-gen flag as you suggested it as it is a really common C# thing.

Thank you very much 👍

@boyter
Copy link
Owner

boyter commented Feb 21, 2021

Yep added to the list in master already. Building from there will give you this.

Will be rolled out in the 3.0.0 release which should be sooner rather than later now that Go 1.16 is out.

@boyter
Copy link
Owner

boyter commented Feb 21, 2021

Closing as its done on master, but still waiting on the 3.0.0 release.

@boyter boyter closed this as completed Feb 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant