Thread (11 messages) 11 messages, 2 authors, 2020-10-14

[cip-dev] [cip-kernel-sec 1/3] report_affected: word-wrap for the 'description'

From: Daniel Sangorrin <hidden>
Date: 2020-09-25 04:00:06
Subsystem: the rest · Maintainer: Linus Torvalds

From: Nguyen Van Hieu <redacted>

Currently some descriptions are quite long, and it is hard to read.
Add line-breaks so every line is at most 80 characters long.

Signed-off-by: Nguyen Van Hieu <redacted>
Signed-off-by: Daniel Sangorrin <redacted>
---
 scripts/report_affected.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/scripts/report_affected.py b/scripts/report_affected.py
index a97b700..a181d97 100755
--- a/scripts/report_affected.py
+++ b/scripts/report_affected.py
@@ -19,6 +19,7 @@ import kernel_sec.branch
 import kernel_sec.issue
 import kernel_sec.version
 
+import textwrap
 
 def main(git_repo, remotes, only_fixed_upstream,
          include_ignored, show_description, *branch_names):
@@ -136,8 +137,11 @@ def main(git_repo, remotes, only_fixed_upstream,
         if show_description:
             print('%s:' % branch['full_name'])
             for cve_id in sorted_cve_ids:
-                print(cve_id, '=>',
-                      kernel_sec.issue.load(cve_id).get('description', 'None'))
+                description=kernel_sec.issue.load(cve_id).get('description', 'None')
+                wrap_description = ''
+                for line in textwrap.wrap(description, 80, break_long_words=False):
+                    wrap_description += line + '\n  '
+                print(cve_id, '=>',wrap_description)
         else:
             print('%s:' % branch['full_name'], *sorted_cve_ids)
 
-- 
2.25.1

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help