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

Enhance License Detection: Add Licenses to _licenseUrlOverrides list in util.js #1246

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
38 changes: 37 additions & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,10 @@ const _licenseUrlOverrides = [
test: /^\w*https?:\/\/(?:www\.)?gnu.org\/licenses\/lgpl.(html|txt)(.*?)$/i,
license: 'LGPL-3.0'
},
{
test: /^\w*https?:\/\/(?:www\.)?gnu\.org\/licenses\/lgpl-2\.1\.(html|txt)$/i,
license: 'LGPL-2.1'
},
{
test: /^\w*https?:\/\/(?:www\.)?gnu\.org\/licenses\/old-licenses\/(.*?)(\.en)?(\.html)?$/i,
licenseMatchGroup: 1
Expand Down Expand Up @@ -593,7 +597,39 @@ const _licenseUrlOverrides = [
{ test: /^https?:\/\/specflow.org\/plus\/eula\//i, license: 'OTHER' },
{ test: /^https?:\/\/www.streamcoders.com\/products\/msneteula.html/i, license: 'OTHER' },
{ test: /^https?:\/\/workflowenginenet.com\/EULA/i, license: 'OTHER' },
{ test: /^https?:\/\/aka.ms\/azureml-sdk-license/i, license: 'OTHER' }
{ test: /^https?:\/\/aka.ms\/azureml-sdk-license/i, license: 'OTHER' },
{
test: /^\w*https?:\/\/(?:www\.)?eclipse\.org\/legal\/epl-v10\.html$/i,
license: 'EPL-1.0'
},
{
test: /^https?:\/\/(?:www\.)?eclipse\.org\/legal\/epl-2\.0\/?$/i,
license: 'EPL-2.0'
},
{
test: /^\w*https?:\/\/(?:www\.)?mozilla\.org(?:\/en-US)?\/MPL\/(MPL-1\.1\.html|1\.1\/)$/i,
license: 'MPL-1.1'
},
{
test: /^https?:\/\/(?:www\.)?mozilla\.org(?:\/en-US)?\/MPL\/2\.0\/$/i,
license: 'MPL-2.0'
},
{
test: /^\w*https?:\/\/(?:www\.)?eclipse\.org\/org\/documents\/edl-v10\.php$/i,
license: 'BSD-3-Clause'
},
{
test: /^https?:\/\/glassfish\.(dev\.java\.net|java\.net)\/public\/CDDL\+GPL_1_1\.html$/i,
license: 'CDDL-1.1 OR GPL-2.0-only WITH Classpath-exception-2.0'
},
{
test: /^https?:\/\/glassfish\.(dev\.java\.net|java\.net)\/public\/CDDL(\+|%2B)GPL\.html$/i,
license: 'CDDL-1.0 OR GPL-2.0-only WITH Classpath-exception-2.0'
},
{
test: /^https?:\/\/glassfish\.(dev\.java\.net|java\.net)\/public\/CDDLv1\.0\.html$/i,
license: 'CDDL-1.0'
}
]

module.exports = {
Expand Down
13 changes: 13 additions & 0 deletions test/lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ describe('Utils latest version', () => {

it('should extract license from license URLs', () => {
const inputs = {
'http://glassfish.java.net/public/CDDL+GPL_1_1.html': 'CDDL-1.1 OR GPL-2.0-only WITH Classpath-exception-2.0',
'https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html':
'CDDL-1.1 OR GPL-2.0-only WITH Classpath-exception-2.0',
'https://glassfish.java.net/public/CDDL%2BGPL.html': 'CDDL-1.0 OR GPL-2.0-only WITH Classpath-exception-2.0',
'https://glassfish.dev.java.net/public/CDDL+GPL.html': 'CDDL-1.0 OR GPL-2.0-only WITH Classpath-exception-2.0',
'https://glassfish.dev.java.net/public/CDDLv1.0.html': 'CDDL-1.0',
'http://www.eclipse.org/legal/epl-v10.html': 'EPL-1.0',
'https://www.eclipse.org/legal/epl-2.0/': 'EPL-2.0',
'http://www.eclipse.org/org/documents/edl-v10.php': 'BSD-3-Clause',
'https://www.mozilla.org/en-US/MPL/2.0/': 'MPL-2.0',
'https://www.mozilla.org/en-US/MPL/1.1/': 'MPL-1.1',
'http://www.mozilla.org/MPL/MPL-1.1.html': 'MPL-1.1',
'https://www.gnu.org/licenses/lgpl-2.1.html': 'LGPL-2.1',
'http://opensource.org/licenses/Apache-2.0': 'Apache-2.0',
'https://licenses.nuget.org/Apache-2.0': 'Apache-2.0',
'http://www.apache.org/licenses/LICENSE-2.0': 'Apache-2.0',
Expand Down
Loading