mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-10 08:52:39 +01:00
Allow disabling the part where you write an excuse
Summary: Not everyone thinks it's a great feature Task ID: # Blame Rev: Test Plan: arc diff --skip-excuses Revert Plan: Tags: Reviewers: akramer, epriestley, ide, mroch Reviewed By: epriestley CC: aran, epriestley Differential Revision: https://secure.phabricator.com/D1735
This commit is contained in:
parent
f9a7cb225e
commit
6d17dd6030
1 changed files with 50 additions and 30 deletions
|
@ -229,6 +229,11 @@ EOTEXT
|
||||||
'help' =>
|
'help' =>
|
||||||
"Skip checks for untracked files in the working copy.",
|
"Skip checks for untracked files in the working copy.",
|
||||||
),
|
),
|
||||||
|
'excuse' => array(
|
||||||
|
'param' => 'excuse',
|
||||||
|
'help' => 'Provide a prepared in advance excuse for any lints/tests'.
|
||||||
|
' shall they fail.',
|
||||||
|
),
|
||||||
'less-context' => array(
|
'less-context' => array(
|
||||||
'help' =>
|
'help' =>
|
||||||
"Normally, files are diffed with full context: the entire file is ".
|
"Normally, files are diffed with full context: the entire file is ".
|
||||||
|
@ -1022,9 +1027,11 @@ EOTEXT
|
||||||
"<bg:green>** LINT OKAY **</bg> No lint problems.\n");
|
"<bg:green>** LINT OKAY **</bg> No lint problems.\n");
|
||||||
break;
|
break;
|
||||||
case ArcanistLintWorkflow::RESULT_WARNINGS:
|
case ArcanistLintWorkflow::RESULT_WARNINGS:
|
||||||
$continue = phutil_console_confirm(
|
$msg = "Lint issued unresolved warnings. ";
|
||||||
"Lint issued unresolved warnings. ".
|
$msg .= $this->getArgument('excuse')
|
||||||
"Provide explanation and continue?");
|
? "Ignore them?"
|
||||||
|
: "Provide explanation and continue?";
|
||||||
|
$continue = phutil_console_confirm($msg);
|
||||||
if (!$continue) {
|
if (!$continue) {
|
||||||
throw new ArcanistUserAbortException();
|
throw new ArcanistUserAbortException();
|
||||||
}
|
}
|
||||||
|
@ -1032,8 +1039,11 @@ EOTEXT
|
||||||
case ArcanistLintWorkflow::RESULT_ERRORS:
|
case ArcanistLintWorkflow::RESULT_ERRORS:
|
||||||
echo phutil_console_format(
|
echo phutil_console_format(
|
||||||
"<bg:red>** LINT ERRORS **</bg> Lint raised errors!\n");
|
"<bg:red>** LINT ERRORS **</bg> Lint raised errors!\n");
|
||||||
$continue = phutil_console_confirm(
|
$msg = "Lint issued unresolved errors! ";
|
||||||
"Lint issued unresolved errors! Provide explanation and continue?");
|
$msg .= $this->getArgument('excuse')
|
||||||
|
? "Ignore lint errors?"
|
||||||
|
: "Provide explanation and continue?";
|
||||||
|
$continue = phutil_console_confirm($msg);
|
||||||
if (!$continue) {
|
if (!$continue) {
|
||||||
throw new ArcanistUserAbortException();
|
throw new ArcanistUserAbortException();
|
||||||
}
|
}
|
||||||
|
@ -1042,15 +1052,19 @@ EOTEXT
|
||||||
|
|
||||||
$this->unresolvedLint = $lint_workflow->getUnresolvedMessages();
|
$this->unresolvedLint = $lint_workflow->getUnresolvedMessages();
|
||||||
if ($continue) {
|
if ($continue) {
|
||||||
$template = "\n\n# Provide an explanation for these lint failures:\n";
|
if ($this->getArgument('excuse')) {
|
||||||
foreach ($this->unresolvedLint as $message) {
|
$this->unitExcuse = $this->getArgument('excuse');
|
||||||
$template = $template."# ".
|
} else {
|
||||||
$message->getPath().":".
|
$template = "\n\n# Provide an explanation for these lint failures:\n";
|
||||||
$message->getLine()." ".
|
foreach ($this->unresolvedLint as $message) {
|
||||||
$message->getCode()." :: ".
|
$template = $template."# ".
|
||||||
$message->getDescription()."\n";
|
$message->getPath().":".
|
||||||
|
$message->getLine()." ".
|
||||||
|
$message->getCode()." :: ".
|
||||||
|
$message->getDescription()."\n";
|
||||||
|
}
|
||||||
|
$this->lintExcuse = $this->getErrorExcuse($template);
|
||||||
}
|
}
|
||||||
$this->lintExcuse = $this->getErrorExcuse($template);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $lint_result;
|
return $lint_result;
|
||||||
|
@ -1102,9 +1116,11 @@ EOTEXT
|
||||||
case ArcanistUnitWorkflow::RESULT_FAIL:
|
case ArcanistUnitWorkflow::RESULT_FAIL:
|
||||||
echo phutil_console_format(
|
echo phutil_console_format(
|
||||||
"<bg:red>** UNIT ERRORS **</bg> Unit testing raised errors!\n");
|
"<bg:red>** UNIT ERRORS **</bg> Unit testing raised errors!\n");
|
||||||
$continue = phutil_console_confirm(
|
$msg = "Unit test results include failures! ";
|
||||||
"Unit test results include failures!".
|
$msg .= $this->getArgument('excuse')
|
||||||
" Explain test failures and continue?");
|
? "Ignore test failures?"
|
||||||
|
: "Explain test failures and continue?";
|
||||||
|
$continue = phutil_console_confirm($msg);
|
||||||
if (!$continue) {
|
if (!$continue) {
|
||||||
throw new ArcanistUserAbortException();
|
throw new ArcanistUserAbortException();
|
||||||
}
|
}
|
||||||
|
@ -1114,22 +1130,26 @@ EOTEXT
|
||||||
|
|
||||||
$this->testResults = $this->unitWorkflow->getTestResults();
|
$this->testResults = $this->unitWorkflow->getTestResults();
|
||||||
if ($explain) {
|
if ($explain) {
|
||||||
$template = "\n\n".
|
if ($this->getArgument('excuse')) {
|
||||||
"# Provide an explanation for these unit test failures:\n";
|
$this->unitExcuse = $this->getArgument('excuse');
|
||||||
foreach ($this->testResults as $test) {
|
} else {
|
||||||
$testResult = $test->getResult();
|
$template = "\n\n".
|
||||||
switch ($testResult) {
|
"# Provide an explanation for these unit test failures:\n";
|
||||||
case ArcanistUnitTestResult::RESULT_FAIL:
|
foreach ($this->testResults as $test) {
|
||||||
case ArcanistUnitTestResult::RESULT_BROKEN:
|
$testResult = $test->getResult();
|
||||||
$template = $template."# ".
|
switch ($testResult) {
|
||||||
$test->getName()." :: ".
|
case ArcanistUnitTestResult::RESULT_FAIL:
|
||||||
$test->getResult()."\n";
|
case ArcanistUnitTestResult::RESULT_BROKEN:
|
||||||
break;
|
$template = $template."# ".
|
||||||
default:
|
$test->getName()." :: ".
|
||||||
break;
|
$test->getResult()."\n";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
$this->unitExcuse = $this->getErrorExcuse($template);
|
||||||
}
|
}
|
||||||
$this->unitExcuse = $this->getErrorExcuse($template);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $unit_result;
|
return $unit_result;
|
||||||
|
|
Loading…
Reference in a new issue