SPDX validation should consider arbitrary expressions in format `<KNOWN-LICENSE-ID>"+"` as valid

Open
#110 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
python
Domain
tooling

Research direction

Start by reproducing the get_spdx_licensing().validate() examples for CDDL-1.0+ and MIT OR CDDL-1.0+, then trace how the parser and validator handle license keys. Done means both expressions validate without errors and produce normalized expressions that retain the trailing +.

Written by the indexing model from the issue text.

Description

SPDX license expression allow the following Simple license expressions:

An SPDX License List Short Form Identifier with a unary "+" operator suffix to represent the current version of the license or any later version. For example: CDDL-1.0+

spec & docs:

request

make the validator and parser support SPDX License Identifiers with a + at the end.

reproduce

I tested with exactly this example CDDL-1.0+ value, but got a negative, where I expected a positive:

tested with license-expression==30.4.1

>>> from license_expression import get_spdx_licensing
>>> lic = get_spdx_licensing()

>>> lic.validate('CDDL-1.0')
ExpressionInfo(
    original_expression='CDDL-1.0',
    normalized_expression='CDDL-1.0',
    errors=[],
    invalid_symbols=[]
)

>>> lic.validate('CDDL-1.0+')
ExpressionInfo(
    original_expression='CDDL-1.0+',
    normalized_expression=None,
    errors=['Unknown license key(s): CDDL-1.0+'],
    invalid_symbols=['CDDL-1.0+']
)

>>> lic.validate('MIT OR CDDL-1.0+')
ExpressionInfo(
    original_expression='MIT OR CDDL-1.0+',
    normalized_expression=None,
    errors=['Unknown license key(s): CDDL-1.0+'],
    invalid_symbols=['CDDL-1.0+']
)
Dominant language
Python
Stars
74
Forks
38
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from aboutcode-org/license-expression

All issues in aboutcode-org/license-expression

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.