config-model icon indicating copy to clipboard operation
config-model copied to clipboard

Check for LICENSE files.

Open rerdavies opened this issue 2 years ago • 1 comments

It would be really nice if you could look for LICENSE files in npm packages, and use the contents of those files as default content for files under a directory that does contain such a file.

npm packages are required to have a file in the root of the package directory named LICENSE, LICENSE., license or license..

The standard convention in NPM pagckages seems to be to add the following header text in js files;

   /*
   Copyright 2018 Google LLC
   See LICENSE for license text. (or some variant of that).
   */

licensecheck gets the copyright string, but, of course returns UNKNOWN for license type. But licensecheck manages to get the license type right almost always, when run against the LICENSE file.

The suggested fix: if licensecheck returns UNKNOWN for a given file, search the directory and parent directories, looking for a (LICENSE|license).* file, and use the license type reported by running licensecheck on THAT file instead.

Needless to say, this has broad applicability to projects of other types as well.

rerdavies avatar Aug 24 '21 18:08 rerdavies

okay, that makes sense.

There's already a similar algorithm, but it can only take "main" copyright and license info from the same file (i.e. from README or LICENSE).

I'll improve this algorithm

dod38fr avatar Sep 07 '21 17:09 dod38fr