composer-license-checker icon indicating copy to clipboard operation
composer-license-checker copied to clipboard

Allow files as input for allowlist/blocklist

Open dominikb opened this issue 2 years ago • 1 comments

Extend the check command to be able to use files as a source for their allowlist or blocklist.

Currently, this is possible by passing a flag multiple times:

# Allow both MIT and GPL exclusively
./vendor/bin/composer-license-checker -a MIT -a GPL ...

# Deny both BSD and Unlicense
./vendor/bin/composer-license-checker -b BSD -b Unlicense ...

An example where this could be used is in shopware/platform: they have extracted their allowed licenses into an .allowed-licenses file and need to use sed to parse the file into command line arguments.

dominikb avatar Oct 06 '23 08:10 dominikb

This should be possible with all list values:

  1. -a, --allowlist[=ALLOWLIST] Set a license you want to permit for usage (multiple values allowed)
  2. -b, --blocklist[=BLOCKLIST] Mark a specific license prohibited for usage (multiple values allowed)
  3. --allow[=ALLOW] Determine a vendor or package to always be allowed and never trigger violations (multiple values allowed)

Furthermore, it would be a pleasure to define a remote source (e.g. a git repository where you manage your license definitions) to download these files first. Managing these files per project is not applicable if you want to apply a global license policy for all your projects.

pschirch avatar Oct 19 '23 10:10 pschirch