Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/ArcanistPEP8Linter.php
Show All 34 Lines | public function shouldUseInterpreter() { | ||||
return ($this->getDefaultBinary() !== 'pep8'); | return ($this->getDefaultBinary() !== 'pep8'); | ||||
} | } | ||||
public function getDefaultInterpreter() { | public function getDefaultInterpreter() { | ||||
return 'python2.6'; | return 'python2.6'; | ||||
} | } | ||||
public function getDefaultBinary() { | public function getDefaultBinary() { | ||||
if (Filesystem::binaryExists('pep8')) { | $prefix = $this->getDeprecatedConfiguration('lint.pep8.prefix'); | ||||
return 'pep8'; | $bin = $this->getDeprecatedConfiguration('lint.pep8.bin', 'pep8'); | ||||
talshiri: Feels like this should not be deleted. Instead, binaryExists() should potentially be used to… | |||||
Not Done Inline ActionsThis should already happen in ArcanistExternalLinter. joshuaspence: This should already happen in `ArcanistExternalLinter`. | |||||
Done Inline Actionsjshint is the default? talshiri: jshint is the default? | |||||
} | |||||
$old_prefix = $this->getDeprecatedConfiguration('lint.pep8.prefix'); | if ($prefix) { | ||||
$old_bin = $this->getDeprecatedConfiguration('lint.pep8.bin'); | return $prefix.'/'.$bin; | ||||
if ($old_prefix || $old_bin) { | } else { | ||||
$old_bin = nonempty($old_bin, 'pep8'); | return $bin; | ||||
return $old_prefix.'/'.$old_bin; | |||||
} | } | ||||
$arc_root = dirname(phutil_get_library_root('arcanist')); | |||||
return $arc_root.'/externals/pep8/pep8.py'; | |||||
} | } | ||||
public function getVersion() { | public function getVersion() { | ||||
list($stdout) = execx('%C --version', $this->getExecutableCommand()); | list($stdout) = execx('%C --version', $this->getExecutableCommand()); | ||||
$matches = array(); | $matches = array(); | ||||
if (preg_match('/^(?P<version>\d+\.\d+(?:\.\d+)?)\b/', $stdout, $matches)) { | if (preg_match('/^(?P<version>\d+\.\d+(?:\.\d+)?)\b/', $stdout, $matches)) { | ||||
return $matches['version']; | return $matches['version']; | ||||
▲ Show 20 Lines • Show All 63 Lines • Show Last 20 Lines |
Feels like this should not be deleted. Instead, binaryExists() should potentially be used to figure out if pep8 is even installed, and if not raise an exception.
This would be more like how ArcanistCSharpLinter works