Skip to content

Command line utility to check whether the license headers are included in the source code files of a project. It can also insert/replace.

License

Notifications You must be signed in to change notification settings

vogo/license-header-checker

 
 

Repository files navigation

Header

Build Status Test Status

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.

Usage

Syntax

$ license-header-checker [-a] [-r] [-v] [-i path1,...] license-header-path src-path extensions...

Options

  -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.

Example

$ license-header-checker -v -a -r -i node_modules,client/assets ../license_header.txt . js ts

Installation

Binary packages

The binary packages for Linux, Windows and macOS are uploaded for each release and can be downloaded from here.

Building from source

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

About

Command line utility to check whether the license headers are included in the source code files of a project. It can also insert/replace.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 92.6%
  • Shell 4.1%
  • Makefile 3.3%