Page MenuHomePhabricator
Diviner Arcanist Tech Docs ArcanistBaseXHPASTLinter

abstract class ArcanistBaseXHPASTLinter
Arcanist Technical Documentation (Lint)

This class is not documented.

Tasks

Human Readable Information

  • public function getInfoURI() — Return an optional informative URI where humans can learn more about this linter.
  • public function getInfoDescription() — Return a brief human-readable description of the linter.
  • public function getAdditionalInformation() — Return arbitrary additional information.
  • public function getInfoName() — Return a human-readable linter name.

Runtime State

Executing Linters

Sharing Parse Trees

  • final protected function getXHPASTLinter() — Get the linter object which is responsible for building parse trees.
  • final protected function buildSharedFutures($paths) — Build futures on this linter, for use and to share with other linters.
  • final protected function releaseSharedFutures($paths) — Release futures on this linter which are no longer in use elsewhere.
  • final protected function getXHPASTTreeForPath($path) — Get a path's tree from the responsible linter.
  • final protected function getXHPASTExceptionForPath($path) — Get a path's parse exception from the responsible linter.

Other Methods

Methods

public function getInfoURI()
Inherited

ArcanistLinter

Return an optional informative URI where humans can learn more about this linter.

For most linters, this should return a link to the project home page. This is shown on arc linters.

Return
string|nullOptionally, return an informative URI.

public function getInfoDescription()
Inherited

ArcanistLinter

Return a brief human-readable description of the linter.

These should be a line or two, and are shown on arc linters.

Return
string|nullOptionally, return a brief human-readable description.

public function getAdditionalInformation()
Inherited

ArcanistLinter

Return arbitrary additional information.

Linters can use this method to provide arbitrary additional information to be included in the output of arc linters.

Return
map<string, string>A mapping of header to body content for the additional information sections.

public function getInfoName()
Inherited

ArcanistLinter

Return a human-readable linter name.

These are used by arc linters, and can let you give a linter a more presentable name.

Return
stringHuman-readable linter name.

final public function getActivePath()
Inherited

This method is not documented.
Return
wild

final public function setActivePath($path)
Inherited

This method is not documented.
Parameters
$path
Return
wild

final public function setEngine($engine)
Inherited

This method is not documented.
Parameters
ArcanistLintEngine$engine
Return
wild

final protected function getEngine()
Inherited

This method is not documented.
Return
wild

final public function setLinterID($id)
Inherited

ArcanistLinter

Set the internal ID for this linter.

This ID is assigned automatically by the ArcanistLintEngine.

Parameters
string$idUnique linter ID.
Return
this

final public function getLinterID()
Inherited

ArcanistLinter

Get the internal ID for this linter.

Retrieves an internal linter ID managed by the ArcanistLintEngine. This ID is a unique scalar which distinguishes linters in a list.

Return
stringUnique linter ID.

public function willLintPaths($paths)
Inherited

ArcanistLinter

Hook called before a list of paths are linted.

Parallelizable linters can start multiple requests in parallel here, to improve performance. They can implement didLintPaths() to collect results.

Linters which are not parallelizable should normally ignore this callback and implement lintPath() instead.

Parameters
list<string>$pathsA list of paths to be linted
Return
void

final public function lintPath($path)
Inherited

ArcanistLinter

Hook called for each path to be linted.

Linters which are not parallelizable can do work here.

Linters which are parallelizable may want to ignore this callback and implement willLintPaths() and didLintPaths() instead.

Parameters
string$pathPath to lint.
Return
void

public function didLintPaths($paths)
Inherited

ArcanistLinter

Hook called after a list of paths are linted.

Parallelizable linters can collect results here.

Linters which are not paralleizable should normally ignore this callback and implement lintPath() instead.

Parameters
list<string>$pathsA list of paths which were linted.
Return
void

public function getLinterPriority()
Inherited

This method is not documented.
Return
wild

public function setCustomSeverityMap($map)
Inherited

This method is not documented.
Parameters
array$map
Return
wild

public function addCustomSeverityMap($map)
Inherited

This method is not documented.
Parameters
array$map
Return
wild

public function setCustomSeverityRules($rules)
Inherited

This method is not documented.
Parameters
array$rules
Return
wild

final public function getProjectRoot()
Inherited

This method is not documented.
Return
wild

final public function getOtherLocation($offset, $path)
Inherited

This method is not documented.
Parameters
$offset
$path
Return
wild

final public function stopAllLinters()
Inherited

This method is not documented.
Return
wild

final public function didStopAllLinters()
Inherited

This method is not documented.
Return
wild

final public function addPath($path)
Inherited

This method is not documented.
Parameters
$path
Return
wild

final public function setPaths($paths)
Inherited

This method is not documented.
Parameters
array$paths
Return
wild

private function filterPaths($paths)
Inherited

ArcanistLinter

Filter out paths which this linter doesn't act on (for example, because they are binaries and the linter doesn't apply to binaries).

Parameters
list<string>$paths
Return
list<string>

final public function getPaths()
Inherited

This method is not documented.
Return
wild

final public function addData($path, $data)
Inherited

This method is not documented.
Parameters
$path
$data
Return
wild

final protected function getData($path)
Inherited

This method is not documented.
Parameters
$path
Return
wild

final public function getCacheVersion()

This method is not documented.
Return
wild

final public function getLintMessageFullCode($short_code)
Inherited

This method is not documented.
Parameters
$short_code
Return
wild

final public function getLintMessageSeverity($code)
Inherited

This method is not documented.
Parameters
$code
Return
wild

protected function getDefaultMessageSeverity($code)
Inherited

This method is not documented.
Parameters
$code
Return
wild

final public function isMessageEnabled($code)
Inherited

This method is not documented.
Parameters
$code
Return
wild

final public function getLintMessageName($code)
Inherited

This method is not documented.
Parameters
$code
Return
wild

final protected function addLintMessage($message)
Inherited

This method is not documented.
Parameters
ArcanistLintMessage$message
Return
wild

final public function getLintMessages()
Inherited

This method is not documented.
Return
wild

final public function raiseLintAtLine($line, $char, $code, $description, $original, $replacement)
Inherited

This method is not documented.
Parameters
$line
$char
$code
$description
$original
$replacement
Return
wild

final public function raiseLintAtPath($code, $desc)
Inherited

This method is not documented.
Parameters
$code
$desc
Return
wild

final public function raiseLintAtOffset($offset, $code, $description, $original, $replacement)
Inherited

This method is not documented.
Parameters
$offset
$code
$description
$original
$replacement
Return
wild

public function canRun()
Inherited

This method is not documented.
Return
wild

abstract public function getLinterName()
Inherited

This method is not documented.
Return
wild

public function getVersion()
Inherited

This method is not documented.
Return
wild

final protected function isCodeEnabled($code)
Inherited

This method is not documented.
Parameters
$code
Return
wild

public function getLintSeverityMap()
Inherited

This method is not documented.
Return
wild

public function getLintNameMap()
Inherited

This method is not documented.
Return
wild

public function getCacheGranularity()
Inherited

This method is not documented.
Return
wild

public function getLinterConfigurationName()
Inherited

ArcanistLinter

If this linter is selectable via .arclint configuration files, return a short, human-readable name to identify it. For example, "jshint" or "pep8".

If you do not implement this method, the linter will not be selectable through .arclint files.

Return
wild

public function getLinterConfigurationOptions()
Inherited

This method is not documented.
Return
wild

public function setLinterConfigurationValue($key, $value)
Inherited

This method is not documented.
Parameters
$key
$value
Return
wild

protected function canCustomizeLintSeverities()
Inherited

This method is not documented.
Return
wild

protected function shouldLintBinaryFiles()
Inherited

This method is not documented.
Return
wild

protected function shouldLintDeletedFiles()
Inherited

This method is not documented.
Return
wild

protected function shouldLintDirectories()
Inherited

This method is not documented.
Return
wild

protected function shouldLintSymbolicLinks()
Inherited

This method is not documented.
Return
wild

protected function getLintCodeFromLinterConfigurationKey($code)
Inherited

ArcanistLinter

Map a configuration lint code to an arc lint code. Primarily, this is intended for validation, but can also be used to normalize case or otherwise be more permissive in accepted inputs.

If the code is not recognized, you should throw an exception.

Parameters
string$codeCode specified in configuration.
Return
stringNormalized code to use in severity map.

final protected function buildFutures($paths)

This method is not documented.
Parameters
array$paths
Return
wild

abstract protected function resolveFuture($path, $future)
Inherited

This method is not documented.
Parameters
$path
Future$future
Return
wild

final protected function getFuturesLimit()
Inherited

This method is not documented.
Return
wild

protected function didResolveLinterFutures($futures)

ArcanistFutureLinter

Hook for cleaning up resources.

This is invoked after a block of futures resolve, and allows linters to discard or clean up any shared resources they no longer need.

ArcanistBaseXHPASTLinter
This method is not documented.
Parameters
map<string,$futuresFuture> Map of paths to resolved futures.
Return
void

final public function raiseLintAtToken($token, $code, $desc, $replace)

This method is not documented.
Parameters
XHPASTToken$token
$code
$desc
$replace
Return
wild

final public function raiseLintAtNode($node, $code, $desc, $replace)

This method is not documented.
Parameters
XHPASTNode$node
$code
$desc
$replace
Return
wild

final protected function getXHPASTLinter()

Get the linter object which is responsible for building parse trees.

When the engine specifies that several XHPAST linters should execute, we designate one of them as the one which will actually build parse trees. The other linters share trees, so they don't have to recompute them.

Roughly, the first linter to execute elects itself as the builder. Subsequent linters request builds and retrieve results from it.

Return
ArcanistBaseXHPASTLinterResponsible linter.

final protected function buildSharedFutures($paths)

Build futures on this linter, for use and to share with other linters.

Parameters
list<string>$pathsPaths to build futures for.
Return
list<ExecFuture>Futures.

final protected function releaseSharedFutures($paths)

Release futures on this linter which are no longer in use elsewhere.

Parameters
list<string>$pathsPaths to release futures for.
Return
void

final protected function getXHPASTTreeForPath($path)

Get a path's tree from the responsible linter.

Parameters
string$pathPath to retrieve tree for.
Return
XHPASTTree|nullTree, or null if unparseable.

final protected function getXHPASTExceptionForPath($path)

Get a path's parse exception from the responsible linter.

Parameters
string$pathPath to retrieve exception for.
Return
Exception|nullParse exception, if available.

protected function getFunctionCalls($root, $function_names)

Retrieve all calls to some specified function(s).

Returns all descendant nodes which represent a function call to one of the specified functions.

Parameters
XHPASTNode$rootRoot node.
list<string>$function_namesFunction names.
Return
AASTNodeList

public function getSuperGlobalNames()

This method is not documented.
Return
wild