All Projects → brainhubeu → license-auditor

brainhubeu / license-auditor

Licence: MIT license
License Auditor helps you track and validate licenses inside your project.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to license-auditor

Lickey
software license management system
Stars: ✭ 706 (+4606.67%)
Mutual labels:  license, license-management
Licenseplist
A license list generator of all your dependencies for iOS applications
Stars: ✭ 1,996 (+13206.67%)
Mutual labels:  license, license-management
Scancode Toolkit
🔎 ScanCode detects licenses, copyrights, package manifests & dependencies and more by scanning code ... to discover and inventory open source and third-party packages used in your code.
Stars: ✭ 1,134 (+7460%)
Mutual labels:  license, license-management
Licensecc
Software licensing, copy protection in C++. It has few dependencies and it's cross-platform.
Stars: ✭ 363 (+2320%)
Mutual labels:  license, license-management
license-ls
Get a list of licenses used by a projects dependencies
Stars: ✭ 17 (+13.33%)
Mutual labels:  license, license-checking
Fossology
FOSSology is an open source license compliance software system and toolkit. As a toolkit you can run license, copyright and export control scans from the command line. As a system, a database and web ui are provided to give you a compliance workflow. License, copyright and export scanners are tools used in the workflow.
Stars: ✭ 440 (+2833.33%)
Mutual labels:  license, license-management
Truelicense
TrueLicense is an open source engine for license management on the JVM.
Stars: ✭ 94 (+526.67%)
Mutual labels:  license, license-management
vlsi-release-plugins
A set of plugins to simplify Gradle release tasks
Stars: ✭ 30 (+100%)
Mutual labels:  license, license-management
SimpleLicensing
A Go Based Licensing System for Digital Rights Management
Stars: ✭ 96 (+540%)
Mutual labels:  license, license-management
Licensed
⚖️ ✔️ licensed is an interactive command line tool to help you choose and add licenses to your projects
Stars: ✭ 220 (+1366.67%)
Mutual labels:  license, license-management
Go Licenses
Reports on the licenses used by a Go package and its dependencies.
Stars: ✭ 263 (+1653.33%)
Mutual labels:  license, license-management
license-checker-php
CLI tool to verify used licenses in composer dependencies
Stars: ✭ 28 (+86.67%)
Mutual labels:  license, license-management
php-legal-licenses
A utility to help generate a file containing information about dependencies including the full license text.
Stars: ✭ 62 (+313.33%)
Mutual labels:  license, license-management
Ort
A suite of tools to assist with reviewing Open Source Software dependencies.
Stars: ✭ 446 (+2873.33%)
Mutual labels:  license, license-management
awesome-open-source-licensing
Cool links, tools & papers related to Open Source Licensing
Stars: ✭ 17 (+13.33%)
Mutual labels:  license, license-management
Lc
licensechecker (lc) a command line application which scans directories and identifies what software license things are under producing reports as either SPDX, CSV, JSON, XLSX or CLI Tabular output. Dual-licensed under MIT or the UNLICENSE.
Stars: ✭ 93 (+520%)
Mutual labels:  license, license-management
license.sh
License checker tool - We're in a beta phase, any help is appreciated, especially reporting issues
Stars: ✭ 38 (+153.33%)
Mutual labels:  license-management, license-checking
Npm License Crawler
Analyzes license information for multiple node.js modules (package.json files) as part of your software project.
Stars: ✭ 168 (+1020%)
Mutual labels:  license, license-management
TrialMaker.Demo
A powerful yet straight-forward library suite that provides secure trial license generation and copy-protection features for .NET applications. It also supports premium license generation for expired free-trials.
Stars: ✭ 21 (+40%)
Mutual labels:  license, license-management
lisense
Sensible repository licensing for Humans
Stars: ✭ 23 (+53.33%)
Mutual labels:  license, license-management

license-auditor

License Auditor helps you track and validate licenses inside your project.

Hire us

Last commit license PRs Welcome Renovate enabled

Coveralls github Downloads Activity Minified npm Contributors

License Auditor helps you track and validate licenses inside your project. Prevents unwanted law complications. The license Auditor includes a step in your pipeline and creates notifications about potential problems with used licenses. At the moment, a notification means a comment.

Getting started

To start using the License Auditor, install its package with NPM:

npm install @brainhubeu/license-auditor

or Yarn:

yarn add @brainhubeu/license-auditor

In the next step, copy license-template directory with licenses.js, blacklist.js, and whitelist.js files, naming it license in your project. The first one contains a full list of all currently acknowledged, depreciated, and exceptional software licenses. To whitelist or blacklist the license, you must copy selected licenses from the main file into them.

Whitelisting stops License Auditor from analyzing and displaying any notifications for a given package with whitelisted license type. Blacklisting a license leads to the generation of fail notification log or causes CI job to fail if the blacklisted license is found, which prevents the developer from merging unwanted dependencies into the destination branch. Any license that is included in neither blacklist.js nor whitelist.js, but is found during packages analyze or merge request, becomes a warning, which developer should address during merge process or further development.

If a given dependency has no license specified, it's marked with UNKNOWN and thus the default blacklist contains UNKNOWN license to notify about a potentially unwanted license.

For License Auditor to work, all project dependencies have to be installed before an audit. License Auditor iterates through the node_modules and retrieves the license information from them. List of licenses is also available at spdx site.

The order of files in which the license information is retrieved from is: package.json, LICENSE, LICENCE, COPYING, README. Warning and Error notifications specify the license file that it has been read from. In some cases, license files may not provide the license directly. The asterisk * symbol next to shown license name indicates that it is the closest possible, but not fully confirmed license.

Usage and examples

Continuous Integration tools adaptation

If you intend to use License Auditor with GitLab CI or GitHub Actions, you have to copy CI example file to the root of your project directory and RENAME it to dangerfile.js. This example provides a base for CI-oriented licenses checking using DangerJS (for more information this framework, visit official Danger Systems site).

Then, you have to include it in your pipeline. The basic structure of Gitlab pipeline step should look like this:

check_foo_licenses:
  stage: CheckFooLicenses
  image: node:alpine
  script:
    - yarn add -D danger @brainhubeu/license-auditor
    - yarn danger ci --failOnErrors --id Foo
  variables:
    DANGER_GITLAB_API_TOKEN: $GITLAB_ACCESS_TOKEN
    PROJECT_PATH: $PATH_TO_FOO_PACKAGE # it could look like: ./packages/web or ./server
  only:
    - merge_requests

and the basic structure for Github Actions:

  - name: CheckBarLicenses
        run: |
          yarn add -D danger @brainhubeu/license-auditor
          yarn danger ci --failOnErrors --verbose --id Bar
        env:
          DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_ACCESS_TOKEN }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          PROJECT_PATH: $PATH_TO_BAR_PACKAGE # it could look like: ./packages/web or ./server

You can find more examples in examples directory for GitLab and GitHub.

To allow automatic comments posting on MRs/PRs, you need to create either Gitlab Access Token or Github Access Token in a profile that is going to post comments under MRs/ PRs. Then you need to specify environmental variables with key DANGER_GITLAB_API_TOKEN or DANGER_GITHUB_API_TOKEN and value being the acquired token. The Access Token needs to have the ability to use the Github/Gitlab API and write discussions for MRs/PRs.

Gitlab:

Gitlab Access Token

Github:

Github Access Token

In provided examples, the new Gitlab and Github accounts were created to act as a "bot", that was posting MR/PR comments based on license information. Both of them were named HAL9002.

The comments should look similar to:

for Gitlab:

Gitlab Comment Warn

for Github:

Gitlab Comment Error

You can find more information about Github and Gitlab configuration here.

Logging tool and own implementation

To use a logging tool instead of CI, copy logging example file to the root of your project directory. It is intended to log used license information into the console of your preference. To use it, you need to have a JavaScript runtime environment installed (e.g. Node.js). Then, just simply type:

node logging_example.js

This command will list fails for every dependency that was blacklisted in blacklist.js file and warnings for licenses that are missing on both whitelist.js and blacklist.js files.

You can also create your own implementation of warn and fail methods behavior based on your needs. To do so, we recommend to copy logging example file and change fail and warn methods implementations, remembering to preserve msg input parameter and not to add new parameters, as they will be of no use.

Contributing

Releasing a new version of the package

  1. Create a new branch release-<version> e.g. release-v1.1.1.
  2. Run yarn version command and set a new version e.g v1.1.1. Follow Semantic Versioning 2.0.0.
  3. Push your branch along with created tag e.g. git push --set-upstream origin release-v1.1.1 --tags.
  4. Open pull request.
  5. Once pull request is merged, create a new release on Github. Select existing tag e.g. v1.1.1 and fill in release notes. A new version will be published using Github Actions 🎉.

Tests

  • run yarn test

About

license-auditor was built using:

license-auditor is maintained by @jkthomas, @nikodemwrona and the Brainhub development team. It is funded by Brainhub and the names and logos for Brainhub are trademarks of Brainhub Sp. z o.o.. You can check other open-source projects supported/developed by our teammates here.

Brainhub

We love open-source JavaScript software! See our other projects or hire us to build your next web, desktop, and mobile application with JavaScript.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].