From da9d6ad2745e80a3ce32b62022ae9a12bc8acef7 Mon Sep 17 00:00:00 2001 From: Nicholas Kegler Date: Fri, 2 Oct 2020 08:24:15 -0300 Subject: [PATCH 1/3] Working multilines advisories. --- safety/formatter.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/safety/formatter.py b/safety/formatter.py index 6cfa369a..3acb950b 100644 --- a/safety/formatter.py +++ b/safety/formatter.py @@ -101,16 +101,22 @@ def render(vulns, full, checked_packages, used_db): if full: table.append(SheetReport.REPORT_SECTION) - descr = get_advisory(vuln) - - for pn, paragraph in enumerate(descr.replace('\r', '').split('\n\n')): - if pn: - table.append("| {:76} |".format('')) - for line in textwrap.wrap(paragraph, width=76): + advisory_lines = get_advisory(vuln).replace( + '\r', '' + ).splitlines() + + for line in advisory_lines: + if line == '': + table.append("| {:76} |".format(" ")) + for wrapped_line in textwrap.wrap(line, width=76): try: - table.append("| {:76} |".format(line.encode('utf-8'))) + table.append("| {:76} |".format( + wrapped_line.encode('utf-8') + )) except TypeError: - table.append("| {:76} |".format(line)) + table.append("| {:76} |".format( + wrapped_line + )) # append the REPORT_SECTION only if this isn't the last entry if n + 1 < len(vulns): table.append(SheetReport.REPORT_SECTION) From e8c3c3f9cd4db7c5b62750188c9a937ec74ad523 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=ADcholas=20Kegler?= Date: Sat, 9 Jan 2021 19:41:49 -0300 Subject: [PATCH 2/3] Adding history. --- HISTORY.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/HISTORY.rst b/HISTORY.rst index b0af7d8c..5c035ac3 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,6 +7,7 @@ History * Reduced Docker image and Binary size * Added bare and json outputs to license command +* Support line breaks on advisories 1.10.0 (2020-12-20) ------------------- From c0d27c0823880450373db18e384361a816bd8267 Mon Sep 17 00:00:00 2001 From: Rafael Pivato Date: Mon, 11 Jan 2021 00:36:22 -0300 Subject: [PATCH 3/3] Brought history change to right version --- HISTORY.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index 8d088359..68fa5c93 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -6,13 +6,13 @@ History ------------------- * Provide CVSS scores on full report, when available +* Support line breaks on advisories 1.10.1 (2021-01-03) ------------------- * Reduced Docker image and Binary size * Added bare and json outputs to license command -* Support line breaks on advisories 1.10.0 (2020-12-20) -------------------