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
20 changes: 18 additions & 2 deletions cycode/cli/printers/sca_table_printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
'Ecosystem',
'Dependency Name',
'Direct Dependency',
'Development Dependency'
'Development Dependency',
'Dependency Paths',
]


Expand Down Expand Up @@ -107,13 +108,28 @@ def set_table_width(headers: List[str], text_table: Texttable) -> None:
def _print_summary_issues(detections: List, title: str) -> None:
click.echo(f'⛔ Found {len(detections)} issues of type: {click.style(title, bold=True)}')

@staticmethod
def _shortcut_dependency_paths(dependency_paths: str) -> str:
dependencies = dependency_paths.split(' -> ')

if len(dependencies) < 2:
return dependencies[0]

return f'{dependencies[0]} -> ... -> {dependencies[-1]}'

def _get_common_detection_fields(self, detection: Detection) -> List[str]:
dependency_paths = 'N/A'
dependency_paths_raw = detection.detection_details.get('dependency_paths')
if dependency_paths_raw:
dependency_paths = self._shortcut_dependency_paths(dependency_paths_raw)

row = [
detection.detection_details.get('file_name'),
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'),
dependency_paths,
]

if self._is_git_repository():
Expand Down