Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions cycode/cli/printers/tables/sca_table_printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,6 @@ def _enrich_table_with_values(table: Table, detection: Detection) -> None:
table.set(CVE_COLUMNS, detection_details.get('vulnerability_id'))
table.set(LICENSE_COLUMN, detection_details.get('license'))

@staticmethod
def _print_report_urls(local_scan_results: List['LocalScanResult']) -> None:
report_urls = [scan_result.report_url for scan_result in local_scan_results if scan_result.report_url]
if not report_urls:
return

click.echo('Report URLs:')
for report_url in report_urls:
click.echo(f'- {report_url}')

@staticmethod
def _print_summary_issues(detections_count: int, title: str) -> None:
click.echo(f'⛔ Found {detections_count} issues of type: {click.style(title, bold=True)}')
Expand Down
7 changes: 1 addition & 6 deletions cycode/cli/printers/tables/table_printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
VIOLATION_LENGTH_COLUMN = column_builder.build(name='Violation Length')
VIOLATION_COLUMN = column_builder.build(name='Violation')
SCAN_ID_COLUMN = column_builder.build(name='Scan ID')
REPORT_URL_COLUMN = column_builder.build(name='Report URL')

COLUMN_WIDTHS_CONFIG: ColumnWidthsConfig = {
SECRET_SCAN_TYPE: {
Expand Down Expand Up @@ -59,13 +58,12 @@ def _print_results(self, local_scan_results: List['LocalScanResult']) -> None:

for local_scan_result in local_scan_results:
for document_detections in local_scan_result.document_detections:
report_url = local_scan_result.report_url if local_scan_result.report_url else 'N/A'
for detection in document_detections.detections:
table.set(REPORT_URL_COLUMN, report_url)
table.set(SCAN_ID_COLUMN, local_scan_result.scan_id)
self._enrich_table_with_values(table, detection, document_detections.document)

self._print_table(table)
self._print_report_urls(local_scan_results)

def _get_table(self) -> Table:
table = Table()
Expand All @@ -85,9 +83,6 @@ def _get_table(self) -> Table:
table.add(VIOLATION_LENGTH_COLUMN)
table.add(VIOLATION_COLUMN)

if self.context.obj.get('report'):
table.add(REPORT_URL_COLUMN)

return table

def _enrich_table_with_values(self, table: Table, detection: Detection, document: Document) -> None:
Expand Down
10 changes: 10 additions & 0 deletions cycode/cli/printers/tables/table_printer_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,13 @@ def _print_results(self, local_scan_results: List['LocalScanResult']) -> None:
def _print_table(table: 'Table') -> None:
if table.get_rows():
click.echo(table.get_table().draw())

@staticmethod
def _print_report_urls(local_scan_results: List['LocalScanResult']) -> None:
report_urls = [scan_result.report_url for scan_result in local_scan_results if scan_result.report_url]
if not report_urls:
return

click.echo('Report URLs:')
for report_url in report_urls:
click.echo(f'- {report_url}')