licensed 3.1.0 → 3.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +19 -0
  3. data/.github/workflows/release.yml +4 -4
  4. data/.github/workflows/test.yml +169 -48
  5. data/.ruby-version +1 -1
  6. data/CHANGELOG.md +51 -1
  7. data/README.md +25 -80
  8. data/docker/Dockerfile.build-linux +1 -1
  9. data/docs/adding_a_new_source.md +11 -8
  10. data/docs/commands/README.md +59 -0
  11. data/docs/commands/cache.md +35 -0
  12. data/docs/commands/env.md +10 -0
  13. data/docs/commands/list.md +23 -0
  14. data/docs/commands/migrate.md +10 -0
  15. data/docs/commands/notices.md +12 -0
  16. data/docs/commands/status.md +74 -0
  17. data/docs/commands/version.md +3 -0
  18. data/docs/configuration/README.md +11 -0
  19. data/docs/configuration/allowed_licenses.md +17 -0
  20. data/docs/configuration/application_name.md +63 -0
  21. data/docs/configuration/application_source.md +64 -0
  22. data/docs/configuration/configuration_root.md +27 -0
  23. data/docs/configuration/configuring_multiple_apps.md +58 -0
  24. data/docs/configuration/dependency_source_enumerators.md +28 -0
  25. data/docs/configuration/ignoring_dependencies.md +19 -0
  26. data/docs/configuration/metadata_cache.md +106 -0
  27. data/docs/configuration/reviewing_dependencies.md +18 -0
  28. data/docs/configuration.md +9 -173
  29. data/lib/licensed/cli.rb +2 -2
  30. data/lib/licensed/commands/cache.rb +21 -20
  31. data/lib/licensed/commands/command.rb +108 -73
  32. data/lib/licensed/commands/environment.rb +12 -11
  33. data/lib/licensed/commands/list.rb +0 -19
  34. data/lib/licensed/commands/notices.rb +0 -19
  35. data/lib/licensed/commands/status.rb +13 -15
  36. data/lib/licensed/configuration.rb +77 -7
  37. data/lib/licensed/report.rb +44 -0
  38. data/lib/licensed/reporters/cache_reporter.rb +48 -64
  39. data/lib/licensed/reporters/json_reporter.rb +19 -21
  40. data/lib/licensed/reporters/list_reporter.rb +45 -58
  41. data/lib/licensed/reporters/notices_reporter.rb +33 -46
  42. data/lib/licensed/reporters/reporter.rb +37 -104
  43. data/lib/licensed/reporters/status_reporter.rb +58 -56
  44. data/lib/licensed/reporters/yaml_reporter.rb +19 -21
  45. data/lib/licensed/sources/bundler/definition.rb +36 -0
  46. data/lib/licensed/sources/bundler/missing_specification.rb +10 -7
  47. data/lib/licensed/sources/bundler.rb +34 -70
  48. data/lib/licensed/sources/dep.rb +2 -2
  49. data/lib/licensed/sources/go.rb +3 -3
  50. data/lib/licensed/sources/gradle.rb +2 -2
  51. data/lib/licensed/sources/helpers/content_versioning.rb +2 -1
  52. data/lib/licensed/sources/npm.rb +4 -3
  53. data/lib/licensed/sources/nuget.rb +1 -2
  54. data/lib/licensed/version.rb +1 -1
  55. data/lib/licensed.rb +1 -0
  56. data/licensed.gemspec +4 -4
  57. data/script/source-setup/go +1 -1
  58. metadata +45 -13
  59. data/docs/commands.md +0 -95
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.4.0
1
+ 2.7.4
data/CHANGELOG.md CHANGED
@@ -6,6 +6,56 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## 3.2.3
10
+
11
+ 2021-09-14
12
+
13
+ ### Fixed
14
+
15
+ - Bundler source will no longer infinitely recurse when enumerating specifications (https://github.com/github/licensed/pull/402)
16
+ - Using the `--sources` command line option will no longer delete skipped sources' cached files (https://github.com/github/licensed/pull/401)
17
+
18
+ ## 3.2.2
19
+
20
+ 2021-09-09
21
+
22
+ ### Fixed
23
+
24
+ - Bundler source works properly again when used outside of `bundle exec` (https://github.com/github/licensed/pull/397)
25
+
26
+ ## 3.2.1
27
+
28
+ 2021-09-06
29
+
30
+ ### Changed
31
+
32
+ - Updated multiple dependency versions (:tada: @mmorel-35 https://github.com/github/licensed/pull/385, https://github.com/github/licensed/pull/389)
33
+ - Go homepage links use pkg.go.dev instead of godoc.org (:tada: @mmorel-35 https://github.com/github/licensed/commit/73cfbbe954a3e8c8cbaf8b68253053b157e01b79)
34
+ - Local development ruby version changed to 2.7.4 (https://github.com/github/licensed/pull/393)
35
+
36
+ ### Fixed
37
+
38
+ - Bundler source correctly finds platform specific dependencies (https://github.com/github/licensed/pull/392)
39
+
40
+ ## 3.2.0
41
+
42
+ 2021-08-19
43
+
44
+ ### Added
45
+
46
+ - Application names can be dynamically generated based on the path to the application source (https://github.com/github/licensed/pull/375)
47
+
48
+ ### Changed
49
+
50
+ - Updated command documentation (https://github.com/github/licensed/pull/378, https://github.com/github/licensed/pull/380/files)
51
+ - Updated configuration documentation (https://github.com/github/licensed/pull/375)
52
+ - Cache and status commands give additional diagnostic output when using JSON and YAML formatters (https://github.com/github/licensed/pull/378)
53
+ - Status command will give users a link to documentation when compliance checks fail (https://github.com/github/licensed/pull/381)
54
+
55
+ ### Fixed
56
+
57
+ - The bundler source correctly checks that the path bundler specifies a gem is loaded from is a file (https://github.com/github/licensed/pull/379)
58
+
9
59
  ## 3.1.0
10
60
 
11
61
  2021-06-16
@@ -447,4 +497,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
447
497
 
448
498
  Initial release :tada:
449
499
 
450
- [Unreleased]: https://github.com/github/licensed/compare/3.1.0...HEAD
500
+ [Unreleased]: https://github.com/github/licensed/compare/3.2.3...HEAD
data/README.md CHANGED
@@ -37,13 +37,13 @@ See the [v2 migration documentation](./docs/migrations/v2.md) for more info on m
37
37
 
38
38
  Licensed uses the `libgit2` bindings for Ruby provided by `rugged`. `rugged` requires `cmake` and `pkg-config` which you may need to install before you can install Licensed.
39
39
 
40
- > Ubuntu
41
-
42
- sudo apt-get install cmake pkg-config
43
-
44
- > OS X
40
+ ```bash
41
+ # Ubuntu
42
+ sudo apt-get install cmake pkg-config
45
43
 
46
- brew install cmake pkg-config
44
+ # macOS
45
+ brew install cmake pkg-config
46
+ ```
47
47
 
48
48
  ### With a Gemfile
49
49
 
@@ -56,7 +56,7 @@ gem 'licensed', :group => 'development'
56
56
  And then execute:
57
57
 
58
58
  ```bash
59
- $ bundle
59
+ $> bundle
60
60
  ```
61
61
 
62
62
  ### As an executable
@@ -64,24 +64,27 @@ $ bundle
64
64
  Download a package from GitHub and extract the executable. Executable packages are available for each release starting with version 1.2.0.
65
65
 
66
66
  ```bash
67
- $ curl -sSL https://github.com/github/licensed/releases/download/<version>/licensed-<version>-<os>-x64.tar.gz > licensed.tar.gz
68
- $ tar -xzf licensed.tar.gz
69
- $ rm -f licensed.tar.gz
70
- $ ./licensed list
67
+ $> curl -sSL https://github.com/github/licensed/releases/download/<version>/licensed-<version>-<os>-x64.tar.gz > licensed.tar.gz
68
+ $> tar -xzf licensed.tar.gz
69
+ $> rm -f licensed.tar.gz
70
+ $> ./licensed list
71
71
  ```
72
72
 
73
73
  For system wide usage, install licensed to a location on `$PATH`, e.g. `/usr/local/bin`.
74
74
 
75
75
  ## Usage
76
76
 
77
- - `licensed list`: Output enumerated dependencies only.
78
- - `licensed cache`: Cache licenses and metadata.
79
- - `licensed status`: Check status of dependencies' cached licenses.
80
- - `licensed notices`: Write a `NOTICE` file for each application configuration.
81
- - `licensed version`: Show current installed version of Licensed. Aliases: `-v|--version`
82
- - `licensed env`: Output environment information from the licensed configuration.
77
+ ### Available commands
78
+
79
+ See the [commands documentation](./docs/commands) for documentation on available commands, or run `licensed -h` to see all of the current available commands.
83
80
 
84
- See the [commands documentation](./docs/commands.md) for additional documentation, or run `licensed -h` to see all of the current available commands.
81
+ ### Configuration options
82
+
83
+ A configuration file is required for most commands. See the [configuration file documentation](./docs/configuration.md) for more details on the configuration format and available configuration options.
84
+
85
+ ### Available dependency sources
86
+
87
+ Licensed can enumerate dependency for many languages, package managers, and frameworks. See the [sources documentation](./docs/sources) for the list of currently available sources. Sources can be explicitly enabled and disabled as a [configuration option](./docs/configuration/dependency_source_enumerators.md.md).
85
88
 
86
89
  ### Automation
87
90
 
@@ -95,80 +98,22 @@ The [licensed-ci](https://github.com/marketplace/actions/licensed-ci) GitHub Act
95
98
 
96
99
  The [setup-licensed](https://github.com/marketplace/actions/setup-github-licensed) GitHub Action installs `licensed` to the workflow environment. See the linked actions for usage and details.
97
100
 
98
- ### Configuration
99
-
100
- All commands, except `version`, accept a `-c|--config` option to specify a path to a configuration file or directory.
101
-
102
- If a directory is specified, `licensed` will look in that directory for a file named (in order of preference):
103
- 1. `.licensed.yml`
104
- 2. `.licensed.yaml`
105
- 3. `.licensed.json`
106
-
107
- If the option is not specified, the value will be set to the current directory.
108
-
109
- See the [configuration file documentation](./docs/configuration.md) for more details on the configuration format.
110
-
111
- ### Sources
112
-
113
- Dependencies will be automatically detected for all of the following sources by default.
114
- 1. [Bower](./docs/sources/bower.md)
115
- 1. [Bundler](./docs/sources/bundler.md)
116
- 1. [Cabal](./docs/sources/cabal.md)
117
- 1. [Composer](./docs/sources/composer.md)
118
- 1. [Git Submodules (git_submodule)](./docs/sources/git_submodule.md)
119
- 1. [Go](./docs/sources/go.md)
120
- 1. [Go Dep (dep)](./docs/sources/dep.md)
121
- 1. [Gradle](./docs/sources/gradle.md)
122
- 1. [Manifest lists (manifests)](./docs/sources/manifests.md)
123
- 1. [Mix](./docs/sources/mix.md)
124
- 1. [npm](./docs/sources/npm.md)
125
- 1. [NuGet](./docs/sources/nuget.md)
126
- 1. [Pip](./docs/sources/pip.md)
127
- 1. [Pipenv](./docs/sources/pipenv.md)
128
- 1. [Swift](./docs/sources/swift.md)
129
- 1. [Yarn](./docs/sources/yarn.md)
130
-
131
- You can disable any of them in the configuration file:
132
-
133
- ```yml
134
- sources:
135
- bundler: false
136
- npm: false
137
- bower: false
138
- cabal: false
139
- ```
140
-
141
101
  ## Development
142
102
 
143
103
  To get started after checking out the repo, run
104
+
144
105
  1. `script/bootstrap` to install dependencies
145
106
  2. `script/setup` to setup test fixtures.
146
107
  - `script/setup -f` will force a clean test fixture environment
147
- 3. `script/cibuild` to run the tests.
108
+ 3. `script/cibuild` to run the tests
148
109
 
149
110
  You can also run `script/console` for an interactive prompt that will allow you to experiment.
150
111
 
151
112
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
152
113
 
153
- #### Adding sources
154
-
155
- When adding new dependency sources, ensure that `script/bootstrap` scripting and tests are only run if the required tooling is available on the development machine.
156
-
157
- * See `script/bootstrap` for examples of gating scripting based on whether tooling executables are found.
158
- * Use `Licensed::Shell.tool_available?` when writing test files to gate running a test suite when tooling executables aren't available.
159
- ```ruby
160
- if Licensed::Shell.tool_available?('bundle')
161
- describe Licensed::Source::Bundler do
162
- ...
163
- end
164
- end
165
- ```
166
-
167
- See the [documentation on adding new sources](./docs/adding_a_new_source.md) for more information.
168
-
169
- #### Adding Commands
114
+ ### Adding a new source
170
115
 
171
- See the [documentation on commands](./docs/commands.md) for information about adding a new CLI command.
116
+ See the [documentation on adding new sources](./docs/adding_a_new_source.md) for detailed information on what's required to add a new dependency source enumerator.
172
117
 
173
118
  ## Contributing
174
119
 
@@ -1,4 +1,4 @@
1
- FROM ruby:2.4-slim-stretch
1
+ FROM ruby:2.6.8-slim-stretch
2
2
 
3
3
  RUN apt-get update \
4
4
  && apt-get install -y --no-install-recommends cmake make gcc pkg-config squashfs-tools git curl bison rsync \
@@ -4,13 +4,15 @@
4
4
 
5
5
  Dependency enumerators inherit and override the [`Licensed::Sources::Source`](../lib/licensed/sources/source.rb) class.
6
6
 
7
- #### Required method overrides
7
+ ### Required method overrides
8
+
8
9
  1. `Licensed::Sources::Source#enabled?`
9
10
  - Returns whether dependencies can be enumerated in the current environment.
10
11
  2. `Licensed::Sources::Source#enumerate_dependencies`
11
12
  - Returns an enumeration of `Licensed::Dependency` objects found which map to the dependencies of the current project.
12
13
 
13
- #### Optional method overrides
14
+ ### Optional method overrides
15
+
14
16
  1. `Licensed::Sources::Source.type`
15
17
  - Returns the name of the current dependency enumerator as it is found in a licensed configuration file.
16
18
 
@@ -22,12 +24,13 @@ whether `Licensed::Source::Sources#enumerate_dependencies` should be called on t
22
24
  Determining whether dependencies should be enumerated depends on whether all the tools or files needed to find dependencies are present.
23
25
  For example, to enumerate `npm` dependencies the `npm` CLI tool must be found with `Licensed::Shell.tool_available?` and a `package.json` file needs to exist in the licensed app's configured [`source_path`](./configuration.md#configuration-paths).
24
26
 
25
- #### Gating functionality when required tools are not available.
27
+ ### Gating functionality when required tools are not available.
26
28
 
27
29
  When adding new dependency sources, ensure that `script/bootstrap` scripting and tests are only run if the required tooling is available on the development machine.
28
30
 
29
- * See `script/bootstrap` for examples of gating scripting based on whether tooling executables are found.
30
- * Use `Licensed::Shell.tool_available?` when writing test files to gate running a test suite when tooling executables aren't available.
31
+ - See `script/bootstrap` for examples of gating scripting based on whether tooling executables are found.
32
+ - Use `Licensed::Shell.tool_available?` when writing test files to gate running a test suite when tooling executables aren't available.
33
+
31
34
  ```ruby
32
35
  if Licensed::Shell.tool_available?('bundle')
33
36
  describe Licensed::Source::Bundler do
@@ -47,11 +50,11 @@ Relying on external tools always has a risk that the tool could change. It's ge
47
50
  or other implementation details as these could change over time. CLI tools that provides the necessary information are generally preferred
48
51
  as they will more likely have requirements for backwards compatibility.
49
52
 
50
- #### Creating dependency objects
53
+ ### Creating dependency objects
51
54
 
52
55
  Creating a new `Licensed::Dependency` object requires name, version, and path arguments. Dependency objects optionally accept a path to use as search root when finding licenses along with any other metadata that is useful to identify the dependency.
53
56
 
54
- ##### `Licensed::Dependency` arguments
57
+ #### `Licensed::Dependency` arguments
55
58
 
56
59
  1. name (required)
57
60
  - The name of the dependency. Together with the version, this should uniquely identify the dependency.
@@ -71,7 +74,7 @@ Creating a new `Licensed::Dependency` object requires name, version, and path ar
71
74
  6. errors (optional)
72
75
  - Any errors found when loading dependency information.
73
76
 
74
- ##### Creating specialized Dependency objects
77
+ #### Creating specialized Dependency objects
75
78
 
76
79
  `Licensed::Dependency` objects inherit from `Licensee::Projects::FsProject` and can override or extend the default `Licensee` behavior to find files for a dependency.
77
80
 
@@ -0,0 +1,59 @@
1
+ # Commands
2
+
3
+ Run `licensed -h` to see help content for running licensed commands.
4
+
5
+ - [cache](cache.md)
6
+ - [env](env.md)
7
+ - [list](list.md)
8
+ - [migrate](migrate.md)
9
+ - [notices](notices.md)
10
+ - [status](status.md)
11
+ - [version](verison.md)
12
+
13
+ Most commands accept a `-c`/`--config` option to specify a path to a configuration file or directory. If a directory is specified, `licensed` will look in that directory for a file named (in order of preference):
14
+
15
+ 1. `.licensed.yml`
16
+ 2. `.licensed.yaml`
17
+ 3. `.licensed.json`
18
+
19
+ If the option is not specified, the value will be set to the current directory.
20
+
21
+ ## Adding a new command
22
+
23
+ ### Implement new `Command` class
24
+
25
+ Licensed commands inherit and override the [`Licensed::Sources::Command`](../lib/licensed/commands/command.rb) class.
26
+
27
+ ### Required method overrides
28
+
29
+ 1. `Licensed::Commands::Command#evaluate_dependency`
30
+ - Runs a command execution on an application dependency.
31
+
32
+ The `evaluate_dependency` method should contain the specific command logic. This method has access to the application configuration, dependency source enumerator and dependency currently being evaluated as well as a reporting hash to contain information about the command execution.
33
+
34
+ ### Optional method overrides
35
+
36
+ The following methods break apart the different levels of command execution. Each method wraps lower levels of command execution in a corresponding reporter method.
37
+
38
+ 1. `Licensed::Commands::Command#run`
39
+ - Runs `run_app` for each application configuration found. Wraps the execution of all applications in `Reporter#report_run`.
40
+ 2. `Licensed::Commands::Command#run_app`
41
+ - Runs `run_source` for each dependency source enumerator enabled for the application configuration. Wraps the execution of all sources in `Reporter#report_app`.
42
+ 3. `Licensed::Commands::Command#run_source`
43
+ - Runs `run_dependency` for each dependency found in the source. Wraps the execution of all dependencies in `Reporter#report_source`.
44
+ 4. `Licensed::Commands::Command#run_dependency`
45
+ - Runs `evaluate_dependency` for the dependency. Wraps the execution of all dependencies in `Reporter#report_dependency`.
46
+
47
+ As an example, `Licensed::Commands::Command#run_app` calls `Reporter#report_app` to wrap every call to `Licensed::Commands::Command#run_source`.
48
+
49
+ ### Specifying additional report data
50
+
51
+ The `run` methods can be overridden and pass a block to `super` to provide additional reporting data or functionality.
52
+
53
+ ```ruby
54
+ def run_app(app)
55
+ super do |report|
56
+ report["my_app_data"] = true
57
+ end
58
+ end
59
+ ```
@@ -0,0 +1,35 @@
1
+ # `licensed cache`
2
+
3
+ The cache command finds all dependencies and ensures that each dependency has an up-to-date cached record.
4
+
5
+ Dependency records will be saved if:
6
+
7
+ 1. The `force` option is set
8
+ 2. No cached record is found
9
+ 3. The cached record's version is different than the current dependency's version
10
+ - If the cached record's license text contents matches the current dependency's license text then the `license` metadata from the cached record is retained for the new saved record.
11
+
12
+ After the cache command is run, any cached records that don't match up to a current application dependency will be deleted.
13
+
14
+ ## Options
15
+
16
+ - `--config`/`-c`: the path to the licensed configuration file
17
+ - default value: `./.licensed.yml`
18
+ - `--sources`/`-s`: runtime filter on which dependency sources are run. Sources must also be enabled in the licensed configuration file.
19
+ - default value: not set, all configured sources
20
+ - `--format`/`-f`: the output format
21
+ - default value: `yaml`
22
+ - `--force`: if set, forces all dependency metadata files to be recached
23
+ - default value: not set
24
+
25
+ ## Reported Data
26
+
27
+ The following data is reported for each dependency when the YAML or JSON report formats are used
28
+
29
+ - name: the licensed recognized name for the dependency including the app and source name
30
+ - e.g. the full name for the `thor` bundler dependency used by this tool is `licensed.bundler.thor`
31
+ - cached: true when the dependency's cached metadata file was updated, false otherwise
32
+ - version: the version of the enumerated dependency
33
+ - license: the dependency's SPDX license identifier
34
+ - filename: the full path on disk to the dependency's cached metadata file, if available
35
+ - warnings: any warning messages encountered while enumerating and caching dependency metadata, if available
@@ -0,0 +1,10 @@
1
+ # `licensed env`
2
+
3
+ Prints the runtime environment used by licensed after loading a configuration file. This can be different from the configuration file inputs, for example all paths will be given as absolute file paths and glob paths may be expanded.
4
+
5
+ ## Options
6
+
7
+ - `--config`/`-c`: the path to the licensed configuration file
8
+ - default value: `./.licensed.yml`
9
+ - `--format`/`-f`: the output format
10
+ - default value: `yaml`
@@ -0,0 +1,23 @@
1
+ # `licensed list`
2
+
3
+ The list command finds and prints the dependencies for all sources in all configured applications. No additional actions are taken on dependencies.
4
+
5
+ ## Options
6
+
7
+ - `--config`/`-c`: the path to the licensed configuration file
8
+ - default value: `./.licensed.yml`
9
+ - `--sources`/`-s`: runtime filter on which dependency sources are run. Sources must also be enabled in the licensed configuration file.
10
+ - default value: not set, all configured sources
11
+ - `--format`/`-f`: the output format
12
+ - default value: `yaml`
13
+ - `--licenses`/`-l`: if set, includes each dependency's detected license in the output
14
+ - default value: not set
15
+
16
+ ### Reported Data
17
+
18
+ The following data is reported for each dependency when the YAML or JSON report formats are used
19
+
20
+ - name: the licensed recognized name for the dependency including the app and source name
21
+ - e.g. the full name for the `thor` bundler dependency used by this tool is `licensed.bundler.thor`
22
+ - version: the version of the enumerated dependency
23
+ - license: (optional) the dependency's SPDX license identifier
@@ -0,0 +1,10 @@
1
+ # `licensed migrate`
2
+
3
+ Migrates the licensed configuration and cached metadata files from a previous version to the most recent version. This is not required for all major version updates. See [migrations documentation](../migrations) for details on the migrations needed for each major version.
4
+
5
+ ## Options
6
+
7
+ - `--config`/`-c`: the path to the licensed configuration file
8
+ - default value: `./.licensed.yml`
9
+ - `--from`/`-f`: the licensed version to migrate from
10
+ - required
@@ -0,0 +1,12 @@
1
+ # `licensed notices`
2
+
3
+ Outputs license and notice text for all dependencies in each app into a `NOTICE` file in the app's `cache_path`. If an app uses a shared cache path, the file name will contain the app name as well, e.g. `NOTICE.my_app`.
4
+
5
+ `NOTICE` file contents are retrieved from cached records, with the assumption that cached records have already been reviewed in a compliance workflow.
6
+
7
+ ## Options
8
+
9
+ - `--config`/`-c`: the path to the licensed configuration file
10
+ - default value: `./.licensed.yml`
11
+ - `--sources`/`-s`: runtime filter on which dependency sources are run. Sources must also be enabled in the licensed configuration file.
12
+ - default value: not set, all configured sources
@@ -0,0 +1,74 @@
1
+ # `licensed status`
2
+
3
+ The status command finds all dependencies and checks whether each dependency has a valid cached record.
4
+
5
+ A dependency will fail the status checks if:
6
+
7
+ 1. No cached record is found
8
+ 2. The cached record's version is different than the current dependency's version
9
+ 3. The cached record's `licenses` data is empty
10
+ 4. The cached record's `license` metadata doesn't match an `allowed` license from the dependency's application configuration.
11
+ - If `license: other` is specified and all of the `licenses` entries match an `allowed` license a failure will not be logged
12
+ 5. The cached record is flagged for re-review.
13
+ - This occurs when the record's license text has changed since the record was reviewed.
14
+
15
+ ## Options
16
+
17
+ - `--config`/`-c`: the path to the licensed configuration file
18
+ - default value: `./.licensed.yml`
19
+ - `--sources`/`-s`: runtime filter on which dependency sources are run. Sources must also be enabled in the licensed configuration file.
20
+ - default value: not set, all configured sources
21
+ - `--format`/`-f`: the output format
22
+ - default value: `yaml`
23
+ - `--force`: if set, forces all dependency metadata files to be recached
24
+ - default value: not set
25
+
26
+ ## Reported Data
27
+
28
+ The following data is reported for each dependency when the YAML or JSON report formats are used
29
+
30
+ - name: the licensed recognized name for the dependency including the app and source name
31
+ - e.g. the full name for the `thor` bundler dependency used by this tool is `licensed.bundler.thor`
32
+ - allowed: true if the dependency has passed all checks, false otherwise
33
+ - version: the version of the enumerated dependency
34
+ - license: the dependency's SPDX license identifier
35
+ - filename: the full path on disk to the dependency's cached metadata file, if available
36
+ - errors: any error messages from failed status checks, if available
37
+
38
+ ## Status errors and resolutions
39
+
40
+ ### cached dependency record not found
41
+
42
+ **Cause:** A dependency was found while running `licensed status` that does not have a corresponding cached metadata file
43
+ **Resolution:** Run `licensed cache` to update the metadata cache and create the missing metadata file
44
+
45
+ ### cached dependency record out of date
46
+
47
+ **Cause:** A dependency was found while running `licensed status` with a different version than is contained in the dependency's cached metadata file
48
+ **Resolution:** Run `licensed cache` to update the out-of-date metadata files
49
+
50
+ ### missing license text
51
+
52
+ **Cause:** A license determination was made, e.g. from package metadata, but no license text was found.
53
+ **Resolution:** Manually verify whether the dependency includes a file containing license text. If the dependency code that was downloaded locally does not contain the license text, please check the dependency source at the version listed in the dependency's cached metadata file to see if there is license text that can be used.
54
+
55
+ If the dependency does not include license text but does specify that it uses a specific license, please copy the standard license text from a [well known source](https://opensource.org/licenses).
56
+
57
+ ### license text has changed and needs re-review. if the new text is ok, remove the `review_changed_license` flag from the cached record
58
+
59
+ **Cause:** A dependency that is set as [reviewed] in the licensed configuration file has substantially changed and should be re-reviewed.
60
+ **Resolution:** Review the changes to the license text and classification, along with other metadata contained in the cached file for the dependency. If the dependency is still allowable for use in your project, remove the `review_changed_license` key from the cached record file.
61
+
62
+ ### license needs review
63
+
64
+ **Cause:** A dependency is using a license that is not in the configured [allowed list of licenses][allowed], and the dependency has not been marked [ignored] or [reviewed].
65
+ **Resolution:** Review the dependency's usage and specified license with someone familiar with OSS licensing and compliance rules to determine whether the dependency is allowable. Some common resolutions:
66
+
67
+ 1. The dependency's specified license text differed enough from the standard license text that it was not recognized and classified as `other`. If, with human review, the license text is recognizable then update the `license: other` value in the cached metadata file to the correct license.
68
+ - An updated classification will persist through version upgrades until the detected license contents have changed. The determination is made by [licensee/licensee](https://github.com/licensee/licensee), the library which this tool uses to detect and classify license contents.
69
+ 1. The dependency might need to be marked as [ignored] or [reviewed] if either of those scenarios are applicable.
70
+ 1. If the used license should be allowable without review (if your entity has a legal team, they may want to review this assessment), ensure the license SPDX is set as [allowed] in the licensed configuration file.
71
+
72
+ [allowed]: ../configuration/allowed_licenses.md
73
+ [ignored]: ../configuration/ignoring_dependencies.md
74
+ [reviewed]: ../configuration/reviewing_dependencies.md