mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-25 16:22:42 +01:00
Ask for explanation for skipping lint and unit
Summary: Fixes T2023. Test Plan: $ arc diff --nounit # Abort $ arc diff --nounit $ arc diff --nounit --excuse 'Move fast and break things.' Reviewers: epriestley, btrahan Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2023 Differential Revision: https://secure.phabricator.com/D3872
This commit is contained in:
parent
317cf6fc36
commit
d4a97d87c8
1 changed files with 34 additions and 9 deletions
|
@ -435,6 +435,18 @@ EOTEXT
|
||||||
$unit_result = $data['unitResult'];
|
$unit_result = $data['unitResult'];
|
||||||
$this->testResults = $data['testResults'];
|
$this->testResults = $data['testResults'];
|
||||||
|
|
||||||
|
if ($this->getArgument('nolint')) {
|
||||||
|
$this->excuses['lint'] = $this->getSkipExcuse(
|
||||||
|
'Provide explanation for skipping lint or press Enter to abort:',
|
||||||
|
'lint-excuses');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->getArgument('nounit')) {
|
||||||
|
$this->excuses['unit'] = $this->getSkipExcuse(
|
||||||
|
'Provide explanation for skipping unit tests or press Enter to abort:',
|
||||||
|
'unit-excuses');
|
||||||
|
}
|
||||||
|
|
||||||
$changes = $this->generateChanges();
|
$changes = $this->generateChanges();
|
||||||
if (!$changes) {
|
if (!$changes) {
|
||||||
throw new ArcanistUsageException(
|
throw new ArcanistUsageException(
|
||||||
|
@ -1370,6 +1382,20 @@ EOTEXT
|
||||||
return $this->testResults;
|
return $this->testResults;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getSkipExcuse($prompt, $history) {
|
||||||
|
$excuse = $this->getArgument('excuse');
|
||||||
|
|
||||||
|
if ($excuse === null) {
|
||||||
|
$history = $this->getRepositoryAPI()->getScratchFilePath($history);
|
||||||
|
$excuse = phutil_console_prompt($prompt, $history);
|
||||||
|
if ($excuse == '') {
|
||||||
|
throw new ArcanistUserAbortException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $excuse;
|
||||||
|
}
|
||||||
|
|
||||||
private function getErrorExcuse($type, $prompt, $history) {
|
private function getErrorExcuse($type, $prompt, $history) {
|
||||||
if ($this->getArgument('excuse')) {
|
if ($this->getArgument('excuse')) {
|
||||||
$this->console->sendMessage(array(
|
$this->console->sendMessage(array(
|
||||||
|
@ -2271,13 +2297,13 @@ EOTEXT
|
||||||
* @task diffprop
|
* @task diffprop
|
||||||
*/
|
*/
|
||||||
private function updateLintDiffProperty() {
|
private function updateLintDiffProperty() {
|
||||||
|
if (strlen($this->excuses['lint'])) {
|
||||||
|
$this->updateDiffProperty('arc:lint-excuse',
|
||||||
|
json_encode($this->excuses['lint']));
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->unresolvedLint) {
|
if ($this->unresolvedLint) {
|
||||||
$this->updateDiffProperty('arc:lint', json_encode($this->unresolvedLint));
|
$this->updateDiffProperty('arc:lint', json_encode($this->unresolvedLint));
|
||||||
if (strlen($this->excuses['lint'])) {
|
|
||||||
$this->updateDiffProperty('arc:lint-excuse',
|
|
||||||
json_encode($this->excuses['lint']));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$postponed = $this->postponedLinters;
|
$postponed = $this->postponedLinters;
|
||||||
|
@ -2296,15 +2322,14 @@ EOTEXT
|
||||||
* @task diffprop
|
* @task diffprop
|
||||||
*/
|
*/
|
||||||
private function updateUnitDiffProperty() {
|
private function updateUnitDiffProperty() {
|
||||||
if (!$this->testResults) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->updateDiffProperty('arc:unit', json_encode($this->testResults));
|
|
||||||
if (strlen($this->excuses['unit'])) {
|
if (strlen($this->excuses['unit'])) {
|
||||||
$this->updateDiffProperty('arc:unit-excuse',
|
$this->updateDiffProperty('arc:unit-excuse',
|
||||||
json_encode($this->excuses['unit']));
|
json_encode($this->excuses['unit']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->testResults) {
|
||||||
|
$this->updateDiffProperty('arc:unit', json_encode($this->testResults));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue