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

lc skips some SPDX-Identifiers #45

Open
LukasNickel opened this issue Aug 7, 2019 · 2 comments
Open

lc skips some SPDX-Identifiers #45

LukasNickel opened this issue Aug 7, 2019 · 2 comments
Labels
bug Something isn't working

Comments

@LukasNickel
Copy link

Hello,

I recently tried out your project and it works pretty well.
However when applying the tool to parts of the linux-kernel as test I noticed that there seems to be an issue where a lot of .cc and .h files do not get a license assigned. The Problem seems to be related to the way comments are marked in cpp opposed to go or python (characters after the license name).

How to reproduce

  • Create a file containing only:
    /* SPDX-License-Identifier: GPL-2.0 */
  • Use lc on that file. Result should be NOASSERTION

In contrast:

  • remove everything after GPL-2.0
  • Result should be GPL-2.0

Problem

  • Problem lies in parsers/guesser.go
  • The RegExp chooses GPL-2.0 */ instead of GPL-2.0
  • Comparing the License leads to false as the string are not equal

Solution (-Attempt)

  • Adapt the RegExp. Probably tricky? Or I just suck at them (which is a fact).
  • Use another string comparison method. I tested with strings.Contains which seems to work. I am not 100% sure however if this screws up some very similar named licenses. I didnt see any but there might be license names which completely contain other license name. This does however fix the minimal sample from above.
@boyter boyter added the bug Something isn't working label Aug 7, 2019
@boyter
Copy link
Owner

boyter commented Aug 7, 2019

Thanks for the report. I have been meaning to get back into maintaining lc and this might be the nudge needed.

@boyter
Copy link
Owner

boyter commented May 18, 2020

100% fixed in the new version 2.0.0 which I am working on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants