Multiplatform command line tool that checks whether the license headers are included in the source files of a project.
- It can insert the license to a file in case it does not exist (optional).
- It can replace the license of a file in case it is different (optional).
- It is possible to choose the file extensions that will be processed.
- Specific folders, files and paths can be ignored.
DISCLAIMER
The tool expects the software license to be in a block comment at the beginning of the file following the format /* */
.
Thus, while it does support the source files of languages like Go, Rust, JavaScript, TypeScript, C, C++, Java, Swift, Kotlin and C#, it does not support the file extensions that do not use this style.
$ license-header-checker [-a] [-r] [-v] [-i path1,...] license-header-path src-path extensions...
-a Add the target license in case the file does not have any.
-r Replace the existing license by the target one in case they are different.
-v Be verbose during execution.
-i A comma separated list of the folders, files and/or paths that should be ignored.
It does not support wildcards.
-version Display version number.
$ license-header-checker -v -a -r -i node_modules,client/assets ../license_header.txt . js ts
The binary packages for Linux, Windows and macOS are uploaded for each release and can be downloaded from here.
The tool has been built with go 1.13.
To build:
$ make build
To install in go/bin:
$ make install
To cross-compile (generate the binaries for Linux, Windows and macOS all at once):
$ make cross-build
To run unit tests:
$ make test
To see unit test coverage:
$ make test-cover
To run end-to-end tests:
$ make test-e2e