Skip to content

Commit cb606e4

Browse files
committed
Add yaml format for FOSSLight Report
Signed-off-by: Jiyeong Seok <[email protected]>
1 parent 504db38 commit cb606e4

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 the Matched text for each license on a separate sheet (Scancode Only)
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
@@ -116,6 +116,7 @@ def create_report_file(start_time, scanned_result, license_list, selected_scanne
116116
extended_header = {}
117117
sheet_list = {}
118118
_json_ext = ".json"
119+
_yaml_ext = ".yaml"
119120

120121
if output_path == "":
121122
output_path = os.getcwd()
@@ -124,9 +125,11 @@ def create_report_file(start_time, scanned_result, license_list, selected_scanne
124125

125126
if output_file == "":
126127
if output_extension == _json_ext:
127-
output_file = "Opossum_input_" + start_time
128+
output_file = f"Opossum_input_{start_time}"
129+
if output_extension == _yaml_ext:
130+
output_file = f"fosslight-sbom-info_{start_time}"
128131
else:
129-
output_file = "FOSSLight-Report_" + start_time
132+
output_file = f"FOSSLight-Report_{start_time}"
130133

131134
scanned_result = sorted(scanned_result, key=lambda row: (''.join(row.licenses)))
132135

src/fosslight_source/run_scancode.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def run_scan(path_to_scan, output_file_name="",
3636
result_list = []
3737
license_list = []
3838
_json_ext = ".json"
39+
_yaml_ext = ".yaml"
3940

4041
_windows = platform.system() == "Windows"
4142
start_time = datetime.now().strftime('%Y%m%d_%H%M%S')
@@ -51,6 +52,8 @@ def run_scan(path_to_scan, output_file_name="",
5152
if output_file == "":
5253
if output_extension == _json_ext:
5354
output_file = f"Opossum_input_{start_time}"
55+
elif output_extension == _yaml_ext:
56+
output_file = f"fosslight-sbom-info_{start_time}"
5457
else:
5558
output_file = f"FOSSLight-Report_{start_time}"
5659

0 commit comments

Comments
 (0)