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

crash when using --unknown-licenses #3343

Closed
armijnhemel opened this issue Apr 23, 2023 · 2 comments
Closed

crash when using --unknown-licenses #3343

armijnhemel opened this issue Apr 23, 2023 · 2 comments
Labels

Comments

@armijnhemel
Copy link
Contributor

Description

ERROR: failed to run scan plugin: licenses:
Traceback (most recent call last):
  File "/home/armijn/git/scancode-toolkit/src/scancode/cli.py", line 1078, in run_codebase_plugins
    plugin.process_codebase(codebase, **kwargs)
  File "/home/armijn/git/scancode-toolkit/src/licensedcode/plugin_license.py", line 192, in process_codebase
    license_detections = collect_license_detections(
  File "/home/armijn/git/scancode-toolkit/src/licensedcode/plugin_license.py", line 247, in collect_license_detections
    license_detection_objects = detections_from_license_detection_mappings(
  File "/home/armijn/git/scancode-toolkit/src/licensedcode/detection.py", line 516, in detections_from_license_detection_mappings
    LicenseDetectionFromResult.from_license_detection_mapping(
  File "/home/armijn/git/scancode-toolkit/src/licensedcode/detection.py", line 489, in from_license_detection_mapping
    matches = LicenseMatchFromResult.from_dicts(
  File "/home/armijn/git/scancode-toolkit/src/licensedcode/detection.py", line 614, in from_dicts
    return [LicenseMatchFromResult.from_dict(lmm) for lmm in license_match_mappings]
  File "/home/armijn/git/scancode-toolkit/src/licensedcode/detection.py", line 614, in <listcomp>
    return [LicenseMatchFromResult.from_dict(lmm) for lmm in license_match_mappings]
  File "/home/armijn/git/scancode-toolkit/src/licensedcode/detection.py", line 592, in from_dict
    rule = Rule.from_match_data(license_match_mapping)
  File "/home/armijn/git/scancode-toolkit/src/licensedcode/models.py", line 2315, in from_match_data
    return klass(
  File "<attrs generated init licensedcode.models.UnknownRule>", line 68, in __init__
    self.__attrs_post_init__()
  File "/home/armijn/git/scancode-toolkit/src/licensedcode/models.py", line 2552, in __attrs_post_init__
    self.tokens()
  File "/home/armijn/git/scancode-toolkit/src/licensedcode/models.py", line 2101, in tokens
    text.startswith(('http://', 'https://', 'ftp://'))
AttributeError: 'NoneType' object has no attribute 'startswith'

How To Reproduce

Unfortunately I cannot share any client data, so this will be a bit hard.

./scancode -l -n8 --json-pp=/tmp/out.json --unknown-licenses /path/to/source

System configuration

For bug reports, it really helps us to know:

  • What OS are you running on? (Windows/MacOS/Linux) - Linux
  • What version of scancode-toolkit was used to generate the scan file? - v32.0.0rc4
  • What installation method was used to install/run scancode? (pip/source download/other) - Git checkout
AyanSinhaMahapatra added a commit that referenced this issue Apr 24, 2023
AyanSinhaMahapatra added a commit that referenced this issue Apr 24, 2023
AyanSinhaMahapatra added a commit that referenced this issue Apr 24, 2023
Signed-off-by: Ayan Sinha Mahapatra <[email protected]>
@armijnhemel
Copy link
Contributor Author

It finishes without crashing.

@AyanSinhaMahapatra
Copy link
Member

AyanSinhaMahapatra commented Apr 25, 2023

Thanks for the report @armijnhemel , also want your feedback on how the --unknown-licenses is working, do you have any feedback/insights there? See #3300 for updates on this btw. Also feel free to close this if this is solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants