diff --git a/src/lint/ArcanistLintMessage.php b/src/lint/ArcanistLintMessage.php --- a/src/lint/ArcanistLintMessage.php +++ b/src/lint/ArcanistLintMessage.php @@ -125,6 +125,21 @@ } public function setName($name) { + $maximum_bytes = 255; + $actual_bytes = strlen($name); + + if ($actual_bytes > $maximum_bytes) { + throw new Exception( + pht( + 'Parameter ("%s") passed to "%s" when constructing a lint message '. + 'must be a string with a maximum length of %s bytes, but is %s '. + 'bytes in length.', + $name, + 'setName()', + new PhutilNumber($maximum_bytes), + new PhutilNumber($actual_bytes))); + } + $this->name = $name; return $this; } diff --git a/src/unit/ArcanistUnitTestResult.php b/src/unit/ArcanistUnitTestResult.php --- a/src/unit/ArcanistUnitTestResult.php +++ b/src/unit/ArcanistUnitTestResult.php @@ -30,6 +30,20 @@ } public function setName($name) { + $maximum_bytes = 255; + $actual_bytes = strlen($name); + + if ($actual_bytes > $maximum_bytes) { + throw new Exception( + pht( + 'Parameter ("%s") passed to "%s" when constructing a unit test '. + 'message must be a string with a maximum length of %s bytes, but '. + 'is %s bytes in length.', + $name, + 'setName()', + new PhutilNumber($maximum_bytes), + new PhutilNumber($actual_bytes))); + } $this->name = $name; return $this; }