Depscheck.LicenseAliases (Depscheck v1.0.13)

View Source

Maps license spelling variations and aliases to canonical license names.

This module provides a centralized mapping of common license name variations (e.g., "Apache v2.0", "GPLv2", "APL 2.0") to their canonical forms (e.g., "Apache-2.0", "GPL-2.0").

Usage

The aliases are used during license normalization to ensure that different spellings of the same license are correctly identified.

resolve/1 expects its argument to already be normalized (lowercase, dashes for spaces, dash-separated version numbers), since it is the final step of the normalization pipeline. The examples below use that normalized form.

Examples

iex> Depscheck.LicenseAliases.resolve("apl-v2-0")
"apache-2-0"

iex> Depscheck.LicenseAliases.resolve("gplv2")
"gpl-2-0"

iex> Depscheck.LicenseAliases.resolve("gpl-3-0-only")
"gpl-3-0"

Summary

Functions

Resolves a normalized license name to its canonical form.

Functions

resolve(normalized_name)

@spec resolve(String.t()) :: String.t()

Resolves a normalized license name to its canonical form.

Returns the canonical license name if an alias exists, otherwise returns the input unchanged.

Examples

iex> Depscheck.LicenseAliases.resolve("apl-v2-0")
"apache-2-0"

iex> Depscheck.LicenseAliases.resolve("gplv2")
"gpl-2-0"

iex> Depscheck.LicenseAliases.resolve("unknown-license")
"unknown-license"