From 730758faacdcc55597443156485429bfb83a135c Mon Sep 17 00:00:00 2001 From: Wonjae Park Date: Wed, 14 Jun 2023 10:09:56 +0900 Subject: [PATCH] Sort the result by file and exclude attributes --- src/fosslight_source/cli.py | 2 +- tests/test_files/test/temp.cpp | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 tests/test_files/test/temp.cpp diff --git a/src/fosslight_source/cli.py b/src/fosslight_source/cli.py index a30dcde..cf821e2 100755 --- a/src/fosslight_source/cli.py +++ b/src/fosslight_source/cli.py @@ -170,7 +170,7 @@ def create_report_file(_start_time, scanned_result, license_list, selected_scann output_file = f"fosslight_report_src_{_start_time}" if scanned_result: - scanned_result = sorted(scanned_result, key=lambda row: (''.join(row.licenses))) + scanned_result = sorted(scanned_result, key=lambda row: (row.exclude, row.file)) if selected_scanner == 'scancode' or output_extension == _json_ext: sheet_list[SCANOSS_SHEET_NAME] = [scan_item.get_row_to_print() for scan_item in scanned_result] diff --git a/tests/test_files/test/temp.cpp b/tests/test_files/test/temp.cpp new file mode 100644 index 0000000..8019043 --- /dev/null +++ b/tests/test_files/test/temp.cpp @@ -0,0 +1,12 @@ +/* + * SPDX-FileCopyrightText: Copyright 2022 LG Electronics Inc. + * SPDX-License-Identifier: Apache-2.0 + * DownloadLocation: https://github.com/browserify/acorn-node + */ +#include + +int main() +{ + std::cout << "Hello, world!" << std::endl; + return 0; +}