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

Expand error messages for invalid license information #6545

Merged
merged 3 commits into from
Oct 9, 2023

Conversation

ehuss
Copy link
Contributor

@ehuss ehuss commented May 29, 2023

This expands the error message when the license expression is not valid. It provides some help text if the user needs a custom license, and also points to the cargo documentation. It also includes the actual error message from the validator, which can be helpful if you have a more complex expression, and it may not be clear exactly which part of the expression is invalid.

This also clarifies the wording when license is not specified.

The error may look something like this:

error: failed to publish to registry at http://localhost:8888/

Caused by:
  the remote server responded with an error: unknown or invalid license expression; see http://opensource.org/licenses for options, and http://spdx.org/licenses/ for their identifiers
  Note: If you have a non-standard license that is not listed by SPDX, use the license-file field to specify the path to a file containing the text of the license.
  See https://doc.rust-lang.org/cargo/reference/manifest.html#the-license-and-license-file-fields for more information.
  MIT AND foobar
          ^^^^^^ unknown term

Closes rust-lang/cargo#3540

the text of the license.\n\
See https://doc.rust-lang.org/cargo/reference/manifest.html#the-license-and-license-file-fields \
for more information.\n\
{e}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we are including the original SPDX error now, could you add a test case for this? :)

@Turbo87 Turbo87 added C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works A-backend ⚙️ labels May 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-backend ⚙️ C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fixing errors of a new project does not make it clear that non-OSI-approved license may be used
2 participants