diff --git a/src/lint/linter/ArcanistBaseXHPASTLinter.php b/src/lint/linter/ArcanistBaseXHPASTLinter.php --- a/src/lint/linter/ArcanistBaseXHPASTLinter.php +++ b/src/lint/linter/ArcanistBaseXHPASTLinter.php @@ -5,7 +5,7 @@ */ abstract class ArcanistBaseXHPASTLinter extends ArcanistFutureLinter { - protected final function raiseLintAtToken( + final protected function raiseLintAtToken( XHPASTToken $token, $code, $desc, @@ -18,7 +18,7 @@ $replace); } - protected final function raiseLintAtNode( + final protected function raiseLintAtNode( XHPASTNode $node, $code, $desc, diff --git a/src/lint/linter/ArcanistExternalLinter.php b/src/lint/linter/ArcanistExternalLinter.php --- a/src/lint/linter/ArcanistExternalLinter.php +++ b/src/lint/linter/ArcanistExternalLinter.php @@ -324,7 +324,7 @@ * @return string Command to execute the raw linter. * @task exec */ - protected function getExecutableCommand() { + final protected function getExecutableCommand() { $this->checkBinaryConfiguration(); $interpreter = null; @@ -351,7 +351,7 @@ * @return list<string> Composed flags. * @task exec */ - protected function getCommandFlags() { + final protected function getCommandFlags() { $mandatory_flags = $this->getMandatoryFlags(); if (!is_array($mandatory_flags)) { phutil_deprecated( @@ -385,7 +385,7 @@ return null; } - protected function buildFutures(array $paths) { + final protected function buildFutures(array $paths) { $executable = $this->getExecutableCommand(); $bin = csprintf('%C %Ls', $executable, $this->getCommandFlags()); @@ -410,7 +410,7 @@ return $futures; } - protected function resolveFuture($path, Future $future) { + final protected function resolveFuture($path, Future $future) { list($err, $stdout, $stderr) = $future->resolve(); if ($err && !$this->shouldExpectCommandErrors()) { $future->resolvex(); diff --git a/src/lint/linter/ArcanistFutureLinter.php b/src/lint/linter/ArcanistFutureLinter.php --- a/src/lint/linter/ArcanistFutureLinter.php +++ b/src/lint/linter/ArcanistFutureLinter.php @@ -7,11 +7,11 @@ abstract protected function buildFutures(array $paths); abstract protected function resolveFuture($path, Future $future); - protected function getFuturesLimit() { + final protected function getFuturesLimit() { return 8; } - public function willLintPaths(array $paths) { + final public function willLintPaths(array $paths) { $limit = $this->getFuturesLimit(); $this->futures = Futures(array())->limit($limit); foreach ($this->buildFutures($paths) as $path => $future) { @@ -19,10 +19,9 @@ } } - public function lintPath($path) { - } + final public function lintPath($path) {} - public function didRunLinters() { + final public function didRunLinters() { if ($this->futures) { foreach ($this->futures as $path => $future) { $this->willLintPath($path); diff --git a/src/lint/linter/ArcanistLinter.php b/src/lint/linter/ArcanistLinter.php --- a/src/lint/linter/ArcanistLinter.php +++ b/src/lint/linter/ArcanistLinter.php @@ -39,20 +39,20 @@ return $this; } - public function setConfig(array $config) { + final public function setConfig(array $config) { $this->config = $config; return $this; } - protected function getConfig($key, $default = null) { + final protected function getConfig($key, $default = null) { return idx($this->config, $key, $default); } - public function getActivePath() { + final public function getActivePath() { return $this->activePath; } - public function getOtherLocation($offset, $path = null) { + final public function getOtherLocation($offset, $path = null) { if ($path === null) { $path = $this->getActivePath(); } @@ -68,21 +68,21 @@ ); } - public function stopAllLinters() { + final public function stopAllLinters() { $this->stopAllLinters = true; return $this; } - public function didStopAllLinters() { + final public function didStopAllLinters() { return $this->stopAllLinters; } - public function addPath($path) { + final public function addPath($path) { $this->paths[$path] = $path; return $this; } - public function setPaths(array $paths) { + final public function setPaths(array $paths) { $this->paths = $paths; return $this; } @@ -91,7 +91,7 @@ * Filter out paths which this linter doesn't act on (for example, because * they are binaries and the linter doesn't apply to binaries). */ - private function filterPaths($paths) { + final private function filterPaths($paths) { $engine = $this->getEngine(); $keep = array(); @@ -114,16 +114,16 @@ return $keep; } - public function getPaths() { + final public function getPaths() { return $this->filterPaths(array_values($this->paths)); } - public function addData($path, $data) { + final public function addData($path, $data) { $this->data[$path] = $data; return $this; } - protected function getData($path) { + final protected function getData($path) { if (!array_key_exists($path, $this->data)) { $this->data[$path] = $this->getEngine()->loadData($path); } @@ -135,7 +135,7 @@ return $this; } - protected function getEngine() { + final protected function getEngine() { return $this->engine; } @@ -143,11 +143,11 @@ return 0; } - public function getLintMessageFullCode($short_code) { + final public function getLintMessageFullCode($short_code) { return $this->getLinterName().$short_code; } - public function getLintMessageSeverity($code) { + final public function getLintMessageSeverity($code) { $map = $this->customSeverityMap; if (isset($map[$code])) { return $map[$code]; @@ -171,12 +171,12 @@ return ArcanistLintSeverity::SEVERITY_ERROR; } - public function isMessageEnabled($code) { + final public function isMessageEnabled($code) { return ($this->getLintMessageSeverity($code) !== ArcanistLintSeverity::SEVERITY_DISABLED); } - public function getLintMessageName($code) { + final public function getLintMessageName($code) { $map = $this->getLintNameMap(); if (isset($map[$code])) { return $map[$code]; @@ -184,7 +184,7 @@ return "Unknown lint message!"; } - protected function addLintMessage(ArcanistLintMessage $message) { + final protected function addLintMessage(ArcanistLintMessage $message) { if (!$this->getEngine()->getCommitHookMode()) { $root = $this->getEngine()->getWorkingCopy()->getProjectRoot(); $path = Filesystem::resolvePath($message->getPath(), $root); @@ -194,11 +194,11 @@ return $message; } - public function getLintMessages() { + final public function getLintMessages() { return $this->messages; } - protected function raiseLintAtLine( + final protected function raiseLintAtLine( $line, $char, $code, @@ -220,14 +220,14 @@ return $this->addLintMessage($message); } - protected function raiseLintAtPath( + final protected function raiseLintAtPath( $code, $desc) { return $this->raiseLintAtLine(null, null, $code, $desc, null, null); } - protected function raiseLintAtOffset( + final protected function raiseLintAtOffset( $offset, $code, $desc, @@ -272,7 +272,7 @@ // This is a hook. } - protected function isCodeEnabled($code) { + final protected function isCodeEnabled($code) { $severity = $this->getLintMessageSeverity($code); return $this->getEngine()->isSeverityEnabled($severity); } diff --git a/src/lint/linter/ArcanistXMLLinter.php b/src/lint/linter/ArcanistXMLLinter.php --- a/src/lint/linter/ArcanistXMLLinter.php +++ b/src/lint/linter/ArcanistXMLLinter.php @@ -21,10 +21,6 @@ return LIBXML_VERSION; } - public function getLintMessageName($code) { - return 'LibXML Error'; - } - public function lintPath($path) { libxml_use_internal_errors(true); libxml_clear_errors(); @@ -40,7 +36,7 @@ $message->setLine($error->line); $message->setChar($error->column ? $error->column : null); $message->setCode($this->getLintMessageFullCode($error->code)); - $message->setName($this->getLintMessageName($error->code)); + $message->setName('LibXML Error'); $message->setDescription(trim($error->message)); switch ($error->level) {