public/manifest-license/rust
Package manifest declares the license
Implements public/manifest-license for rust.
| Severity | info |
| Tiers | 1 |
| Stacks | rust |
| Scope | each |
| Kind | expr |
| Source | library v0.8.0 |
| Selected by | fleetlint-recommended@v0.8.0 |
Requirement
Cargo.toml sets package.license (SPDX), license-file or the workspace’s license, unless the crate has publish = false.
Why
Registries, SBOM tools and license checkers read the manifest, not the LICENSE file.
Capability applies when
repo.publicCheck
!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() > 0Fix
Add the SPDX identifier of the LICENSE file to Cargo.toml package.license; fleetlint fix --apply does it when the LICENSE text is one recognised license.
Agent instruction (from public/manifest-license): 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 (1 action(s)).
A finding that names no file points at Cargo.toml.
Sources
- https://spdx.org/licenses/ (spec)
- https://fleetlint.org/baseline/#public-repositories (convention)
- https://doc.rust-lang.org/cargo/reference/manifest.html (spec, The license and license-file fields)
- https://fleetlint.org/stacks/#rust
Generated by fleetlint docs from catalog v0.8.0.