[warning] Support multi-line description
R=iannucci
Change-Id: I7390da342d46e35117cbdc18af205aae83558060
Reviewed-on: https://chromium-review.googlesource.com/c/infra/luci/recipes-py/+/2438973
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
Auto-Submit: Yiwei Zhang <yiwzhang@google.com>
diff --git a/recipe_engine/internal/commands/test/report.py b/recipe_engine/internal/commands/test/report.py
index a5cec13..1aa2a2c 100644
--- a/recipe_engine/internal/commands/test/report.py
+++ b/recipe_engine/internal/commands/test/report.py
@@ -362,7 +362,9 @@
print '*' * 70
definition = recipe_deps.warning_definitions[warning_name]
if definition.description:
- print 'Description: %s' % definition.description
+ print 'Description:'
+ for desc in definition.description:
+ print ' %s' % desc
if definition.deadline:
print 'Deadline: %s' % definition.deadline
print_bug_links(definition)
diff --git a/recipe_engine/warning.proto b/recipe_engine/warning.proto
index bec609c..45115bc 100644
--- a/recipe_engine/warning.proto
+++ b/recipe_engine/warning.proto
@@ -24,8 +24,10 @@
// This name should match regex: "^[A-Z][A-Z0-9]*(\_[A-Z0-9]+)*$"
string name = 1;
- // (optional) Long description of the warning.
- string description = 2;
+ // (optional) Long description of the warning. Each string will be displayed
+ // as a new line in the console output. Therefore, it is recommended to keep
+ // the length of each string < 78 (80-2; 2 characters are for indentation).
+ repeated string description = 2;
// (optional) The deadline that the warning should be fixed before.
// Syntax: The deadline must be in ISO 8601 date format (i.e. YYYY-MM-DD)
diff --git a/unittests/warn_test.py b/unittests/warn_test.py
index 68aa442..e3bff0a 100755
--- a/unittests/warn_test.py
+++ b/unittests/warn_test.py
@@ -75,7 +75,7 @@
_validate(simple_definition)
full_definition = create_definition(
'FULL_WARNING_NAME',
- description = 'this is a description',
+ description = ['this is a description',],
deadline = '2020-12-31',
monorail_bug = warning_pb.MonorailBug(
host='bugs.chromium.org', project= 'chromium', id=123456),
@@ -365,7 +365,9 @@
}
warning {
name: "MYMODULE_DEPRECATION"
- description: "my_mod is deprecated. Use other_mod instead."
+ description: "my_mod is deprecated."
+ # Comment goes here
+ description: "Use other_mod instead."
deadline: "2020-12-31"
monorail_bug {
project: "chrome-operations"
@@ -422,7 +424,8 @@
\s*WARNING: main/MYMODULE_SWIZZLE_BADARG_USAGE\s*
\s*Found 2 call sites and 0 import sites\s*
[\*]{70}
- Description: The `badarg` argument on my_mod\.swizzle is deprecated\.
+ Description:
+ The `badarg` argument on my_mod\.swizzle is deprecated\.
Deadline: 2020-01-01
Bug Link: https://bugs\.chromium\.org/p/chromium/issues/detail\?id=123456
Call Sites:
@@ -461,7 +464,9 @@
\s*WARNING: main/MYMODULE_DEPRECATION\s*
\s*Found 0 call sites and 2 import sites\s*
[\*]{70}
- Description: my_mod is deprecated\. Use other_mod instead\.
+ Description:
+ my_mod is deprecated\.
+ Use other_mod instead\.
Deadline: 2020-12-31
Bug Link: https://bugs\.chromium\.org/p/chrome\-operations/issues/detail\?id=654321
Import Sites:
@@ -494,7 +499,9 @@
\s*WARNING: main/MYMODULE_DEPRECATION\s*
\s*Found 1 call sites and 1 import sites\s*
[\*]{70}
- Description: my_mod is deprecated\. Use other_mod instead\.
+ Description:
+ my_mod is deprecated\.
+ Use other_mod instead\.
Deadline: 2020-12-31
Bug Link: https://bugs\.chromium\.org/p/chrome\-operations/issues/detail\?id=654321
Call Sites:
@@ -604,7 +611,9 @@
}
warning {
name: "MYMODULE_DEPRECATION"
- description: "my_mod is deprecated. Use other_mod instead."
+ description: "my_mod is deprecated."
+ # Comment goes here
+ description: "Use other_mod instead."
deadline: "2020-12-31"
monorail_bug {
project: "chrome-operations"
@@ -650,7 +659,9 @@
\s*WARNING: upstream/MYMODULE_DEPRECATION\s*
\s*Found 0 call sites and 1 import sites\s*
[\*]{70}
- Description: my_mod is deprecated\. Use other_mod instead\.
+ Description:
+ my_mod is deprecated\.
+ Use other_mod instead\.
Deadline: 2020-12-31
Bug Link: https://bugs\.chromium\.org/p/chrome\-operations/issues/detail\?id=654321
Import Sites:
@@ -659,7 +670,8 @@
\s*WARNING: upstream/MYMODULE_SWIZZLE_BADARG_USAGE\s*
\s*Found 1 call sites and 0 import sites\s*
[\*]{70}
- Description: The `badarg` argument on my_mod\.swizzle is deprecated\.
+ Description:
+ The `badarg` argument on my_mod\.swizzle is deprecated\.
Deadline: 2020-01-01
Bug Link: https://bugs\.chromium\.org/p/chromium/issues/detail\?id=123456
Call Sites: