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
18 changes: 12 additions & 6 deletions cycode/cli/printers/table_printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
LICENSE_COLUMN = 'License'
UPGRADE_COLUMN = 'Upgrade'
REPOSITORY_COLUMN = 'Repository'
CVE_COLUMN = 'CVE'
PREVIEW_DETECTIONS_COMMON_HEADERS = ['File Path', 'Ecosystem', 'Dependency Name',
'Direct Dependency',
'Development Dependency']
Expand Down Expand Up @@ -42,7 +43,8 @@ def print_results(self, results: List[DocumentDetections]):
if self.context.obj.get('report_url'):
click.secho(f"Report URL: {self.context.obj.get('report_url')}")

def _extract_detections_per_detection_type_id(self, results: List[DocumentDetections]):
@staticmethod
def _extract_detections_per_detection_type_id(results: List[DocumentDetections]):
detections_per_detection_type_id = {}

for document_detection in results:
Expand All @@ -57,21 +59,22 @@ def _print_detection_per_detection_type_id(self, detections_per_detection_type_i
for detection_type_id in detections_per_detection_type_id:
detections = detections_per_detection_type_id[detection_type_id]
headers = self._get_table_headers()
rows = []
title = ""

if detection_type_id == PACKAGE_VULNERABILITY_POLICY_ID:
title = "Dependencies Vulnerabilities"
headers = [SEVERITY_COLUMN] + headers
headers.extend(PREVIEW_DETECTIONS_COMMON_HEADERS)
headers.append(CVE_COLUMN)
headers.append(UPGRADE_COLUMN)
rows = []
for detection in detections:
rows.append(self._get_upgrade_package_vulnerability(detection))

if detection_type_id == LICENSE_COMPLIANCE_POLICY_ID:
title = "License Compliance"
headers.extend(PREVIEW_DETECTIONS_COMMON_HEADERS)
headers.append(LICENSE_COLUMN)
rows = []
for detection in detections:
rows.append(self._get_license(detection))

Expand All @@ -96,13 +99,15 @@ def _print_table_detections(self, detections: List[Detection], headers: List[str
text_table.add_row(row)
click.echo(text_table.draw())

def set_table_width(self, headers, text_table):
@staticmethod
def set_table_width(headers, text_table):
header_width_size_cols = []
for header in headers:
header_width_size_cols.append(len(header))
text_table.set_cols_width(header_width_size_cols)

def _print_summary_issues(self, detections: List, title: str):
@staticmethod
def _print_summary_issues(detections: List, title: str):
click.echo(
f'⛔ Found {len(detections)} issues of type: {click.style(title, bold=True)}')

Expand All @@ -112,7 +117,8 @@ def _get_common_detection_fields(self, detection: Detection):
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('is_dev_dependency_str'),
detection.detection_details.get('vulnerability_id')
]

if self._is_git_repository():
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cycode"
version = "0.0.0" # placeholder. Will be filled automatically on poetry build from Git Tag
version = "0.2.4.dev8" # placeholder. Will be filled automatically on poetry build from Git Tag
Copy link
Contributor

@MarshalX MarshalX May 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please move the placeholder back asap

description = "Perform secrets/iac scans for your sources using Cycode's engine"
keywords=["secret-scan", "cycode", "devops", "token", "secret", "security", "cycode", "code"]
authors = ["Cycode <support@cycode.com>"]
Expand Down Expand Up @@ -49,7 +49,7 @@ responses = ">=0.23.1,<0.24.0"

# poetry self add "poetry-dynamic-versioning[plugin]"
[tool.poetry-dynamic-versioning]
enable = true
enable = false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please move it back asap

strict = true
bump = true
metadata = false
Expand Down