def extra_info_rows(self) -> list((object, str, int, str)): """ Returns formatted rows of extra info table for checkmarx. """ self._metric_source.obtain_issues(self._get_metric_source_ids(), self.risk_level_key.title()) return [(utils.format_link_object(issue.display_url, issue.title), issue.group, issue.count, issue.status) for issue in self._metric_source.issues()]
def extra_info_rows(self) -> List: """ Returns formatted rows of extra info table for code maintainability metrics. """ ret = list() for sort in self._metric_source.violation_sorts(): url, count, effort = \ self._metric_source.violations_type_severity(self._metric_source_id, sort[0], self.violation_type) ret.append((utils.format_link_object(url, sort[1]), count, effort)) return ret
def extra_info_rows(self) -> List: """ Returns formatted rows of extra info table for code maintainability metrics. """ ret = list() for sort in self._metric_source.violation_sorts(): url, count, effort = \ self._metric_source.violations_type_severity(self._metric_source_id, sort[0], self.violation_type) ret.append((utils.format_link_object(url, sort[1]), count, effort)) return ret
def format_text_with_links(self, text: str) -> str: """ Format a text paragraph with additional url. """ if self._metric_source: text = '{0} [{1}]'.format( utils.html_escape(text).replace('\n', ' '), str(utils.format_link_object( self._metric_source.url(), utils.html_escape(self._metric_source.metric_source_name) ))) return json.dumps(text)[1:-1] # Strip quotation marks
def extra_info_rows(self) -> list((object, int)): """ Returns formatted rows of extra info table for code maintainability metrics. """ severities = ['Blocker', 'Critical', 'Major', 'Minor', 'Info'] ret = list() for severity in severities: url, count, effort = \ self._metric_source.violations_type_severity(self._metric_source_id, self.violation_type, severity) ret.append((utils.format_link_object(url, severity), count, effort)) return ret
def extra_info_rows(self) -> list((object, int)): """ Returns formatted rows of extra info table for code maintainability metrics. """ severities = ['Blocker', 'Critical', 'Major', 'Minor', 'Info'] ret = list() for severity in severities: url, count, effort = \ self._metric_source.violations_type_severity(self._metric_source_id, self.violation_type, severity) ret.append((utils.format_link_object(url, severity), count, effort)) return ret
def convert_item_to_extra_info( self, item: metric_source.Dependency) -> (str, str, int, list): """ Transform a dependency item to a link and integer. """ cves = [] for cve in item.cve_links: cves.append( utils.format_link_object(cve[1], cve[0]) if item. cve_links else '') return (item.file_name, item.nr_vulnerabilities, tuple(cves)) if item else None
def extra_info_rows(self) -> List: """ Returns formatted rows of extra info table for code maintainability metrics. """ if not self._metric_source: return [] rows = list() for count, url, label in self._suppressions(): if count == -1: return [] rows.append((utils.format_link_object(url, label), count)) return rows
def extra_info_rows(self) -> List: """ Returns formatted rows of extra info table for code maintainability metrics. """ violation_sorts = [('BUG', 'Bugs'), ('VULNERABILITY', 'Vulnerabilities'), ('CODE_SMELL', 'Code Smell')] ret = list() for sort in violation_sorts: url, count, effort = \ self._metric_source.violations_type_severity(self._metric_source_id, sort[0], self.violation_type) ret.append((utils.format_link_object(url, sort[1]), count, effort)) return ret
def extra_info_rows(self) -> List: """ Returns formatted rows of extra info table for code maintainability metrics. """ if not self._metric_source: return [] rows = list() for count, url, label in self._suppressions(): if count == -1: return [] rows.append((utils.format_link_object(url, label), count)) return rows
def __append_links(self, fields, issue, result_list: List[Tuple], compare=None, limit_value=None, extra_fields=None): link = utils.format_link_object(self.get_issue_url(issue["key"]), fields["summary"]) result_list.append((link, float(fields[self.__field_name])))
def format_text_with_links(self, text: str) -> str: """ Format a text paragraph with additional url. """ if self._metric_source: text = '{0} [{1}]'.format( utils.html_escape(text).replace('\n', ' '), str( utils.format_link_object( self._metric_source.url(), utils.html_escape( self._metric_source.metric_source_name)))) return json.dumps(text)[1:-1] # Strip quotation marks
def format_comment_with_links(text: str, url_dict: Dict[str, str], # pylint: disable=no-self-use url_label: str) -> str: """ Format a text paragraph with optional urls and label for the urls. """ comment_text = Metric._format_links_in_comment_text(text) links = [ str(utils.format_link_object(href, utils.html_escape(anchor))) for (anchor, href) in list(url_dict.items()) ] if links: if url_label: url_label += ': ' comment_text = '{0} [{1}{2}]'.format(comment_text, url_label, ', '.join(sorted(links))) return json.dumps(comment_text)[1:-1] # Strip quotation marks
def convert_item_to_extra_info(self, item: metric_source.Dependency) -> (str, str, int, list): """ Transform a dependency item to a link and integer. """ cves = [] for cve in item.cve_links: cves.append(utils.format_link_object(cve[1], cve[0]) if item.cve_links else '') return (item.file_name, item.nr_vulnerabilities, tuple(cves)) if item else None
def _get_just_links(self, issues: List): return [ utils.format_link_object( self.get_issue_url(issue['key']), issue['fields']['summary']) for issue in issues if issue]
def extra_info_rows(self) -> list((object, str, int, str)): """ Returns formatted rows of extra info table for checkmarx. """ self._metric_source.obtain_issues(self._get_metric_source_ids(), self.risk_level_key.title()) return [(utils.format_link_object(issue.display_url, issue.title), issue.group, issue.count, issue.status) for issue in self._metric_source.issues()]
def _get_just_links(self, issues: List): return [ utils.format_link_object(self.get_issue_url(issue['key']), issue['fields']['summary']) for issue in issues if issue ]
def __append_links(self, fields, issue, result_list: List[Tuple], compare=None, limit_value=None, extra_fields=None): link = utils.format_link_object(self.get_issue_url(issue["key"]), fields["summary"]) result_list.append((link, float(fields[self.__field_name])))