dev
3 files changed
tree: b2806ac508c296aecbda7f5770077582cc625688
  1. cmd/
  2. test/
  3. util/
  4. .gitignore
  5. .licenserc.json
  6. go.mod
  7. go.sum
  8. LICENSE
  9. main.go
  10. Makefile
  11. README.md
README.md

license-checker

A CLI tool for checking license headers, which theoretically supports checking all types of files.

Install

git clone https://github.com/fgksgf/license-checker.git
cd license-checker
make

Usage

Usage: license-checker [flags]

license-checker walks the specified path recursively and checks 
if the specified files have the license header in the config file.

Usage:
  license-checker [flags]

Flags:
  -c, --config string   the config file (default ".licenserc.json")
  -h, --help            help for license-checker
  -l, --loose           loose mode
  -p, --path string     the path to check (default ".")
  -v, --verbose         verbose mode

Configuration

{
  "licenseStrict": [
    "Licensed to the Apache Software Foundation (ASF) under one or more",
    "contributor license agreements.  See the NOTICE file distributed with",
    "..."
  ],
  "licenseLoose": [
    "Apache License, Version 2.0"
  ],
  "targetFiles": [
    "java",
    "go",
    "py",
    "sh",
    "graphql",
    "yaml",
    "yml"
  ],
  "exclude": {
    "files": [
      ".gitignore",
      "NOTICE",
      "go.mod",
      "go.sum",
      ".DS_Store",
      "LICENSE"
    ],
    "extensions": [
      "md",
      "xml",
      "json"
    ],
    "directories": [
      "bin",
      ".github",
      ".git",
      ".idea",
      "test"
    ]
  }
}

Test

bin/license-checker -p test -c test/.licenserc_for_test.json