Changeset View
Changeset View
Standalone View
Standalone View
arcanist/configuration/BitcoinABCConfiguration.php
- This file was added.
<?php | |||||
class BitcoinABCConfiguration extends ArcanistConfiguration { | |||||
private function runLint($workflow, $options = array()) { | |||||
$buildWorkflow = $workflow->buildChildWorkflow('lint', $options); | |||||
try { | |||||
$err = $buildWorkflow ->run(); | |||||
} catch (ArcanistNoEffectException $e) { | |||||
// If there is nothing to lint, return no error | |||||
return ArcanistLintWorkflow::RESULT_OKAY; | |||||
} | |||||
return $err; | |||||
} | |||||
public function willRunWorkflow($command, ArcanistWorkflow $workflow) { | |||||
if ($command === 'diff' && !$workflow->getArgument('nolint')) { | |||||
$err = $this->runLint($workflow); | |||||
if ($err != ArcanistLintWorkflow::RESULT_OKAY) { | |||||
$workflow->finalize(); | |||||
exit($err); | |||||
} | |||||
/* | |||||
* Set the configuration but don't run the linter, the diff workflow will | |||||
* do it for us. | |||||
*/ | |||||
$config = $workflow->getConfigurationManager(); | |||||
$config->setRuntimeConfig('lint.engine', 'RunLastLintEngine'); | |||||
} | |||||
} | |||||
public function didRunWorkflow($command, ArcanistWorkflow $workflow, $err) { | |||||
if ($command === 'lint') { | |||||
$config = $workflow->getConfigurationManager(); | |||||
$config->setRuntimeConfig('lint.engine', 'RunLastLintEngine'); | |||||
$this->runLint($workflow); | |||||
} | |||||
} | |||||
} |