Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restriction Lint: Crate License #3867

Open
mehcode opened this issue Mar 11, 2019 · 4 comments
Open

Restriction Lint: Crate License #3867

mehcode opened this issue Mar 11, 2019 · 4 comments
Labels
A-lint Area: New lints T-cargo Type: cargo related

Comments

@mehcode
Copy link

mehcode commented Mar 11, 2019

After seeing the new-ish cargo metadata lints, I was thinking it would interesting to have a lint like:

crate_license
Check the license information in the crate metadata and restrict to something.

I imagine a whitelist/blacklist of licenses would be what most want.

# in clippy.toml
blacklisted-licenses = ["MIT"]
whitelisted-licenses = ["MPL"]

This seems fairly straightforward to implement after reading some of the source for the cargo lints. If we want to do this I'd love to try to implement.

@phansch phansch added A-lint Area: New lints T-cargo Type: cargo related labels Mar 11, 2019
@phansch
Copy link
Member

phansch commented Mar 11, 2019

Seems like a good idea, especially for orgs that want to enforce certain licenses on their crates.

@Julusian
Copy link

Seems like a good idea, especially for orgs that want to enforce certain licenses on their crates.

It would be useful for anyone writing anything that is to be distributed, in either source or binary form, to encourage them to be compliant with licenses of crates they use.

It is currently very easy to not notice that one crate some dependencies deep is licensed GPL, which would then require your software to also be GPL

@mehcode
Copy link
Author

mehcode commented Mar 11, 2019

Does there exist a reasonable default or should the blacklist/whitelist be empty?

If it's possible to know if license A is compatible with license B (where A is the root project and B is a dependency), that could be a reasonable default.

That can be decided after this is a thing of course.

@Manishearth
Copy link
Member

I would keep it empty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints T-cargo Type: cargo related
Projects
None yet
Development

No branches or pull requests

4 participants