Skip to content

Conversation

@mbeacom
Copy link

@mbeacom mbeacom commented Jan 28, 2022

The goal of this PR is to allow users to provide a custom copyright string. The copyright string can be used in conjunction with a custom template to ensure duplicate copyright headers are not created when the copyright string doesn't match the pre-defined collection: copyright, mozilla public, or spdx-license-identifier.

EDIT: Any guidance here is appreciated, if someone can spare it. Is there anything else I should plan to do for this PR? @willnorris

Fixes #56

@mbeacom mbeacom force-pushed the feat-custom-license-check branch 3 times, most recently from cbce8ad to 6b3df82 Compare January 28, 2022 21:20
@mbeacom mbeacom force-pushed the feat-custom-license-check branch from 6b3df82 to 2bc243c Compare January 28, 2022 21:46
Copy link
Contributor

@flwyd flwyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it's a good idea to encourage use of (c) instead of the full word "Copyright". While Wikipedia says the U.S. Copyright Office accepts it as a copyright mark, I'm unaware of a reason that it would be preferred over the word "Copyright" at the top of a source code file.

Could you share some example projects that use this convention?

license = flag.String("l", "apache", "license type: apache, bsd, mit, mpl")
licensef = flag.String("f", "", "license file")
year = flag.String("y", fmt.Sprint(time.Now().Year()), "copyright year(s)")
copyright = flag.String("x", "(c)", "custom copyright string used to determine license header presence")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By defining (c) as the default value of the flag, it gets added as a copyright header for anyone who doesn't specify the flag. Empty string is probably a better default, but don't do a Contains check on empty string, because all arrays contain a zero-byte subarray.

Is there a reason you chose x as the flag name? I can't think of a mnemonic. A full-word flag name is probably clearer.

-f custom license file (no default)
-l license type: apache, bsd, mit, mpl (defaults to "apache")
-y year (defaults to current year)
-x custom license check, can be used with custom license to properly check presence of header (defaults to "(c)")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The string "(c)" may result in some false positives, e.g. an (a) (b) (c) list or a reference to a 501(c)3 organization.

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

Successfully merging this pull request may close these issues.

Customize License check string

2 participants