mirror of
https://we.phorge.it/source/arcanist.git
synced 2025-01-29 07:58:19 +01:00
(stable) Promote 2016 Week 18
This commit is contained in:
commit
6d175516f5
13 changed files with 29 additions and 16 deletions
|
@ -33,8 +33,7 @@ final class ArcanistClosureLinter extends ArcanistExternalLinter {
|
||||||
return pht(
|
return pht(
|
||||||
'Install %s using `%s`.',
|
'Install %s using `%s`.',
|
||||||
'gjslint',
|
'gjslint',
|
||||||
'sudo easy_install http://closure-linter.googlecode.com/'.
|
'pip install closure-linter');
|
||||||
'files/closure_linter-latest.tar.gz');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function parseLinterOutput($path, $err, $stdout, $stderr) {
|
protected function parseLinterOutput($path, $err, $stdout, $stderr) {
|
||||||
|
|
|
@ -45,7 +45,7 @@ final class ArcanistFlake8Linter extends ArcanistExternalLinter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getInstallInstructions() {
|
public function getInstallInstructions() {
|
||||||
return pht('Install flake8 using `%s`.', 'easy_install flake8');
|
return pht('Install flake8 using `%s`.', 'pip install flake8');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function parseLinterOutput($path, $err, $stdout, $stderr) {
|
protected function parseLinterOutput($path, $err, $stdout, $stderr) {
|
||||||
|
@ -91,12 +91,13 @@ final class ArcanistFlake8Linter extends ArcanistExternalLinter {
|
||||||
} else {
|
} else {
|
||||||
// "E": PEP8 Error
|
// "E": PEP8 Error
|
||||||
// "F": PyFlakes Error
|
// "F": PyFlakes Error
|
||||||
|
// or: Flake8 Extension Message
|
||||||
return ArcanistLintSeverity::SEVERITY_ERROR;
|
return ArcanistLintSeverity::SEVERITY_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getLintCodeFromLinterConfigurationKey($code) {
|
protected function getLintCodeFromLinterConfigurationKey($code) {
|
||||||
if (!preg_match('/^(E|W|C|F)\d+$/', $code)) {
|
if (!preg_match('/^[A-Z]\d+$/', $code)) {
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
pht(
|
pht(
|
||||||
'Unrecognized lint message code "%s". Expected a valid flake8 '.
|
'Unrecognized lint message code "%s". Expected a valid flake8 '.
|
||||||
|
|
|
@ -574,8 +574,10 @@ abstract class ArcanistLinter extends Phobject {
|
||||||
case 'standard':
|
case 'standard':
|
||||||
$standards = (array)$value;
|
$standards = (array)$value;
|
||||||
|
|
||||||
foreach ($standards as $standard) {
|
foreach ($standards as $standard_name) {
|
||||||
$standard = ArcanistLinterStandard::getStandard($value, $this);
|
$standard = ArcanistLinterStandard::getStandard(
|
||||||
|
$standard_name,
|
||||||
|
$this);
|
||||||
|
|
||||||
foreach ($standard->getLinterConfiguration() as $k => $v) {
|
foreach ($standard->getLinterConfiguration() as $k => $v) {
|
||||||
$this->setLinterConfigurationValue($k, $v);
|
$this->setLinterConfigurationValue($k, $v);
|
||||||
|
|
|
@ -43,7 +43,7 @@ final class ArcanistPEP8Linter extends ArcanistExternalLinter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getInstallInstructions() {
|
public function getInstallInstructions() {
|
||||||
return pht('Install PEP8 using `%s`.', 'easy_install pep8');
|
return pht('Install PEP8 using `%s`.', 'pip install pep8');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function parseLinterOutput($path, $err, $stdout, $stderr) {
|
protected function parseLinterOutput($path, $err, $stdout, $stderr) {
|
||||||
|
|
|
@ -14,7 +14,7 @@ final class ArcanistAbstractMethodBodyXHPASTLinterRule
|
||||||
|
|
||||||
foreach ($methods as $method) {
|
foreach ($methods as $method) {
|
||||||
$modifiers = $this->getModifiers($method);
|
$modifiers = $this->getModifiers($method);
|
||||||
$body = $method->getChildByIndex(5);
|
$body = $method->getChildByIndex(6);
|
||||||
|
|
||||||
if (idx($modifiers, 'abstract') && $body->getTypeName() != 'n_EMPTY') {
|
if (idx($modifiers, 'abstract') && $body->getTypeName() != 'n_EMPTY') {
|
||||||
$this->raiseLintAtNode(
|
$this->raiseLintAtNode(
|
||||||
|
|
|
@ -16,7 +16,7 @@ final class ArcanistInterfaceMethodBodyXHPASTLinterRule
|
||||||
$methods = $interface->selectDescendantsOfType('n_METHOD_DECLARATION');
|
$methods = $interface->selectDescendantsOfType('n_METHOD_DECLARATION');
|
||||||
|
|
||||||
foreach ($methods as $method) {
|
foreach ($methods as $method) {
|
||||||
$body = $method->getChildByIndex(5);
|
$body = $method->getChildByIndex(6);
|
||||||
|
|
||||||
if ($body->getTypeName() != 'n_EMPTY') {
|
if ($body->getTypeName() != 'n_EMPTY') {
|
||||||
$this->raiseLintAtNode(
|
$this->raiseLintAtNode(
|
||||||
|
|
|
@ -46,7 +46,7 @@ final class ArcanistReusedAsIteratorXHPASTLinterRule
|
||||||
$vars[] = $var;
|
$vars[] = $var;
|
||||||
}
|
}
|
||||||
|
|
||||||
$body = $def->getChildByIndex(5);
|
$body = $def->getChildByIndex(6);
|
||||||
if ($body->getTypeName() === 'n_EMPTY') {
|
if ($body->getTypeName() === 'n_EMPTY') {
|
||||||
// Abstract method declaration.
|
// Abstract method declaration.
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -31,7 +31,7 @@ final class ArcanistReusedIteratorReferenceXHPASTLinterRule
|
||||||
));
|
));
|
||||||
|
|
||||||
foreach ($defs as $def) {
|
foreach ($defs as $def) {
|
||||||
$body = $def->getChildByIndex(5);
|
$body = $def->getChildByIndex(6);
|
||||||
if ($body->getTypeName() === 'n_EMPTY') {
|
if ($body->getTypeName() === 'n_EMPTY') {
|
||||||
// Abstract method declaration.
|
// Abstract method declaration.
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -40,7 +40,7 @@ final class ArcanistStaticThisXHPASTLinterRule
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$body = $method->getChildOfType(5, 'n_STATEMENT_LIST');
|
$body = $method->getChildOfType(6, 'n_STATEMENT_LIST');
|
||||||
$variables = $body->selectDescendantsOfType('n_VARIABLE');
|
$variables = $body->selectDescendantsOfType('n_VARIABLE');
|
||||||
|
|
||||||
foreach ($variables as $variable) {
|
foreach ($variables as $variable) {
|
||||||
|
|
|
@ -21,7 +21,7 @@ final class ArcanistToStringExceptionXHPASTLinterRule
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$statements = $method->getChildByIndex(5);
|
$statements = $method->getChildByIndex(6);
|
||||||
|
|
||||||
if ($statements->getTypeName() != 'n_STATEMENT_LIST') {
|
if ($statements->getTypeName() != 'n_STATEMENT_LIST') {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -88,7 +88,7 @@ final class ArcanistUndeclaredVariableXHPASTLinterRule
|
||||||
$vars[] = $var;
|
$vars[] = $var;
|
||||||
}
|
}
|
||||||
|
|
||||||
$body = $def->getChildByIndex(5);
|
$body = $def->getChildByIndex(6);
|
||||||
if ($body->getTypeName() === 'n_EMPTY') {
|
if ($body->getTypeName() === 'n_EMPTY') {
|
||||||
// Abstract method declaration.
|
// Abstract method declaration.
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -40,7 +40,7 @@ final class ArcanistUselessOverridingMethodXHPASTLinterRule
|
||||||
$parameters[] = $parameter->getConcreteString();
|
$parameters[] = $parameter->getConcreteString();
|
||||||
}
|
}
|
||||||
|
|
||||||
$statements = $method->getChildByIndex(5);
|
$statements = $method->getChildByIndex(6);
|
||||||
|
|
||||||
if ($statements->getTypeName() != 'n_STATEMENT_LIST') {
|
if ($statements->getTypeName() != 'n_STATEMENT_LIST') {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -8,8 +8,19 @@ abstract class ArcanistXHPASTLinterRuleTestCase
|
||||||
extends ArcanistLinterTestCase {
|
extends ArcanistLinterTestCase {
|
||||||
|
|
||||||
final protected function getLinter() {
|
final protected function getLinter() {
|
||||||
|
// Always include this rule so we get good messages if a test includes
|
||||||
|
// a syntax error. No normal test should contain syntax errors.
|
||||||
|
$syntax_rule = new ArcanistSyntaxErrorXHPASTLinterRule();
|
||||||
|
|
||||||
|
$test_rule = $this->getLinterRule();
|
||||||
|
|
||||||
|
$rules = array(
|
||||||
|
$syntax_rule,
|
||||||
|
$test_rule,
|
||||||
|
);
|
||||||
|
|
||||||
return id(new ArcanistXHPASTLinter())
|
return id(new ArcanistXHPASTLinter())
|
||||||
->setRules(array($this->getLinterRule()));
|
->setRules($rules);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue