SRE-978: Require a license file per Cargo.toml and pyproject.toml directory - #9424
SRE-978: Require a license file per Cargo.toml and pyproject.toml directory#9424claude[bot] wants to merge 1 commit into
Conversation
…ectory The check enumerated Yarn workspaces only, so a Rust crate or Python package without a package.json was unchecked. It now also globs Cargo.toml and pyproject.toml and requires a LICENSE.md in each of those directories.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
3 Skipped Deployments
|
PR SummaryLow Risk Overview The script discovers those manifest paths via Reviewed by Cursor Bugbot for commit a3d7922. Bugbot is set up for automated code reviews on this repo. Configure here. |
Requested by Tim Diekmann · Slack thread
🌟 What is the purpose of this PR?
Before:
yarn lint:license-in-workspacestook its directory list fromyarn workspaces list, so it required aLICENSE.mdonly in directories that hold apackage.json. A Rust crate or a Python package without apackage.jsonwas never checked.After: the check requires a
LICENSE.mdin every directory holding aCargo.tomlor apyproject.tomlas well, and keeps the existing Yarn workspace rule.This is defensive ahead of the turborepo native-Rust transition, which would remove
package.jsonfrom Rust crates. Without this change, every crate would stop being checked at that point. EveryCargo.tomlandpyproject.tomldirectory in the repository already has aLICENSE.md, so this PR adds no license files.scripts/check-license-in-workspaces.tsgains a secondglobbycall for**/Cargo.tomland**/pyproject.toml. The checked directory set becomes the union of the repository root, the Yarn workspace locations, and the parent directory of each of those manifests. The ignore list is hoisted to a constant so both globs share it.yarn workspaces liststays the authority for JavaScript packages, sopackage.jsonbehaviour is unchanged.🔗 Related links
🔍 What does this change?
LICENSE.mdin every directory holding aCargo.tomlor apyproject.toml.yarn workspaces listreports the root workspace at location.and the script also added the root explicitly.Pre-Merge Checklist 🚀
🚢 Has this modified a publishable library?
This PR:
📜 Does this require a change to the docs?
The changes in this PR:
🕸️ Does this require a change to the Turbo Graph?
The changes in this PR:
Cargo.tomlwithout a[package]section counts as a package directory. The only one in the repository is the root manifest, which already requires aLICENSE.md, so nothing changes today. Excluding virtual workspace manifests would need a TOML parse.check-license-in-workspaces.ts, and the yarn scriptlint:license-in-workspaces, though the check covers more than Yarn workspaces. Renaming both would touchpackage.jsonand.github/workflows/lint.yml; say the word and I will do it.🛡 What tests cover this?
globaljob of.github/workflows/lint.yml. No new CI wiring was needed.❓ How to test this?
yarn lint:license-in-workspaces. It exits 0 and reports no[MISSING]entries.mkdir -p libs/scratch-crate && printf '[package]\nname = "scratch-crate"\n' > libs/scratch-crate/Cargo.toml, then run the check again. It exits 1 with[MISSING] libs/scratch-crate/LICENSE.md.libs/scratch-crate.