Skip to content

Commit a1a7c7e

Browse files
committed
Refactoring oss item
Signed-off-by: jiyeong.seok <[email protected]>
1 parent d0e483e commit a1a7c7e

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/fosslight_scanner/_run_compare.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
from bs4 import BeautifulSoup
1515
import fosslight_util.constant as constant
1616
from fosslight_util.compare_yaml import compare_yaml
17-
from fosslight_util.convert_excel_to_yaml import convert_excel_to_yaml
17+
from fosslight_util.read_excel import read_oss_report
18+
from fosslight_util.parsing_yaml import parsing_yml
1819

1920
logger = logging.getLogger(constant.LOGGER_NAME)
2021
ADD = "add"
@@ -255,10 +256,18 @@ def run_compare(before_f, after_f, output_path, output_file, file_ext, _start_ti
255256

256257
result_file = get_comparison_result_filename(output_path, output_file, file_ext, _start_time)
257258

258-
if before_ext == XLSX_EXT:
259-
convert_excel_to_yaml(before_f, before_yaml)
260-
convert_excel_to_yaml(after_f, after_yaml)
261-
compared_result = compare_yaml(before_yaml, after_yaml)
259+
before_basepath = os.path.dirname(before_f)
260+
after_basepath = os.path.dirname(after_f)
261+
if XLSX_EXT == before_ext:
262+
before_fileitems = read_oss_report(before_f, "", before_basepath)
263+
elif YAML_EXT == before_ext:
264+
before_fileitems, _, _ = parsing_yml(before_yaml, before_basepath)
265+
if XLSX_EXT == after_ext:
266+
after_fileitems = read_oss_report(after_f, after_basepath)
267+
elif YAML_EXT == after_ext:
268+
after_fileitems, _, _ = parsing_yml(after_yaml, after_basepath)
269+
270+
compared_result = compare_yaml(before_fileitems, after_fileitems)
262271
if compared_result != '':
263272
count_compared_result(compared_result)
264273
ret, result_file = write_compared_result(result_file, compared_result, file_ext, before_yaml, after_yaml)

0 commit comments

Comments
 (0)