checks.license.LicenseCheck
checks.license.LicenseCheck()Check that the package has a license file.
Looks for common license file names (LICENSE, COPYING, etc.) and attempts to identify the license type (MIT, Apache, GPL, etc.).
Attributes
name :-
The check identifier (“license”).
description :-
Human-readable description of this check.
LICENSE_FILENAMES :-
List of recognized license file names.
KNOWN_LICENSES :-
Dictionary mapping license identifiers to text markers used for identification.
Examples
Run the license check:
>>> from pathlib import Path
>>> check = LicenseCheck()
>>> result = check.run(Path("."), {"enabled": True})
>>> result.name
'license'The check identifies common licenses:
>>> # For a package with MIT license
>>> # result.status == CheckStatus.OK
>>> # "License type: MIT" in result.detailsMethods
| Name | Description |
|---|---|
| run | Check for license file presence and validity. |
run
checks.license.LicenseCheck.run(package_path, config)Check for license file presence and validity.
Searches for a license file using common naming conventions, verifies it’s not empty, and attempts to identify the license type.
Parameters
Returns
: CheckResult-
A CheckResult with:
: CheckResult-
- OK status if a valid license file is found
: CheckResult-
- WARNING status if no license file found or file is empty