5 ms·
This is tough problem to solve given how many different ways projects have to declare licenses. I run a project called git.legal and we do ALL of the following
by kmewhort 10y ago
This is tough problem to solve given how many different ways projects have to declare licenses. I run a project called git.legal and we do ALL of the following, but still don't quite a get a 100% hit rate of finding a project's license:
1. Check for a license declaration in package manager metadata (eg. package.json)
2. Check for a license.txt file or try to parse out a readme's license section, and do a full-text diff against known licenses
3. Check the readme for an extensive set of regular expressions matching known license identifiers and common declarations such as "licensed under ...".
4. Check for a consistent license declaration in project source file headers
This gets about a 97% hit rate, but even for "hits" it's sometimes unclear what specific license version a project is under. For example, many projects just say "licensed under MIT"...but "MIT" isn't a specific license. There are several versions of it and there's no way to know which version the author intends to use for the project. That might be a minute point, but this all adds up to a lot of uncertainty around licensing.
So, project authors, please use metadata and include a specific version :)