Skip to content

Commit 34a3033

Browse files
authored
Merge pull request #13 from nexB/2-check-scancode-options
Check options in incoming ScanCode files #2
2 parents 1d54003 + ccce945 commit 34a3033

5 files changed

Lines changed: 2218 additions & 2 deletions

File tree

src/deltacode/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ def cli(new, old, csv_file, json_file):
7777
"""
7878

7979
# do the delta
80-
deltacode = DeltaCode(new, old)
81-
data = deltacode.to_dict()
80+
delta = DeltaCode(new, old)
81+
data = delta.to_dict()
8282

8383
# output to csv
8484
if csv_file:

src/deltacode/models.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,23 @@ def __init__(self, path=''):
1717
self.path = '' if path is None else path
1818
self.files_count = self.get_files_count(self.path)
1919
self.files = self.load_files(self.path)
20+
self.options = self.get_options(self.path)
21+
22+
def get_options(self, path):
23+
"""
24+
Collect the ScanCode options contained in the incoming ScanCode file.
25+
"""
26+
# TODO: handle this exception during #171
27+
try:
28+
scan = json.loads(open(path).read())
29+
except IOError:
30+
return
31+
32+
scan = json.loads(open(path).read())
33+
34+
options = scan.get('scancode_options')
35+
36+
return options
2037

2138
def is_valid_scan(self, location):
2239
"""

0 commit comments

Comments
 (0)