diff --git a/src/lint/linter/ArcanistFlake8Linter.php b/src/lint/linter/ArcanistFlake8Linter.php --- a/src/lint/linter/ArcanistFlake8Linter.php +++ b/src/lint/linter/ArcanistFlake8Linter.php @@ -6,6 +6,8 @@ */ final class ArcanistFlake8Linter extends ArcanistExternalLinter { + private $flake8rc; + public function getInfoName() { return 'Flake8'; } @@ -28,6 +30,17 @@ return 'flake8'; } + public function getLinterConfigurationOptions() { + $options = array( + 'flake8.flake8rc' => array( + 'type' => 'optional string', + 'help' => pht('Eg. ~/config/flake8') + ) + ); + + return $options + parent::getLinterConfigurationOptions(); + } + public function getDefaultFlags() { return $this->getDeprecatedConfiguration('lint.flake8.options', array()); } @@ -43,6 +56,16 @@ } } + protected function getMandatoryFlags() { + $options = array(); + + if ($this->flake8rc) { + $options[] = '--config='.$this->flake8rc; + } + + return $options; + } + public function getVersion() { list($stdout) = execx('%C --version', $this->getExecutableCommand()); @@ -54,6 +77,16 @@ } } + public function setLinterConfigurationValue($key, $value) { + switch ($key) { + case 'flake8.flake8rc': + $this->flake8rc = $value; + return; + } + + return parent::setLinterConfigurationValue($key, $value); + } + public function getInstallInstructions() { return pht('Install flake8 using `easy_install flake8`.'); }