1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-09-20 08:58:55 +02:00

Fix checking for lint binary paths

Summary: Like D4379.

Test Plan:
  $ arc unit

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D4391
This commit is contained in:
vrana 2013-01-10 15:22:49 -08:00
parent 767f9457c1
commit 80cd881fb1
4 changed files with 46 additions and 64 deletions

View file

@ -32,43 +32,34 @@ final class ArcanistCppcheckLinter extends ArcanistLinter {
public function getLintPath() {
$working_copy = $this->getEngine()->getWorkingCopy();
$prefix = $working_copy->getConfig('lint.cppcheck.prefix');
$bin = $working_copy->getConfig('lint.cppcheck.bin');
$bin = $working_copy->getConfig('lint.cppcheck.bin', 'cppcheck');
if ($bin === null && $prefix === null) {
$bin = 'cppcheck';
} else {
if ($bin === null) {
$bin = 'cppcheck';
}
if ($prefix !== null) {
if (!Filesystem::pathExists($prefix.'/'.$bin)) {
throw new ArcanistUsageException(
"Unable to find cppcheck binary in a specified directory. Make ".
"sure that 'lint.cppcheck.prefix' and 'lint.cppcheck.bin' keys are".
" set correctly. If you'd rather use a copy of cppcheck installed ".
"globally, you can just remove these keys from your .arcconfig");
}
$bin = csprintf("%s/%s", $prefix, $bin);
return $bin;
}
// Look for globally installed cppcheck
list($err) = exec_manual('which %s', $bin);
if ($err) {
if ($prefix !== null) {
if (!Filesystem::pathExists($prefix.'/'.$bin)) {
throw new ArcanistUsageException(
"cppcheck does not appear to be installed on this system. Install".
"it (from http://cppcheck.sourceforge.net/) or configure".
"'lint.cppcheck.prefix' in your .arcconfig to point to the".
"directory where it resides."
);
"Unable to find cppcheck binary in a specified directory. Make ".
"sure that 'lint.cppcheck.prefix' and 'lint.cppcheck.bin' keys are ".
"set correctly. If you'd rather use a copy of cppcheck installed ".
"globally, you can just remove these keys from your .arcconfig.");
}
$bin = csprintf("%s/%s", $prefix, $bin);
return $bin;
}
// Look for globally installed cppcheck
list($err) = exec_manual('which %s', $bin);
if ($err) {
throw new ArcanistUsageException(
"cppcheck does not appear to be installed on this system. Install ".
"it (from http://cppcheck.sourceforge.net/) or configure ".
"'lint.cppcheck.prefix' in your .arcconfig to point to the ".
"directory where it resides."
);
}
return $bin;
}
public function lintPath($path) {

View file

@ -27,43 +27,34 @@ final class ArcanistCpplintLinter extends ArcanistLinter {
public function getLintPath() {
$working_copy = $this->getEngine()->getWorkingCopy();
$prefix = $working_copy->getConfig('lint.cpplint.prefix');
$bin = $working_copy->getConfig('lint.cpplint.bin');
$bin = $working_copy->getConfig('lint.cpplint.bin', 'cpplint.py');
if ($bin === null && $prefix === null) {
$bin = 'cpplint.py';
} else {
if ($bin === null) {
$bin = 'cpplint.py';
}
if ($prefix !== null) {
if (!Filesystem::pathExists($prefix.'/'.$bin)) {
throw new ArcanistUsageException(
"Unable to find cpplint.py binary in a specified directory. Make ".
"sure that 'lint.cpplint.prefix' and 'lint.cpplint.bin' keys are ".
"set correctly. If you'd rather use a copy of cpplint installed ".
"globally, you can just remove these keys from your .arcconfig");
}
$bin = csprintf("%s/%s", $prefix, $bin);
return $bin;
}
// Look for globally installed cpplint.py
list($err) = exec_manual('which %s', $bin);
if ($err) {
if ($prefix !== null) {
if (!Filesystem::pathExists($prefix.'/'.$bin)) {
throw new ArcanistUsageException(
"cpplint.py does not appear to be installed on this system. Install".
"it (e.g., with 'wget \"http://google-styleguide.googlecode.com/".
"svn/trunk/cpplint/cpplint.py\"') or configure 'lint.cpplint.prefix'".
"in your .arcconfig to point to the directory where it resides. ".
"Also don't forget to chmod a+x cpplint.py!");
"Unable to find cpplint.py binary in a specified directory. Make ".
"sure that 'lint.cpplint.prefix' and 'lint.cpplint.bin' keys are ".
"set correctly. If you'd rather use a copy of cpplint installed ".
"globally, you can just remove these keys from your .arcconfig.");
}
$bin = csprintf("%s/%s", $prefix, $bin);
return $bin;
}
// Look for globally installed cpplint.py
list($err) = exec_manual('which %s', $bin);
if ($err) {
throw new ArcanistUsageException(
"cpplint.py does not appear to be installed on this system. Install ".
"it (e.g., with 'wget \"http://google-styleguide.googlecode.com/".
"svn/trunk/cpplint/cpplint.py\"') or configure 'lint.cpplint.prefix' ".
"in your .arcconfig to point to the directory where it resides. ".
"Also don't forget to chmod a+x cpplint.py!");
}
return $bin;
}
public function lintPath($path) {

View file

@ -35,7 +35,7 @@ final class ArcanistFlake8Linter extends ArcanistLinter {
"Unable to find flake8 binary in a specified directory. Make sure ".
"that 'lint.flake8.prefix' and 'lint.flake8.bin' keys are set ".
"correctly. If you'd rather use a copy of flake8 installed ".
"globally, you can just remove these keys from your .arcconfig");
"globally, you can just remove these keys from your .arcconfig.");
}
$bin = csprintf("%s/%s", $prefix, $bin);

View file

@ -59,7 +59,7 @@ final class ArcanistPEP8Linter extends ArcanistLinter {
"Unable to find PEP8 binary in a specified directory. Make sure ".
"that 'lint.pep8.prefix' and 'lint.pep8.bin' keys are set ".
"correctly. If you'd rather use a copy of PEP8 installed ".
"globally, you can just remove these keys from your .arcconfig");
"globally, you can just remove these keys from your .arcconfig.");
}
$bin = csprintf("%s/%s", $prefix, $bin);