Giter Site home page Giter Site logo

marieroald / licensecheck Goto Github PK

View Code? Open in Web Editor NEW

This project forked from google/licensecheck

0.0 1.0 0.0 1.08 MB

The licensecheck package classifies license files and heuristically determines how well they correspond to known open source licenses.

License: BSD 3-Clause "New" or "Revised" License

Go 20.43% Roff 79.57%

licensecheck's Introduction

The licensecheck package classifies license files and heuristically determines how well they correspond to known open source licenses.

The design aims never to give a false positive. It uses a soft text matching algorithm, though, which means it can miss valid licenses that have been modified more than usual. It also recognizes licenses identified by URL.

To use this package, the client first identifies a file or text that might contain a license, then calls the Cover function for a description of what licenses are present in the text. The description returned by Cover lists the licenses in the order they appear in the text. By convention in most open source repositories, the first license present describes the main body of the work, while subsequent licenses apply to borrowed subcomponents.

The output of go doc Cover and go doc Coverage provides more information:

func Cover(input []byte, opts Options) (Coverage, bool)
    Cover computes the coverage of the text according to the license set
    compiled into the package.

    An input text may match multiple licenses. If that happens, Match contains
    only disjoint matches. If multiple licenses match a particular section of
    the input, the best match is chosen so the returned coverage describes at
    most one match for each section of the input.

type Coverage struct {
	// Percent is the fraction of the total text, in normalized words, that
	// matches any valid license, expressed as a percentage across all of the
	// licenses matched.
	Percent float64

	// Match describes, in sequential order, the matches of the input text
	// across the various licenses. Typically it will be only one match long,
	// but if the input text is a concatenation of licenses it will contain
	// a match value for each element of the concatenation.
	Match []Match
}
    Coverage describes how the text matches various licenses.

The licenses subdirectory contains canonical forms of the licenses recognized by the package. The list covers most open source software but is not comprehensive. More licenses may be added by copying their text to the subdirectory as individual files and running go generate in the root.

licensecheck's People

Contributors

rsc avatar robpike avatar dsymonds avatar spakin avatar

Watchers

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