Skip to content
Merged
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
18 changes: 13 additions & 5 deletions cycode/cli/printers/table_printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,13 @@ def _print_table_detections(
def set_table_width(headers: List[str], text_table: Texttable) -> None:
header_width_size_cols = []
for header in headers:
header_width_size_cols.append(len(header))

header_len = len(header)
if header == CVE_COLUMN:
header_width_size_cols.append(header_len * 5)
elif header == UPGRADE_COLUMN:
header_width_size_cols.append(header_len * 2)
else:
header_width_size_cols.append(header_len)
text_table.set_cols_width(header_width_size_cols)

@staticmethod
Expand All @@ -133,8 +138,7 @@ def _get_common_detection_fields(self, detection: Detection) -> List[str]:
detection.detection_details.get('ecosystem'),
detection.detection_details.get('package_name'),
detection.detection_details.get('is_direct_dependency_str'),
detection.detection_details.get('is_dev_dependency_str'),
detection.detection_details.get('vulnerability_id')
detection.detection_details.get('is_dev_dependency_str')
]

if self._is_git_repository():
Expand All @@ -147,7 +151,11 @@ def _is_git_repository(self) -> bool:

def _get_upgrade_package_vulnerability(self, detection: Detection) -> List[str]:
alert = detection.detection_details.get('alert')
row = [detection.detection_details.get('advisory_severity')] + self._get_common_detection_fields(detection)
row = [
detection.detection_details.get('advisory_severity'),
*self._get_common_detection_fields(detection),
detection.detection_details.get('vulnerability_id')
]

upgrade = ''
if alert.get("first_patched_version"):
Expand Down