tools icon indicating copy to clipboard operation
tools copied to clipboard

Add a license expression validator to LicenseExpressionParser and the command line tools

Open goneall opened this issue 7 years ago • 1 comments

Requested by David Wheeler for the web validation project as a feature for the online tool.

To support this, we can add a method "validate" to the class LicenseExpressionParser which would return a string with any validation error message or return null if there are no validation errors.

We could add a new command to the command line tool "VerifyLicenseExpression" which would take a string as a parameter and return back any validation errors or "VALID" if correct.

Note that you can accomplish this today by calling the parse method in the LicenseExpressionParser. If there is an invalid expression, an exception will be thrown with the exception method describing the validation error.

goneall avatar Mar 29 '17 17:03 goneall

@goneall you could also consider using https://github.com/nexB/license-expression/ that does a more extensive validation. It should not be too difficult to package this as a Jython jar for Java.

pombredanne avatar Mar 29 '17 19:03 pombredanne