google / addlicense

A program which ensures source code files have copyright license headers by scanning directory patterns recursively
Apache License 2.0
724 stars 170 forks source link

Skip extensions or files #75

Closed cpanato closed 3 years ago

cpanato commented 3 years ago

This PR adds the feature to skip extensions or files to be checked or add the license header. In some cases, we don't want to add the headers for some files, and will be useful if we can just skip those.

After I did the implementation I saw the PR: https://github.com/google/addlicense/pull/73

If the maintainers prefer the other approach I'm fine and we can close this PR

lukehinds commented 3 years ago

not a addlicense maintainer , but fwiy this is really useful. right now builds are failing as the code is looking for license headers in everything (including docs, , readmes, config files etc).

mco-gh commented 3 years ago

Hi, sorry for the delay. At a quick glance, PR 73 looks like it provides more functionality, because it supports patterns, not just extensions, and it supports excluding directories as well as individual files. Would it cover your needs? Any reason you wouldn't prefer it?

cpanato commented 3 years ago

I'm not against it, just open it because I saw that PR after :/

I did some tests and that covers the use case we are looking to implement.

So I'm ok in close this in favor of #73 @mco-gh

mco-gh commented 3 years ago

Actually, on second thought, this covers the most common use case (extension based files) and it's a lot less involved (one file changed vs. 31) so I'm gonna go with this one. Thanks for the contrib! I may take the other one later but this feels like the safer option to add this functionality.

Shabirmean commented 3 years ago

@cpanato - Thanks for adding this!

@mco-gh - the 31 file changes on PR #73 is because I added extensive test cases :) Technically it only has one file change and everything else is a new test file added to validate different folder structures.