Giter VIP home page Giter VIP logo

licence-compliance-checker's Introduction

Licence compliance checker

Command line application to validate that project dependencies comply with licence restrictions dictated by a company. This works by identifying project licences using the reliable go-license-detector, then validating that the most pertinent licences (those with highest confidence level) do not match any of the restricted licences specified as arguments. The list of restricted licences are passed as arguments to allow projects to have different restriction policies. Optional filters can be used to ignore some projects and/or override the licence detected for a project.

The checker is intended for use in continuous integration pipelines, to help ensure that projects are complying with licence restrictions on an ongoing basis.

Installing

If you already have Go installed, the easiest way of installing is with go get:

go get github.com/sky-uk/licence-compliance-checker

Usage

licence-compliance-checker -r LGPL -r GPL -r AGPL -o vendor/github.com/spf13/cobra=MIT vendor/github.com/spf13/cobra vendor/golang.org/x/crypto

See the licencecheck target in the Makefile for an example of how to use with dependencies managed by go dep

Exit code Meaning
0 No restricted licenses found
1 Restricted licenses found
Input argument Meaning
--restricted-licence (-r) The name of the licence to restrict. Repeat this flag to specify multiple values.
--ignore-project (-i) Project which licence will not be checked for compliance. Repeat this flag to specify multiple values.
--override-licence (-o) Can be used to override the licence detected for a project - e.g. github.com/spf13/cobra=MIT. Repeat this flag to specify multiple values.
Output argument Meaning
--log-level (-L) should be one of: (none), debug, info, warn, error, fatal, panic. default (none)
--show-compliance-all (-A) to show compliance checks as JSON regardless of outcome. default (false)
--show-compliance-errors (-E) to show compliance checks as JSON only in case of errors. default (false)

Example of JSON output

{
  "compliant": [
    {
      "project": "testdata/BSD3",
      "matches": [
        {
          "license": "BSD-3-Clause",
          "confidence": 0.9953052
        },
        {
          "license": "BSD-4-Clause",
          "confidence": 0.84976524
        },
        {
          "license": "BSD-3-Clause-No-Nuclear-License-2014",
          "confidence": 0.8356807
        },
        {
          "license": "BSD-Source-Code",
          "confidence": 0.8333333
        }
      ]
    }
  ],
  "restricted": [
    {
      "project": "testdata/MIT",
      "matches": [
        {
          "license": "MIT",
          "confidence": 0.9814815
        },
        {
          "license": "JSON",
          "confidence": 0.9259259
        },
        {
          "license": "MIT-feh",
          "confidence": 0.8447205
        },
        {
          "license": "Xnet",
          "confidence": 0.80864197
        }
      ]
    }
  ],
  "unidentifiable": null,
  "ignored": null
}

Questions or Problems?

  • If you have a general question about this project, please create an issue for it. The issue title should be the question itself, with any follow-up information in a comment. Add the "question" tag to the issue.

  • If you think you have found a bug in this project, please create an issue for it. Use the issue title to summarise the problems, and supply full steps to reproduce in a comment. Add the "bug" tag to the issue.

Contributions

See CONTRIBUTING.md

licence-compliance-checker's People

Contributors

alangibson01 avatar sebbonnet avatar

Watchers

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