-
Notifications
You must be signed in to change notification settings - Fork 33
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
Official MIT license text is not recognized as MIT by LicenseCompareHelper.isStandardLicenseWithinText #241
Comments
Thanks @sdheh for the detailed analysis! This could explain some of the other issues. It may be a little while before I can work on a fix myself since I'm heads-down working on the SPDX 3 upgrade. In the mean time pull requests would be welcome. |
I'm pretty sure this is a duplicate of #234. |
By the way, the regex match will always include the first 5000 characters before the word "permission" because the beginning is optional and |
It may be more efficient to make this match less greedy, but it shouldn't cause a problem since the follow-on calls to the token license matching algorithm will skip the "optional" text. |
Fixes #241 Fixes #234 Include code provided by @pmonk in #236 modified for version 2.0+ Signed-off-by: Gary O'Neall <[email protected]>
TLDR: LicenseCompareHelper.matchingStandardLicenseIdsWithinText does not match the MIT license text from https://spdx.org/licenses/MIT.html but LicenseCompareHelper.isTextStandardLicense does.
Version: 1.1.11 and allowing the fetching of recent license templates from the internet.
Details (steps to reproduce):
I copied the following text from https://spdx.org/licenses/MIT.html and used assigned it to the String
licenseText
:I ran the following code:
This produces the following output:
but the output should be
The problem is in
TemplateRegexMatcher.findTemplateWithinText
, where the startPattern isThe problem is the following part:
There is no
\s*
afterfile)
so that is why this regex does not match the text.The text was updated successfully, but these errors were encountered: