Depscheck.LicenseDetector (Depscheck v1.0.12)
View SourceDetects licenses for the project and its dependencies.
This module reads license information from:
- Project's mix.exs for the project license
- deps/*/hex_metadata.config for dependency licenses
Summary
Functions
Extracts all dependencies and their licenses from the deps directory.
Gets license information for a single dependency.
Detects the project's license from mix.exs configuration.
Detects the project's license with configuration override support.
Functions
@spec get_all_dependency_licenses() :: [Depscheck.Types.dependency()]
Extracts all dependencies and their licenses from the deps directory.
Returns a list of dependency maps with name and licenses.
Gets license information for a single dependency.
Returns {:ok, licenses} or {:error, reason}.
@spec get_project_license() :: String.t() | nil
Detects the project's license from mix.exs configuration.
Returns the first license if multiple are declared, or nil if none found.
Examples
iex> Depscheck.LicenseDetector.get_project_license()
"MIT"
@spec get_project_license_with_config(Depscheck.Types.config()) :: String.t() | nil
Detects the project's license with configuration override support.
First checks for project_license in .depscheck.exs config, then falls back to mix.exs detection.
Examples
iex> Depscheck.LicenseDetector.get_project_license_with_config(%{project_license: "All Rights Reserved"})
"All Rights Reserved"
iex> Depscheck.LicenseDetector.get_project_license_with_config(%{project_license: nil})
"MIT"