Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/ArcanistPyLintLinter.php
| Show First 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | $error_regexp = $config->getConfigFromAnySource( | ||||
| 'lint.pylint.codes.error'); | 'lint.pylint.codes.error'); | ||||
| $warning_regexp = $config->getConfigFromAnySource( | $warning_regexp = $config->getConfigFromAnySource( | ||||
| 'lint.pylint.codes.warning'); | 'lint.pylint.codes.warning'); | ||||
| $advice_regexp = $config->getConfigFromAnySource( | $advice_regexp = $config->getConfigFromAnySource( | ||||
| 'lint.pylint.codes.advice'); | 'lint.pylint.codes.advice'); | ||||
| if (!$error_regexp && !$warning_regexp && !$advice_regexp) { | if (!$error_regexp && !$warning_regexp && !$advice_regexp) { | ||||
| throw new ArcanistUsageException( | throw new ArcanistUsageException( | ||||
| pht( | |||||
| "You are invoking the PyLint linter but have not configured any of ". | "You are invoking the PyLint linter but have not configured any of ". | ||||
| "'lint.pylint.codes.error', 'lint.pylint.codes.warning', or ". | "'%s', '%s', or '%s'. Consult the documentation for %s.", | ||||
| "'lint.pylint.codes.advice'. Consult the documentation for ". | 'lint.pylint.codes.error', | ||||
| "ArcanistPyLintLinter."); | 'lint.pylint.codes.warning', | ||||
| 'lint.pylint.codes.advice', | |||||
| __CLASS__)); | |||||
| } | } | ||||
| $code_map = array( | $code_map = array( | ||||
| ArcanistLintSeverity::SEVERITY_ERROR => $error_regexp, | ArcanistLintSeverity::SEVERITY_ERROR => $error_regexp, | ||||
| ArcanistLintSeverity::SEVERITY_WARNING => $warning_regexp, | ArcanistLintSeverity::SEVERITY_WARNING => $warning_regexp, | ||||
| ArcanistLintSeverity::SEVERITY_ADVICE => $advice_regexp, | ArcanistLintSeverity::SEVERITY_ADVICE => $advice_regexp, | ||||
| ); | ); | ||||
| Show All 26 Lines | if ($prefix !== null) { | ||||
| $pylint_bin = $prefix.'/bin/'.$pylint_bin; | $pylint_bin = $prefix.'/bin/'.$pylint_bin; | ||||
| } | } | ||||
| if (!Filesystem::pathExists($pylint_bin)) { | if (!Filesystem::pathExists($pylint_bin)) { | ||||
| list($err) = exec_manual('which %s', $pylint_bin); | list($err) = exec_manual('which %s', $pylint_bin); | ||||
| if ($err) { | if ($err) { | ||||
| throw new ArcanistMissingLinterException( | throw new ArcanistMissingLinterException( | ||||
| "PyLint does not appear to be installed on this system. Install it ". | pht( | ||||
| "(e.g., with 'sudo easy_install pylint') or configure ". | "PyLint does not appear to be installed on this system. Install ". | ||||
| "'lint.pylint.prefix' in your .arcconfig to point to the directory ". | "it (e.g., with '%s') or configure '%s' in your %s to point to ". | ||||
| "where it resides."); | "the directory where it resides.", | ||||
| 'sudo easy_install pylint', | |||||
| 'lint.pylint.prefix', | |||||
| '.arcconfig')); | |||||
| } | } | ||||
| } | } | ||||
| return $pylint_bin; | return $pylint_bin; | ||||
| } | } | ||||
| private function getPyLintPythonPath() { | private function getPyLintPythonPath() { | ||||
| // Get non-default install locations for pylint and its dependencies | // Get non-default install locations for pylint and its dependencies | ||||
| ▲ Show 20 Lines • Show All 143 Lines • Show Last 20 Lines | |||||