rubicon-oss / LicenseHeaderManager

Manage license headers for your source code files in Visual Studio

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

File exclusions

moltco opened this issue · comments

Hi, I can't find a way to exclude specific files from processing - this would be a great feature to have.

For example, I stick header on all .cs files but I want to exclude all files that are named special.cs or spec*.cs as they contain special formats that are difficult to define or can't be defined etc. Currently I go and manually remove stuff but this is not feasible when you have hundreds of files you don't want to stick header on and they are of the common filetype.
Thanks

Hi, you can simply define a match-pattern and then not set the license header. The file will be ignored.

See also https://github.com/rubicon-oss/LicenseHeaderManager/wiki/License-Header-Definitions

In case you're referring to a syntax that more than just a suffix-notation, yes, this would be a feature request related to #115

Thanks - as you suggested my request is about prefix not the extension suffix. So I guess similar to #115 (my extension would be that you can use wildcards, but this is not critical for me at this point).

I have tried specifying full file name as extension to avoid single file being stamped with a header by adding

extensions: special.cs
extensions: .cs
// Copyright...

But this did not work. I was hoping that you use something like .EndsWith(...) on the entire filename instead of just extension portion of the filename.

Hi @molt-coder,

I took a peek at the code, you can (a) see here:

extensions = line.Substring (LicenseHeader.Keyword.Length).Split (new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
.Select (LicenseHeader.AddDot);

that everything after extensions: is turned into a file extension regardless and (b) see here:

string extension = Path.GetExtension (item.Name);

that only file extensions are considered when applying license headers, so that's the reason your solution sadly doesn't work.

Best regards,
Stefan

So what is the answer? I also wait for this feature..