1212LICENSE_COLUMN = 'License'
1313UPGRADE_COLUMN = 'Upgrade'
1414REPOSITORY_COLUMN = 'Repository'
15+ CVE_COLUMN = 'CVE'
1516PREVIEW_DETECTIONS_COMMON_HEADERS = ['File Path' , 'Ecosystem' , 'Dependency Name' ,
1617 'Direct Dependency' ,
1718 'Development Dependency' ]
@@ -42,7 +43,8 @@ def print_results(self, results: List[DocumentDetections]):
4243 if self .context .obj .get ('report_url' ):
4344 click .secho (f"Report URL: { self .context .obj .get ('report_url' )} " )
4445
45- def _extract_detections_per_detection_type_id (self , results : List [DocumentDetections ]):
46+ @staticmethod
47+ def _extract_detections_per_detection_type_id (results : List [DocumentDetections ]):
4648 detections_per_detection_type_id = {}
4749
4850 for document_detection in results :
@@ -57,21 +59,22 @@ def _print_detection_per_detection_type_id(self, detections_per_detection_type_i
5759 for detection_type_id in detections_per_detection_type_id :
5860 detections = detections_per_detection_type_id [detection_type_id ]
5961 headers = self ._get_table_headers ()
62+ rows = []
63+ title = ""
6064
6165 if detection_type_id == PACKAGE_VULNERABILITY_POLICY_ID :
6266 title = "Dependencies Vulnerabilities"
6367 headers = [SEVERITY_COLUMN ] + headers
6468 headers .extend (PREVIEW_DETECTIONS_COMMON_HEADERS )
69+ headers .append (CVE_COLUMN )
6570 headers .append (UPGRADE_COLUMN )
66- rows = []
6771 for detection in detections :
6872 rows .append (self ._get_upgrade_package_vulnerability (detection ))
6973
7074 if detection_type_id == LICENSE_COMPLIANCE_POLICY_ID :
7175 title = "License Compliance"
7276 headers .extend (PREVIEW_DETECTIONS_COMMON_HEADERS )
7377 headers .append (LICENSE_COLUMN )
74- rows = []
7578 for detection in detections :
7679 rows .append (self ._get_license (detection ))
7780
@@ -96,13 +99,15 @@ def _print_table_detections(self, detections: List[Detection], headers: List[str
9699 text_table .add_row (row )
97100 click .echo (text_table .draw ())
98101
99- def set_table_width (self , headers , text_table ):
102+ @staticmethod
103+ def set_table_width (headers , text_table ):
100104 header_width_size_cols = []
101105 for header in headers :
102106 header_width_size_cols .append (len (header ))
103107 text_table .set_cols_width (header_width_size_cols )
104108
105- def _print_summary_issues (self , detections : List , title : str ):
109+ @staticmethod
110+ def _print_summary_issues (detections : List , title : str ):
106111 click .echo (
107112 f'⛔ Found { len (detections )} issues of type: { click .style (title , bold = True )} ' )
108113
@@ -112,7 +117,8 @@ def _get_common_detection_fields(self, detection: Detection):
112117 detection .detection_details .get ('ecosystem' ),
113118 detection .detection_details .get ('package_name' ),
114119 detection .detection_details .get ('is_direct_dependency_str' ),
115- detection .detection_details .get ('is_dev_dependency_str' )
120+ detection .detection_details .get ('is_dev_dependency_str' ),
121+ detection .detection_details .get ('vulnerability_id' )
116122 ]
117123
118124 if self ._is_git_repository ():
0 commit comments