Skip to content

Commit

Permalink
updated main.py to handle matched_text_diagnostics seperately
Browse files Browse the repository at this point in the history
Signed-off-by: Shaikh Mohd Tehami <officialtehami@gmail.com>
  • Loading branch information
tehami02 authored and AyanSinhaMahapatra committed Dec 13, 2023
1 parent 00437e1 commit d96e69e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/licensedcode/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,9 +780,11 @@ def to_dict(
Return a "result" scan data built from a LicenseMatch object.
"""
matched_text = None
matched_text_diagnostics = None

if include_text:
if license_text_diagnostics:
matched_text = self.matched_text(whole_lines=False, highlight=True)
matched_text_diagnostics = self.matched_text(whole_lines=False, highlight=True)
else:
if whole_lines:
matched_text = self.matched_text(whole_lines=True, highlight=False)
Expand All @@ -806,6 +808,8 @@ def to_dict(

if include_text:
result['matched_text'] = matched_text
if license_text_diagnostics:
result['matched_text_diagnostics'] = matched_text_diagnostics
return result

def get_highlighted_text(self, trace=TRACE_HIGHLIGHTED_TEXT):
Expand Down

0 comments on commit d96e69e

Please sign in to comment.