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 files based on file header and directory. (ex.: Auto generated) #55

Open
t4m45 opened this issue Jul 11, 2023 · 1 comment
Open

Comments

@t4m45
Copy link

t4m45 commented Jul 11, 2023

If possible, please add an option to exclude files based on their header.
Multiple auto generated files have either an <auto-generated /> tag or just a simple // auto generated comment.

I use LinqConnect which generated over 200 .cs files for me, so excluding them by extension would not work.

Also excluding a whole directory would come in handy as well.

In the .formatconfig it could look like this:

[*]
enable = true
allowed_extensions =
denied_extensions = .js .html .editorconfig
# new settings
denied_directories = lib res externals/helpers
denied_headers = auto-generated

Using this, if there were multiple helpers directories, only the one thats placed in an externals directory would be excluded.
You could use the format externals\\helpers instead of externals/helpers if you want to.

The extension should read the file's first, or first x lines and look for the strings set in the denied_headers field, and if any of them are found, the formatting should be cancelled.

@mynkow
Copy link
Member

mynkow commented Aug 2, 2024

@t4m45 there is a PR similar to your request. Would you mind if you take a quick look and tell us what do you think?

#62

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants