Skip to content

Commit 87f5b81

Browse files
authored
Merge pull request #75 from fosslight/develop
Add yaml format for FOSSLight Report
2 parents 11ffdd3 + cb606e4 commit 87f5b81

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

src/fosslight_source/_help.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
-m\t\t\t\t Print additional information for scan result on separate sheets
2525
-o <output_path>\t\t Output path
2626
\t\t\t\t (If you want to generate the specific file name, add the output path with file name.)
27-
-f <format>\t\t\t Output file format (excel, csv, opossum)
27+
-f <format>\t\t\t Output file format (excel, csv, opossum, yaml)
2828
-s <scanner>\t\t Select which scanner to be run (scancode, scanoss, all)"""
2929

3030
_HELP_MESSAGE_CONVERT = """

src/fosslight_source/cli.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ def create_report_file(start_time, scanned_result, license_list, selected_scanne
120120
extended_header = {}
121121
sheet_list = {}
122122
_json_ext = ".json"
123+
_yaml_ext = ".yaml"
123124

124125
if output_path == "":
125126
output_path = os.getcwd()
@@ -128,9 +129,11 @@ def create_report_file(start_time, scanned_result, license_list, selected_scanne
128129

129130
if output_file == "":
130131
if output_extension == _json_ext:
131-
output_file = "Opossum_input_" + start_time
132+
output_file = f"Opossum_input_{start_time}"
133+
if output_extension == _yaml_ext:
134+
output_file = f"fosslight-sbom-info_{start_time}"
132135
else:
133-
output_file = "FOSSLight-Report_" + start_time
136+
output_file = f"FOSSLight-Report_{start_time}"
134137

135138
scanned_result = sorted(scanned_result, key=lambda row: (''.join(row.licenses)))
136139

src/fosslight_source/run_scancode.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def run_scan(path_to_scan, output_file_name="",
3434
result_list = []
3535
license_list = []
3636
_json_ext = ".json"
37+
_yaml_ext = ".yaml"
3738

3839
start_time = datetime.now().strftime('%Y%m%d_%H%M%S')
3940

@@ -48,6 +49,8 @@ def run_scan(path_to_scan, output_file_name="",
4849
if output_file == "":
4950
if output_extension == _json_ext:
5051
output_file = f"Opossum_input_{start_time}"
52+
elif output_extension == _yaml_ext:
53+
output_file = f"fosslight-sbom-info_{start_time}"
5154
else:
5255
output_file = f"FOSSLight-Report_{start_time}"
5356

0 commit comments

Comments
 (0)