Skip to content

Commit

Permalink
extensions: scancode: Fix file type reporting
Browse files Browse the repository at this point in the history
The get_file_type function assumed that the json object's boolean
values were strings but they were in fact boolean. This change
updates the function to do boolean checks on the various file type
keys.

Signed-off-by: Nisha K <nishak@vmware.com>
  • Loading branch information
Nisha K authored and rnjudge committed May 28, 2020
1 parent c9b2261 commit 6ed1f0c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tern/extensions/scancode/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ def get_file_type(scancode_file_dict):
'''Scancode's file dictionary has a set of keys:
is_binary, is_text, is_archive, is_media, is_source, is_script
using this set, return a filetype recognized by SPDX'''
if scancode_file_dict['is_binary'] == 'true':
if scancode_file_dict.get('is_binary'):
return 'BINARY'
if scancode_file_dict['is_source'] == 'true':
if scancode_file_dict.get('is_source'):
return 'SOURCE'
if scancode_file_dict['is_text'] == 'true':
if scancode_file_dict.get('is_text'):
return 'TEXT'
if scancode_file_dict['is_archive'] == 'true':
if scancode_file_dict.get('is_archive'):
return 'ARCHIVE'
return 'OTHER'

Expand Down

0 comments on commit 6ed1f0c

Please sign in to comment.