Summary: Like D4379.
Test Plan:
$ arc unit
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4391
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.");
}
- 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);
+ $bin = csprintf("%s/%s", $prefix, $bin);
- return $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."
- );
- }
+ // 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) {
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.");
}
- 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);
+ $bin = csprintf("%s/%s", $prefix, $bin);
- return $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!");
- }
+ // 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) {
"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);
"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);