mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-15 03:12:40 +01:00
(stable) Promote 2015 Week 40
This commit is contained in:
commit
742327128f
10 changed files with 95 additions and 29 deletions
|
@ -72,6 +72,7 @@ final class ArcanistCSSLintLinter extends ArcanistExternalLinter {
|
||||||
->setLine($child->getAttribute('line'))
|
->setLine($child->getAttribute('line'))
|
||||||
->setChar($child->getAttribute('char'))
|
->setChar($child->getAttribute('char'))
|
||||||
->setCode($this->getLinterName())
|
->setCode($this->getLinterName())
|
||||||
|
->setName($this->getLinterName())
|
||||||
->setDescription($child->getAttribute('reason'))
|
->setDescription($child->getAttribute('reason'))
|
||||||
->setOriginalText(
|
->setOriginalText(
|
||||||
substr(
|
substr(
|
||||||
|
|
|
@ -50,6 +50,7 @@ final class ArcanistClosureLinter extends ArcanistExternalLinter {
|
||||||
$message = id(new ArcanistLintMessage())
|
$message = id(new ArcanistLintMessage())
|
||||||
->setPath($path)
|
->setPath($path)
|
||||||
->setLine($matches[1])
|
->setLine($matches[1])
|
||||||
|
->setName('GJSLINT'.$matches[2])
|
||||||
->setSeverity(ArcanistLintSeverity::SEVERITY_ERROR)
|
->setSeverity(ArcanistLintSeverity::SEVERITY_ERROR)
|
||||||
->setCode($this->getLinterName().$matches[2])
|
->setCode($this->getLinterName().$matches[2])
|
||||||
->setDescription($matches[3]);
|
->setDescription($matches[3]);
|
||||||
|
|
|
@ -53,6 +53,7 @@ final class ArcanistGoLintLinter extends ArcanistExternalLinter {
|
||||||
$message->setLine($matches[1]);
|
$message->setLine($matches[1]);
|
||||||
$message->setChar($matches[2]);
|
$message->setChar($matches[2]);
|
||||||
$message->setCode($this->getLinterName());
|
$message->setCode($this->getLinterName());
|
||||||
|
$message->setName($this->getLinterName());
|
||||||
$message->setDescription(ucfirst(trim($matches[3])));
|
$message->setDescription(ucfirst(trim($matches[3])));
|
||||||
$message->setSeverity(ArcanistLintSeverity::SEVERITY_ADVICE);
|
$message->setSeverity(ArcanistLintSeverity::SEVERITY_ADVICE);
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,7 @@ final class ArcanistJSONLintLinter extends ArcanistExternalLinter {
|
||||||
$message->setLine($matches['line']);
|
$message->setLine($matches['line']);
|
||||||
$message->setChar($matches['column']);
|
$message->setChar($matches['column']);
|
||||||
$message->setCode($this->getLinterName());
|
$message->setCode($this->getLinterName());
|
||||||
|
$message->setName($this->getLinterName());
|
||||||
$message->setDescription(ucfirst($matches['description']));
|
$message->setDescription(ucfirst($matches['description']));
|
||||||
$message->setSeverity(ArcanistLintSeverity::SEVERITY_ERROR);
|
$message->setSeverity(ArcanistLintSeverity::SEVERITY_ERROR);
|
||||||
|
|
||||||
|
|
|
@ -109,6 +109,7 @@ final class ArcanistJscsLinter extends ArcanistExternalLinter {
|
||||||
$message->setLine($error->getAttribute('line'));
|
$message->setLine($error->getAttribute('line'));
|
||||||
$message->setChar($error->getAttribute('column'));
|
$message->setChar($error->getAttribute('column'));
|
||||||
$message->setCode('JSCS');
|
$message->setCode('JSCS');
|
||||||
|
$message->setName('JSCS');
|
||||||
$message->setDescription($error->getAttribute('message'));
|
$message->setDescription($error->getAttribute('message'));
|
||||||
|
|
||||||
switch ($error->getAttribute('severity')) {
|
switch ($error->getAttribute('severity')) {
|
||||||
|
|
|
@ -71,6 +71,7 @@ final class ArcanistPyFlakesLinter extends ArcanistExternalLinter {
|
||||||
$message->setPath($path);
|
$message->setPath($path);
|
||||||
$message->setLine($matches[2]);
|
$message->setLine($matches[2]);
|
||||||
$message->setCode($this->getLinterName());
|
$message->setCode($this->getLinterName());
|
||||||
|
$message->setName($this->getLinterName());
|
||||||
$message->setDescription($description);
|
$message->setDescription($description);
|
||||||
$message->setSeverity($severity);
|
$message->setSeverity($severity);
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,13 @@ final class ArcanistBaseCommitParser extends Phobject {
|
||||||
case 'prompt':
|
case 'prompt':
|
||||||
$reason = pht('it is what you typed when prompted.');
|
$reason = pht('it is what you typed when prompted.');
|
||||||
$this->api->setBaseCommitExplanation($reason);
|
$this->api->setBaseCommitExplanation($reason);
|
||||||
return phutil_console_prompt(pht('Against which commit?'));
|
$result = phutil_console_prompt(pht('Against which commit?'));
|
||||||
|
if (!strlen($result)) {
|
||||||
|
// Allow the user to continue to the next rule by entering no
|
||||||
|
// text.
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
case 'local':
|
case 'local':
|
||||||
case 'user':
|
case 'user':
|
||||||
case 'project':
|
case 'project':
|
||||||
|
|
|
@ -2753,15 +2753,7 @@ EOTEXT
|
||||||
$unit[$key] = $this->getModernUnitDictionary($message);
|
$unit[$key] = $this->getModernUnitDictionary($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($unit_result) {
|
$type = ArcanistUnitWorkflow::getHarbormasterTypeFromResult($unit_result);
|
||||||
case ArcanistUnitWorkflow::RESULT_OKAY:
|
|
||||||
case ArcanistUnitWorkflow::RESULT_SKIP:
|
|
||||||
$type = 'pass';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$type = 'fail';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$futures[] = $this->getConduit()->callMethod(
|
$futures[] = $this->getConduit()->callMethod(
|
||||||
'harbormaster.sendmessage',
|
'harbormaster.sendmessage',
|
||||||
|
@ -2785,23 +2777,4 @@ EOTEXT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getModernLintDictionary(array $map) {
|
|
||||||
$map = $this->getModernCommonDictionary($map);
|
|
||||||
return $map;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function getModernUnitDictionary(array $map) {
|
|
||||||
$map = $this->getModernCommonDictionary($map);
|
|
||||||
return $map;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function getModernCommonDictionary(array $map) {
|
|
||||||
foreach ($map as $key => $value) {
|
|
||||||
if ($value === null) {
|
|
||||||
unset($map[$key]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $map;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,12 @@ EOTEXT
|
||||||
'ugly' => pht('Only one output format allowed'),
|
'ugly' => pht('Only one output format allowed'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
'target' => array(
|
||||||
|
'param' => 'phid',
|
||||||
|
'help' => pht(
|
||||||
|
'(PROTOTYPE) Record a copy of the test results on the specified '.
|
||||||
|
'Harbormaster build target.'),
|
||||||
|
),
|
||||||
'everything' => array(
|
'everything' => array(
|
||||||
'help' => pht('Run every test.'),
|
'help' => pht('Run every test.'),
|
||||||
'conflicts' => array(
|
'conflicts' => array(
|
||||||
|
@ -107,6 +113,14 @@ EOTEXT
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function requiresConduit() {
|
||||||
|
return $this->shouldUploadResults();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function requiresAuthentication() {
|
||||||
|
return $this->shouldUploadResults();
|
||||||
|
}
|
||||||
|
|
||||||
public function getEngine() {
|
public function getEngine() {
|
||||||
return $this->engine;
|
return $this->engine;
|
||||||
}
|
}
|
||||||
|
@ -263,6 +277,12 @@ EOTEXT
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$target_phid = $this->getArgument('target');
|
||||||
|
if ($target_phid) {
|
||||||
|
$this->uploadTestResults($target_phid, $overall_result, $results);
|
||||||
|
}
|
||||||
|
|
||||||
return $overall_result;
|
return $overall_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,4 +390,46 @@ EOTEXT
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getHarbormasterTypeFromResult($unit_result) {
|
||||||
|
switch ($unit_result) {
|
||||||
|
case self::RESULT_OKAY:
|
||||||
|
case self::RESULT_SKIP:
|
||||||
|
$type = 'pass';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$type = 'fail';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $type;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function shouldUploadResults() {
|
||||||
|
return ($this->getArgument('target') !== null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function uploadTestResults(
|
||||||
|
$target_phid,
|
||||||
|
$unit_result,
|
||||||
|
array $unit) {
|
||||||
|
|
||||||
|
// TODO: It would eventually be nice to stream test results up to the
|
||||||
|
// server as we go, but just get things working for now.
|
||||||
|
|
||||||
|
$message_type = self::getHarbormasterTypeFromResult($unit_result);
|
||||||
|
|
||||||
|
foreach ($unit as $key => $result) {
|
||||||
|
$dictionary = $result->toDictionary();
|
||||||
|
$unit[$key] = $this->getModernUnitDictionary($dictionary);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->getConduit()->callMethodSynchronous(
|
||||||
|
'harbormaster.sendmessage',
|
||||||
|
array(
|
||||||
|
'buildTargetPHID' => $target_phid,
|
||||||
|
'unit' => array_values($unit),
|
||||||
|
'type' => $message_type,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2040,5 +2040,24 @@ abstract class ArcanistWorkflow extends Phobject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getModernLintDictionary(array $map) {
|
||||||
|
$map = $this->getModernCommonDictionary($map);
|
||||||
|
return $map;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getModernUnitDictionary(array $map) {
|
||||||
|
$map = $this->getModernCommonDictionary($map);
|
||||||
|
return $map;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getModernCommonDictionary(array $map) {
|
||||||
|
foreach ($map as $key => $value) {
|
||||||
|
if ($value === null) {
|
||||||
|
unset($map[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $map;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue