public/manifest-license
Package manifest declares the license
| Severity | info |
| Tiers | 1 |
| Stacks | any |
| Scope | each |
| Kind | expr |
| Source | library v0.1.0 |
| Selected by | fleetlint-recommended@v0.1.0 |
Requirement
A published package’s manifest names its license: an SPDX expression in package.json license and Cargo.toml package.license (or license-file, or the workspace’s), a project.license or license classifier in pyproject.toml. Packages marked private ("private": true, publish = false, the Private :: Do Not Upload classifier) and stacks without such a field are not checked.
Why
Registries, SBOM tools and license checkers read the manifest, not the LICENSE file.
Applies when
repo.publicCheck
For each item in:
repo.stacks(item != "node" || !file("package.json")
|| (has(json("package.json").private) && json("package.json").private == true)
|| (has(json("package.json").license) && type(json("package.json").license) == string
&& json("package.json").license.matches(r'^\(?[A-Za-z0-9][A-Za-z0-9.+-]*( (AND|OR|WITH) \(?[A-Za-z0-9][A-Za-z0-9.+-]*\)?)*\)?$')
&& json("package.json").license != "UNLICENSED"))
&& (item != "python" || !file("pyproject.toml")
|| scan("pyproject.toml", r'Private :: Do Not Upload').size() > 0
|| scan("pyproject.toml", r'^\s*license(-files)?\s*=|License ::').size() > 0)
&& (item != "rust" || !file("Cargo.toml")
|| scan("Cargo.toml", r'^\s*publish\s*=\s*false').size() > 0
|| scan("Cargo.toml", r'^\s*(license\s*=\s*"[A-Za-z0-9.+ ()/-]+"|license-file\s*=|license\.workspace\s*=\s*true|license\s*=\s*\{\s*workspace\s*=\s*true)').size() > 0)Fix
Add the SPDX identifier of the LICENSE file to the manifest; fleetlint fix --apply does it for package.json and Cargo.toml when the LICENSE text is one recognised license. GNU licenses are left to you: write -only or -or-later, which the license text does not decide.
Agent instruction: Set the manifest’s license field to the SPDX identifier matching the LICENSE file; ask if the LICENSE text is not a recognised license.
fleetlint fix can apply this rule’s fix automatically (2 action(s)).
See: https://fleetlint.org/baseline/#public-repositories
Generated by fleetlint docs from catalog v0.1.0.