GithubHelp home page GithubHelp logo

zouguangxian / addlicense Goto Github PK

View Code? Open in Web Editor NEW

This project forked from google/addlicense

0.0 1.0 0.0 114 KB

A program which ensures source code files have copyright license headers by scanning directory patterns recursively

License: Apache License 2.0

Go 99.03% Dockerfile 0.97%

addlicense's Introduction

addlicense

The program ensures source code files have copyright license headers by scanning directory patterns recursively.

It modifies all source files in place and avoids adding a license header to any file that already has one.

addlicense requires go 1.16 or later.

install

go install github.com/google/addlicense@latest

usage

addlicense [flags] pattern [pattern ...]

-c      copyright holder (default "Google LLC")
-check  check only mode: verify presence of license headers and exit with non-zero code if missing
-f      license file
-ignore file patterns to ignore, for example: -ignore **/*.go -ignore vendor/**
-l      license type: apache, bsd, mit, mpl (default "apache")
-s      Include SPDX identifier in license header. Set -s=only to only include SPDX identifier.
-v      verbose mode: print the name of the files that are modified
-y      copyright year(s) (default is the current year)

The pattern argument can be provided multiple times, and may also refer to single files. Directories are processed recursively.

For example, to run addlicense across everything in the current directory and all subdirectories:

addlicense .

The -ignore flag can use any pattern supported by doublestar.

Running in a Docker Container

The simplest way to get the addlicense docker image is to pull from GitHub Container Registry:

docker pull ghcr.io/google/addlicense:latest

Alternately, you can build it from source yourself:

docker build -t ghcr.io/google/addlicense .

Once you have the image, you can test that it works by running:

docker run -it ghcr.io/google/addlicense -h

Finally, to run it, mount the directory you want to scan to /src and pass the appropriate addlicense flags:

docker run -it -v ${PWD}:/src ghcr.io/google/addlicense -c "Google LLC" *.go

license

Apache 2.0

This is not an official Google product.

addlicense's People

Contributors

benma avatar bradrydzewski avatar bryanloz-xilinx avatar crazy-max avatar fashing avatar ghanekaromkar avatar leilee avatar maruel avatar mbrukman avatar mco-gh avatar mithun avatar mjduijn avatar morgante avatar piotrsikora avatar pmeric avatar rotemreiss avatar sjswerdlow avatar srgbtl avatar talal avatar thefirstofthe300 avatar tomeraberbach avatar tpryan avatar tweksteen avatar verbanicm avatar willnorris avatar wzshiming avatar x1ddos avatar xorima avatar xuehaipan avatar yangjingzhou avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.