mirror of
https://we.phorge.it/source/arcanist.git
synced 2025-01-15 17:21:09 +01:00
(stable) Promote 2019 Week 20
This commit is contained in:
commit
26452002a2
13 changed files with 45 additions and 8 deletions
|
@ -410,7 +410,7 @@ abstract class ArcanistExternalLinter extends ArcanistFutureLinter {
|
||||||
return csprintf('%s', $path);
|
return csprintf('%s', $path);
|
||||||
}
|
}
|
||||||
|
|
||||||
final protected function buildFutures(array $paths) {
|
protected function buildFutures(array $paths) {
|
||||||
$executable = $this->getExecutableCommand();
|
$executable = $this->getExecutableCommand();
|
||||||
|
|
||||||
$bin = csprintf('%C %Ls', $executable, $this->getCommandFlags());
|
$bin = csprintf('%C %Ls', $executable, $this->getCommandFlags());
|
||||||
|
@ -428,7 +428,7 @@ abstract class ArcanistExternalLinter extends ArcanistFutureLinter {
|
||||||
return $futures;
|
return $futures;
|
||||||
}
|
}
|
||||||
|
|
||||||
final protected function resolveFuture($path, Future $future) {
|
protected function resolveFuture($path, Future $future) {
|
||||||
list($err, $stdout, $stderr) = $future->resolve();
|
list($err, $stdout, $stderr) = $future->resolve();
|
||||||
if ($err && !$this->shouldExpectCommandErrors()) {
|
if ($err && !$this->shouldExpectCommandErrors()) {
|
||||||
$future->resolvex();
|
$future->resolvex();
|
||||||
|
|
|
@ -214,9 +214,6 @@ abstract class ArcanistLinter extends Phobject {
|
||||||
return 1.0;
|
return 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO: This should be `final`.
|
|
||||||
*/
|
|
||||||
public function setCustomSeverityMap(array $map) {
|
public function setCustomSeverityMap(array $map) {
|
||||||
$this->customSeverityMap = $map;
|
$this->customSeverityMap = $map;
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -227,7 +224,7 @@ abstract class ArcanistLinter extends Phobject {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
final public function setCustomSeverityRules(array $rules) {
|
public function setCustomSeverityRules(array $rules) {
|
||||||
$this->customSeverityRules = $rules;
|
$this->customSeverityRules = $rules;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ final class ArcanistPyLintLinter extends ArcanistExternalLinter {
|
||||||
list($stdout) = execx('%C --version', $this->getExecutableCommand());
|
list($stdout) = execx('%C --version', $this->getExecutableCommand());
|
||||||
|
|
||||||
$matches = array();
|
$matches = array();
|
||||||
$regex = '/^pylint (?P<version>\d+\.\d+\.\d+),/';
|
$regex = '/^pylint (?P<version>\d+\.\d+\.\d+)/';
|
||||||
if (preg_match($regex, $stdout, $matches)) {
|
if (preg_match($regex, $stdout, $matches)) {
|
||||||
return $matches['version'];
|
return $matches['version'];
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -114,6 +114,7 @@ abstract class ArcanistLinterTestCase extends PhutilTestCase {
|
||||||
$path_name = idx($config, 'path', $path);
|
$path_name = idx($config, 'path', $path);
|
||||||
$engine->setPaths(array($path_name));
|
$engine->setPaths(array($path_name));
|
||||||
|
|
||||||
|
$linter->setEngine($engine);
|
||||||
$linter->addPath($path_name);
|
$linter->addPath($path_name);
|
||||||
$linter->addData($path_name, $data);
|
$linter->addData($path_name, $data);
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,9 @@ final class ArcanistClassNameLiteralXHPASTLinterRule
|
||||||
$class_declarations = $root->selectDescendantsOfType('n_CLASS_DECLARATION');
|
$class_declarations = $root->selectDescendantsOfType('n_CLASS_DECLARATION');
|
||||||
|
|
||||||
foreach ($class_declarations as $class_declaration) {
|
foreach ($class_declarations as $class_declaration) {
|
||||||
|
if ($class_declaration->getChildByIndex(1)->getTypeName() == 'n_EMPTY') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$class_name = $class_declaration
|
$class_name = $class_declaration
|
||||||
->getChildOfType(1, 'n_CLASS_NAME')
|
->getChildOfType(1, 'n_CLASS_NAME')
|
||||||
->getConcreteString();
|
->getConcreteString();
|
||||||
|
|
|
@ -20,7 +20,9 @@ final class ArcanistConstructorParenthesesXHPASTLinterRule
|
||||||
$class = $node->getChildByIndex(0);
|
$class = $node->getChildByIndex(0);
|
||||||
$params = $node->getChildByIndex(1);
|
$params = $node->getChildByIndex(1);
|
||||||
|
|
||||||
if ($params->getTypeName() == 'n_EMPTY') {
|
if ($class->getTypeName() != 'n_CLASS_DECLARATION' &&
|
||||||
|
$params->getTypeName() == 'n_EMPTY') {
|
||||||
|
|
||||||
$this->raiseLintAtNode(
|
$this->raiseLintAtNode(
|
||||||
$class,
|
$class,
|
||||||
pht('Use parentheses when invoking a constructor.'),
|
pht('Use parentheses when invoking a constructor.'),
|
||||||
|
|
|
@ -17,6 +17,9 @@ final class ArcanistSelfClassReferenceXHPASTLinterRule
|
||||||
$class_declarations = $root->selectDescendantsOfType('n_CLASS_DECLARATION');
|
$class_declarations = $root->selectDescendantsOfType('n_CLASS_DECLARATION');
|
||||||
|
|
||||||
foreach ($class_declarations as $class_declaration) {
|
foreach ($class_declarations as $class_declaration) {
|
||||||
|
if ($class_declaration->getChildByIndex(1)->getTypeName() == 'n_EMPTY') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$class_name = $class_declaration
|
$class_name = $class_declaration
|
||||||
->getChildOfType(1, 'n_CLASS_NAME')
|
->getChildOfType(1, 'n_CLASS_NAME')
|
||||||
->getConcreteString();
|
->getConcreteString();
|
||||||
|
|
|
@ -17,6 +17,9 @@ final class ArcanistUnnecessaryFinalModifierXHPASTLinterRule
|
||||||
$classes = $root->selectDescendantsOfType('n_CLASS_DECLARATION');
|
$classes = $root->selectDescendantsOfType('n_CLASS_DECLARATION');
|
||||||
|
|
||||||
foreach ($classes as $class) {
|
foreach ($classes as $class) {
|
||||||
|
if ($class->getChildByIndex(0)->getTypeName() == 'n_EMPTY') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$attributes = $class->getChildOfType(0, 'n_CLASS_ATTRIBUTES');
|
$attributes = $class->getChildOfType(0, 'n_CLASS_ATTRIBUTES');
|
||||||
$is_final = false;
|
$is_final = false;
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,12 @@ class MyClass {
|
||||||
return __CLASS__;
|
return __CLASS__;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$c = new class {
|
||||||
|
public function someMethod() {
|
||||||
|
return __CLASS__;
|
||||||
|
}
|
||||||
|
};
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
advice:5:12
|
advice:5:12
|
||||||
advice:9:10
|
advice:9:10
|
||||||
|
@ -28,3 +34,9 @@ class MyClass {
|
||||||
return __CLASS__;
|
return __CLASS__;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$c = new class {
|
||||||
|
public function someMethod() {
|
||||||
|
return __CLASS__;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
new Foo;
|
new Foo;
|
||||||
new Bar();
|
new Bar();
|
||||||
new Foo\Bar;
|
new Foo\Bar;
|
||||||
|
new class {};
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
advice:3:5
|
advice:3:5
|
||||||
advice:5:5
|
advice:5:5
|
||||||
|
@ -12,3 +13,4 @@ advice:5:5
|
||||||
new Foo();
|
new Foo();
|
||||||
new Bar();
|
new Bar();
|
||||||
new Foo\Bar();
|
new Foo\Bar();
|
||||||
|
new class {};
|
||||||
|
|
|
@ -9,6 +9,12 @@ class Foo extends Bar {
|
||||||
return new self();
|
return new self();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$c = new class {
|
||||||
|
public function newInstance() {
|
||||||
|
return new self();
|
||||||
|
}
|
||||||
|
};
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:5:16
|
warning:5:16
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
|
@ -23,3 +29,9 @@ class Foo extends Bar {
|
||||||
return new self();
|
return new self();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$c = new class {
|
||||||
|
public function newInstance() {
|
||||||
|
return new self();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
|
@ -4,5 +4,6 @@ final class Foo {
|
||||||
public function bar() {}
|
public function bar() {}
|
||||||
final public function baz() {}
|
final public function baz() {}
|
||||||
}
|
}
|
||||||
|
$c = new class {};
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
advice:5:3
|
advice:5:3
|
||||||
|
|
|
@ -1376,6 +1376,7 @@ EOTEXT
|
||||||
// if this one doesn't work out.
|
// if this one doesn't work out.
|
||||||
try {
|
try {
|
||||||
$this->checkForBuildablesWithPlanBehaviors($diff_phid);
|
$this->checkForBuildablesWithPlanBehaviors($diff_phid);
|
||||||
|
return;
|
||||||
} catch (ArcanistUserAbortException $abort_ex) {
|
} catch (ArcanistUserAbortException $abort_ex) {
|
||||||
throw $abort_ex;
|
throw $abort_ex;
|
||||||
} catch (Exception $ex) {
|
} catch (Exception $ex) {
|
||||||
|
|
Loading…
Reference in a new issue