mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-22 14:52:40 +01:00
Simplified the logic in various functions.
Summary: - Tidied up `ArcanistCSSLintLinter::getDefaultBinary`. - Tidied up `CSSLintLinter::getDefaultFlags` function. - Tidied up `ArcanistPhpcsLinter::getDefaultBinary` function. - Tidied up `ArcanistPEP8Linter::getDefaultFlags` function - Tidied up `ArcanistFlake8Linter::getDefaultFlags`. - Tidied up `ArcanistCppcheckLinter::getLintOptions`. - Tidied up `ArcanistCppcheckLinter::getLintPath`. - Tidied up `ArcanistCpplintLinter::getLintOptions`. - Tidied up `ArcanistCpplintLinter::getLintPath`. - Removed child functions which are identical to the corresponding parent functions. Test Plan: `arc lint` and `arc unit`. Reviewers: #blessed_reviewers, epriestley Reviewed By: epriestley CC: chad, Korvin, epriestley, aran Differential Revision: https://secure.phabricator.com/D8385
This commit is contained in:
parent
9fb2a147f9
commit
9bca4bfda8
10 changed files with 12 additions and 87 deletions
|
@ -23,23 +23,15 @@ final class ArcanistCSSLintLinter extends ArcanistExternalLinter {
|
|||
}
|
||||
|
||||
public function getDefaultFlags() {
|
||||
$config = $this->getEngine()->getConfigurationManager();
|
||||
|
||||
$options = $config->getConfigFromAnySource('lint.csslint.options');
|
||||
// TODO: Deprecation warning.
|
||||
|
||||
return $options;
|
||||
$config = $this->getEngine()->getConfigurationManager();
|
||||
return $config->getConfigFromAnySource('lint.csslint.options');
|
||||
}
|
||||
|
||||
public function getDefaultBinary() {
|
||||
// TODO: Deprecation warning.
|
||||
$config = $this->getEngine()->getConfigurationManager();
|
||||
$bin = $config->getConfigFromAnySource('lint.csslint.bin');
|
||||
if ($bin) {
|
||||
return $bin;
|
||||
}
|
||||
|
||||
return 'csslint';
|
||||
return $config->getConfigFromAnySource('lint.csslint.bin', 'csslint');
|
||||
}
|
||||
|
||||
public function getInstallInstructions() {
|
||||
|
|
|
@ -64,14 +64,6 @@ final class ArcanistCSharpLinter extends ArcanistLinter {
|
|||
return parent::setCustomSeverityMap($map);
|
||||
}
|
||||
|
||||
public function getLintSeverityMap() {
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getLintNameMap() {
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines what executables and lint paths to use. Between platforms
|
||||
* this also changes whether the lint engine is run under .NET or Mono. It
|
||||
|
|
|
@ -10,10 +10,6 @@
|
|||
*/
|
||||
final class ArcanistCppcheckLinter extends ArcanistLinter {
|
||||
|
||||
public function willLintPaths(array $paths) {
|
||||
return;
|
||||
}
|
||||
|
||||
public function getLinterName() {
|
||||
return 'cppcheck';
|
||||
}
|
||||
|
@ -21,11 +17,9 @@ final class ArcanistCppcheckLinter extends ArcanistLinter {
|
|||
public function getLintOptions() {
|
||||
$config = $this->getEngine()->getConfigurationManager();
|
||||
// You will for sure want some options. The below default tends to be ok
|
||||
$options = $config->getConfigFromAnySource(
|
||||
return $config->getConfigFromAnySource(
|
||||
'lint.cppcheck.options',
|
||||
'-j2 --inconclusive --enable=performance,style,portability,information');
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
public function getLintPath() {
|
||||
|
@ -42,9 +36,7 @@ final class ArcanistCppcheckLinter extends ArcanistLinter {
|
|||
"globally, you can just remove these keys from your .arcconfig.");
|
||||
}
|
||||
|
||||
$bin = csprintf("%s/%s", $prefix, $bin);
|
||||
|
||||
return $bin;
|
||||
return csprintf("%s/%s", $prefix, $bin);
|
||||
}
|
||||
|
||||
// Look for globally installed cppcheck
|
||||
|
|
|
@ -9,19 +9,13 @@
|
|||
*/
|
||||
final class ArcanistCpplintLinter extends ArcanistLinter {
|
||||
|
||||
public function willLintPaths(array $paths) {
|
||||
return;
|
||||
}
|
||||
|
||||
public function getLinterName() {
|
||||
return 'cpplint.py';
|
||||
}
|
||||
|
||||
public function getLintOptions() {
|
||||
$config = $this->getEngine()->getConfigurationManager();
|
||||
$options = $config->getConfigFromAnySource('lint.cpplint.options', '');
|
||||
|
||||
return $options;
|
||||
return $config->getConfigFromAnySource('lint.cpplint.options', '');
|
||||
}
|
||||
|
||||
public function getLintPath() {
|
||||
|
@ -38,9 +32,7 @@ final class ArcanistCpplintLinter extends ArcanistLinter {
|
|||
"globally, you can just remove these keys from your .arcconfig.");
|
||||
}
|
||||
|
||||
$bin = csprintf("%s/%s", $prefix, $bin);
|
||||
|
||||
return $bin;
|
||||
return csprintf("%s/%s", $prefix, $bin);
|
||||
}
|
||||
|
||||
// Look for globally installed cpplint.py
|
||||
|
|
|
@ -18,12 +18,8 @@ final class ArcanistFlake8Linter extends ArcanistExternalLinter {
|
|||
|
||||
public function getDefaultFlags() {
|
||||
// TODO: Deprecated.
|
||||
|
||||
$config = $this->getEngine()->getConfigurationManager();
|
||||
|
||||
$options = $config->getConfigFromAnySource('lint.flake8.options', '');
|
||||
|
||||
return $options;
|
||||
return $config->getConfigFromAnySource('lint.flake8.options', '');
|
||||
}
|
||||
|
||||
public function getDefaultBinary() {
|
||||
|
|
|
@ -22,15 +22,10 @@ final class ArcanistPEP8Linter extends ArcanistExternalLinter {
|
|||
|
||||
public function getDefaultFlags() {
|
||||
// TODO: Warn that all of this is deprecated.
|
||||
|
||||
$config = $this->getEngine()->getConfigurationManager();
|
||||
$options = $config->getConfigFromAnySource('lint.pep8.options');
|
||||
|
||||
if ($options === null) {
|
||||
$options = $this->getConfig('options');
|
||||
}
|
||||
|
||||
return $options;
|
||||
return $config->getConfigFromAnySource(
|
||||
'lint.pep8.options',
|
||||
$this->getConfig('options'));
|
||||
}
|
||||
|
||||
public function shouldUseInterpreter() {
|
||||
|
|
|
@ -49,12 +49,7 @@ final class ArcanistPhpcsLinter extends ArcanistExternalLinter {
|
|||
public function getDefaultBinary() {
|
||||
// TODO: Deprecation warnings.
|
||||
$config = $this->getEngine()->getConfigurationManager();
|
||||
$bin = $config->getConfigFromAnySource('lint.phpcs.bin');
|
||||
if ($bin) {
|
||||
return $bin;
|
||||
}
|
||||
|
||||
return 'phpcs';
|
||||
return $config->getConfigFromAnySource('lint.phpcs.bin', 'phpcs');
|
||||
}
|
||||
|
||||
public function shouldExpectCommandErrors() {
|
||||
|
|
|
@ -28,10 +28,6 @@ final class ArcanistPhutilLibraryLinter extends ArcanistLinter {
|
|||
return 'PHL';
|
||||
}
|
||||
|
||||
public function getLintSeverityMap() {
|
||||
return array();
|
||||
}
|
||||
|
||||
public function willLintPaths(array $paths) {
|
||||
if (!xhpast_is_available()) {
|
||||
throw new Exception(xhpast_get_build_instructions());
|
||||
|
|
|
@ -7,23 +7,10 @@
|
|||
*/
|
||||
final class ArcanistPyFlakesLinter extends ArcanistLinter {
|
||||
|
||||
public function willLintPaths(array $paths) {
|
||||
return;
|
||||
}
|
||||
|
||||
public function getLinterName() {
|
||||
return 'PyFlakes';
|
||||
}
|
||||
|
||||
public function getLintSeverityMap() {
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getLintNameMap() {
|
||||
return array(
|
||||
);
|
||||
}
|
||||
|
||||
public function getPyFlakesOptions() {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -187,22 +187,10 @@ final class ArcanistPyLintLinter extends ArcanistLinter {
|
|||
return implode(" ", $options);
|
||||
}
|
||||
|
||||
public function willLintPaths(array $paths) {
|
||||
return;
|
||||
}
|
||||
|
||||
public function getLinterName() {
|
||||
return 'PyLint';
|
||||
}
|
||||
|
||||
public function getLintSeverityMap() {
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getLintNameMap() {
|
||||
return array();
|
||||
}
|
||||
|
||||
public function lintPath($path) {
|
||||
$pylint_bin = $this->getPyLintPath();
|
||||
$python_path = $this->getPyLintPythonPath();
|
||||
|
|
Loading…
Reference in a new issue