Do not warn about using "and" / "or" in License: fields

"and" and "or" are semantically different, so we should not discourage
their use.

See: https://crbug.com/355672411#comment11

Bug: 355672411
Change-Id: I95aa204da5550747ec67ccb6e42b87e6ac042b0b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5783166
Auto-Submit: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: Anne Redulla <aredulla@google.com>
Commit-Queue: Anne Redulla <aredulla@google.com>
changes/66/5783166/2
Andrew Grieve 6 months ago committed by LUCI CQ
parent 0bc7c4832e
commit caa77da956

@ -127,17 +127,10 @@ class LicenseField(field_types.SingleLineTextField):
return vr.ValidationWarning( return vr.ValidationWarning(
reason=f"{self._name} has a license not in the allowlist.", reason=f"{self._name} has a license not in the allowlist.",
additional=[ additional=[
f"Separate licenses using a '{self.VALUE_DELIMITER}'.",
"Licenses not allowlisted: " "Licenses not allowlisted: "
f"{util.quoted(not_allowlisted)}.", f"{util.quoted(not_allowlisted)}.",
]) ])
# Suggest using the standard value delimiter when possible.
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}'.")
return None return None
def narrow_type(self, value: str) -> Optional[List[str]]: def narrow_type(self, value: str) -> Optional[List[str]]:

@ -120,13 +120,13 @@ class FieldValidationTest(unittest.TestCase):
"GPL v2 or later", "GPL v2 or later",
"LGPL2 with the classpath exception", "LGPL2 with the classpath exception",
"Apache, Version 2 and Public domain", "Apache, Version 2 and Public domain",
"Public domain or MPL 2",
"APSL 2 and the MIT license",
], ],
error_values=["", "\n", ",", "Apache 2.0 / MIT / "], error_values=["", "\n", ",", "Apache 2.0 / MIT / "],
warning_values=[ warning_values=[
"Custom license", "Custom license",
"Custom / MIT", "Custom / MIT",
"Public domain or MPL 2",
"APSL 2 and the MIT license",
], ],
) )

Loading…
Cancel
Save