Skip to content

License-check tweaking #352

@ericphanson

Description

@ericphanson

On the #pkg-dev call today, we (@DilumAluthge, @giordano, @staticfloat, @IanButterworth, and I) had a discussion about #344 and license-check overrides. I think the decision was basically to:

  • add a license field to the Project.toml that holds the SPDX identifier, e.g. license = "MIT"
  • also add a license_path field that contains the relative path to the license file (which should be in the package directory, not e.g. a toplevel directory when the package is a subdir package)
  • Then, if both these keys exist in the Project, the license contains an OSI-approved SPDX identifier, and license_path points to a file that exists, we use this as an override and pass the license check
  • otherwise, fallback to the check based on LicenseCheck.find_licenses but with the stronger restrictions orignially from Add license check to automerge guidelines #344, i.e. we need to detect 70% of the file and only find OSI-approved licenses.

Why add two fields?

The idea is to keep the license file itself as the source of truth, and simply provide a way to override both the detecting-the-file step and the detecting-the-file-contents step. I.e. license="MIT" is not the source of truth; it as an assertion that the file located at license_path contains the MIT license.

I think from this point of view, if the license_path field exists but not the license one, then we should just look at the file located at that path and try to detect the licenses within. If just license exists, I think we should ignore it because we don't know which file it's talking about.

What if the file at license_path does not seem to contain the license claimed?

This should be a warning, not a fatal error, since the point is to override possibly-faulty detection. This warning could be issued by RegistryCI (which currently does not emit non-fatal errors to the comment, but could be made to do so), or possibly as a separate health-check, like JuliaEcosystem/PackageAnalyzer.jl#30.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions