WhichLicense classification & Compliancy tool
This tool is constructed with the purpose of holding a small database of license identifiers with their respective license classification alongside other important parameters. The tool provides a mechanism to detect the compliance status of various license classifications based on a matrix that it holds internally.
Basic usage (classification)
// loading from file
let classifier = from_file;
// or the longer way
let mut classifier = Classifier ;
classifier.load_from_file;
// loading from memory
let classifier = from_memory
// or the longer way
let mut classifier = Classifier ;
classifier.load_from_memory;
// saving to a file
classifier.save_to_file;
// adding an entry
classifier.add;
// classifying a license
classifier.classify;
Basic usage (compliance checking)
The compliancy_check function takes in the host license classification that is under the repository it is supposed to check against and all the other license classifications found (e.g., in all transitive dependencies). Said method returns a CompliancyStatus enum that can be either Compliant or NonCompliant with the latter containing a vector of all the non-compliant licenses classifications (i.e., all the classifications that are directly incompatible with the host license classification).
NOTE: the
CompliancyStatus::NonCompliantdoes NOT return the classifications that are found to be compliant with the host classification, only the ones that are not.
NOTE: the
LicenseClassification::UnknownandLicenseClassification::Specialare always considered to be incompliant with any other license classification; However, there exists an option to force unknown licenses to be compliant.
// some examples
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
// more advanced example
assert_eq!;