1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-26 00:32:41 +01:00

Add explicit limits to unit test/lint error names

Summary:
Fixes T12981.

See new `arc lint` output: P2071

See new `arc unit` output: P2072

Test Plan: Ran `arc unit/lint/diff` and observed new error instead of a Conduit error

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T12981

Differential Revision: https://secure.phabricator.com/D18603
This commit is contained in:
Austin McKinley 2017-09-14 11:24:36 -07:00
parent cbc785ddce
commit df81d79d77
2 changed files with 29 additions and 0 deletions

View file

@ -126,6 +126,21 @@ final class ArcanistLintMessage extends Phobject {
}
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;
}

View file

@ -30,6 +30,20 @@ final class ArcanistUnitTestResult extends Phobject {
}
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;
}