Conversation
Author
|
Poking @kewisch @davinotdavid @rwood-moz for review (since I cannot assign reviewers in this repo). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed?
This PR provides an
add-license-headers.shtool that checks or adds MPL 2.0 license headers to source files. The script is capable of:The script only touches file types a comment style is known for (see
scripts/license-comment-styles.conf). Everything else (images, lockfiles, Markdown, JSON, ...) is left alone.I also implemented a
.license-ignorein gitignore syntax style to exclude directories or files from the checker.Optionally both files can be overridden by repositories to provide own comment styles or ignore list.
A small test suite of 34 tests was added covering different file types and cases.
See see
docs/license-headers.mdfor more documentation.Why?
MPL is a per-file license. This tool tries to provide a low-effort way to check repositories for missing license entries and include that in their CI.
Limitations and Notes
'This Source Code Form is subject to the terms of the Mozilla Public'in a file. This is the first line that's always the same for every comment style. We might want to extend on this to check for more (e.g. the second line tooLicense, v. 2.0. If a copy of the MPL was not distributed with this) and also to check for the top of the file (not implemented yet).Applicable Issues
Closes #29
Screenshots
No screenshot but a log of the detected files for Appointment:
Missing MPL license header in 313 file(s):