mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 10:41:31 +00:00
[ssci] Add condition on license field separator warning
This CL updates the License field validation so that the warning to use the standard comma separator is only returned if processing the license value resulted in multiple license types. Bug: b:309712938 Change-Id: Ic9189b8dd76e60bc3d546dea41fdb36faae8dbb4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5003558 Auto-Submit: Anne Redulla <aredulla@google.com> Commit-Queue: Anne Redulla <aredulla@google.com> Reviewed-by: Dan Le Febvre <dlf@google.com> Commit-Queue: Dan Le Febvre <dlf@google.com>
This commit is contained in:
@@ -128,7 +128,7 @@ class LicenseField(field_types.MetadataField):
|
||||
])
|
||||
|
||||
# Suggest using the standard value delimiter when possible.
|
||||
if (re.search(_PATTERN_VERBOSE_DELIMITER, value)
|
||||
if (len(licenses) > 1 and re.search(_PATTERN_VERBOSE_DELIMITER, value)
|
||||
and self.VALUE_DELIMITER not in value):
|
||||
return vr.ValidationWarning(
|
||||
reason=f"Separate licenses using a '{self.VALUE_DELIMITER}'.")
|
||||
|
||||
@@ -118,6 +118,8 @@ class FieldValidationTest(unittest.TestCase):
|
||||
valid_values=[
|
||||
"Apache, 2.0 / MIT / MPL 2",
|
||||
"LGPL 2.1",
|
||||
"GPL v2 or later",
|
||||
"LGPL2 with the classpath exception",
|
||||
"Apache, Version 2 and Public domain",
|
||||
],
|
||||
error_values=["", "\n", ",", "Apache 2.0 / MIT / "],
|
||||
|
||||
Reference in New Issue
Block a user