WIP: Scripts: add script to check copyrights
Context
This MR adds a script which looks at the Git history and checks that the copyrights in the source files reflect this Git history. For instance, if a commit dated from 2020 and authored by someone@nomadic-labs.com
modifies file src/bin_node/node_config_file.ml
, this file should have Copyright 2020 Nomadic Labs
.
Currently the copyrights are not up-to-date and this script should help to fix that.
This script can also be invoked with the --update
option to update licenses in place.
This script can also be invoked with -w
to get a warning if there is no rule to deduce the expected copyright author from a commit author e-mail address. This should help get exhaustive rules but we need to decide whether we are ok with having a list of e-mail addresses in the sources (for some, we can just match on the domain, but some developers have e-mail addresses for which we would need to store the full e-mail address).
I did not check the output of the script very extensively yet.
Manually testing the MR
Check copyrights for all .ml
and .mli
files (will not modify your files):
dune exec scripts/copyright/main.exe -- $(find src -name '*.ml') $(find src -name '*.mli')
Update copyrights for all .ml
and .mli
files (careful: this will modify files):
dune exec scripts/copyright/main.exe -- $(find src -name '*.ml') $(find src -name '*.mli') --update
(you can also use find src -name '*.ml' -or -name '*.mli'
but apparently that's not POSIX)
Checklist
-
Provide automatic testing (see the testing guide). -
Add item in the Development Version
section ofCHANGES.md
(only for new features and bug fixes).