add statuses
@@ -300,7 +300,7 @@ def create_cli_output(fixable=True, *cve_records: List[Record]) -> str:
def create_cli_license_violations_table(file_path: str, license_statuses: List[_LicenseStatus]) -> str:
- columns = 4
+ columns = 5
table_width = 120.0
column_width = int(table_width / columns)
table = PrettyTable(min_table_width=table_width, max_table_width=table_width)
@@ -309,16 +309,17 @@ def create_cli_license_violations_table(file_path: str, license_statuses: List[_
"Package name",
"Package version",
"Policy ID",
- "License"
+ "License",
+ "Status",
]
for curr_license_status in license_statuses:
table.add_row([curr_license_status["package_name"], curr_license_status["package_version"],
- curr_license_status["policy"], curr_license_status["license"]])
+ curr_license_status["policy"], curr_license_status["license"], curr_license_status["status"]])
table.align = "l"
table.min_width = column_width
table.max_width = column_width
# some hack for making the table's width as same as the cves-table's
- table_lines = [f"\t{line[:-2]}{line[-3] * 2}{line[-2:]}" for line in table.get_string().splitlines(keepends=True)]
+ table_lines = [f"\t{line[:-2]}{line[-3]}{line[-2:]}" for line in table.get_string().splitlines(keepends=True)]
return (
f"\t{file_path} - Licenses Statuses:\n"
f"{''.join(table_lines)}\n"
