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

Fix bug at following package license references #3970

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

AyanSinhaMahapatra
Copy link
Member

Fixes #3969

Tasks

  • Reviewed contribution guidelines
  • PR is descriptively titled 📑 and links the original issue above 🔗
  • Tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR
    Run tests locally to check for errors.
  • Commits are in uniquely-named feature branch and has no merge conflicts 📁
  • Updated documentation pages (if applicable)
  • Updated CHANGELOG.rst (if applicable)

Reference: #3969
Signed-off-by: Ayan Sinha Mahapatra <ayansmahapatra@gmail.com>
Copy link
Member

@pombredanne pombredanne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With a test, this is good to go!

@@ -140,6 +140,9 @@ def add_referenced_license_matches_for_package(resource, codebase):
):
continue

if not (referenced_resource and referenced_resource.license_detections):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, referenced_resource is referenced below outside of this loop and may not exists at all.

Copy link
Member

@pombredanne pombredanne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

referenced_resource needs some love after all :)

@@ -314,15 +317,15 @@ def add_referenced_filenames_license_matches_for_detections(resource, codebase):
referenced_license_expression=referenced_license_expression,
license_detection=license_detection,
):
if TRACE_REFERENCE:
if TRACE_REFERENCE and referenced_resource:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

referenced_resource is declared in another scope, which may be a problem. You may want to track referenced_resources_with_detections as a list of Resource rather than referenced_detections so you can:

  1. debug trace as needed
  2. account for when you have more than one file referenced.

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

Successfully merging this pull request may close these issues.

NoneType not handled in add_referenced_license_matches_for_package
2 participants