Page MenuHomePhorge

abstract class ArcanistLinter
libphutil Technical Documentation ()

Implements lint rules, like syntax checks for a specific language.

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

  • public function willLintPaths($paths) — Hook called before a list of paths are linted.
  • public function lintPath($path) — Hook called for each path to be linted.
  • public function didLintPaths($paths) — Hook called after a list of paths are linted.

Other Methods

Methods

public function __get($name)
Inherited

This method is not documented.
Parameters
$name
Return
wild

public function __set($name, $value)
Inherited

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

public function current()
Inherited

This method is not documented.
Return
wild

public function key()
Inherited

This method is not documented.
Return
wild

public function next()
Inherited

This method is not documented.
Return
wild

public function rewind()
Inherited

This method is not documented.
Return
wild

public function valid()
Inherited

This method is not documented.
Return
wild

private function throwOnAttemptedIteration()
Inherited

This method is not documented.
Return
wild

public function getPhobjectClassConstant($key, $byte_limit)
Inherited

Phobject

Read the value of a class constant.

This is the same as just typing self::CONSTANTNAME, but throws a more useful message if the constant is not defined and allows the constant to be limited to a maximum length.

Parameters
string$keyName of the constant.
int|null$byte_limitMaximum number of bytes permitted in the value.
Return
stringValue of the constant.

public function getInfoURI()

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()

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()

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()

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()

This method is not documented.
Return
wild

final public function setActivePath($path)

This method is not documented.
Parameters
$path
Return
wild

final public function setEngine($engine)

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

final protected function getEngine()

This method is not documented.
Return
wild

final public function setLinterID($id)

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()

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)

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

public function lintPath($path)

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)

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()

This method is not documented.
Return
wild

public function setCustomSeverityMap($map)

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

public function addCustomSeverityMap($map)

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

public function setCustomSeverityRules($rules)

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

final public function getProjectRoot()

This method is not documented.
Return
wild

final public function getOtherLocation($offset, $path)

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

final public function stopAllLinters()

This method is not documented.
Return
wild

final public function didStopAllLinters()

This method is not documented.
Return
wild

final public function addPath($path)

This method is not documented.
Parameters
$path
Return
wild

final public function setPaths($paths)

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

private function filterPaths($paths)

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()

This method is not documented.
Return
wild

final public function addData($path, $data)

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

final protected function getData($path)

This method is not documented.
Parameters
$path
Return
wild

public function getCacheVersion()

This method is not documented.
Return
wild

final public function getLintMessageFullCode($short_code)

This method is not documented.
Parameters
$short_code
Return
wild

final public function getLintMessageSeverity($code)

This method is not documented.
Parameters
$code
Return
wild

protected function getDefaultMessageSeverity($code)

This method is not documented.
Parameters
$code
Return
wild

final public function isMessageEnabled($code)

This method is not documented.
Parameters
$code
Return
wild

final public function getLintMessageName($code)

This method is not documented.
Parameters
$code
Return
wild

final protected function addLintMessage($message)

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

final public function getLintMessages()

This method is not documented.
Return
wild

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

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

final public function raiseLintAtPath($code, $desc)

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

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

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

public function canRun()

This method is not documented.
Return
wild

abstract public function getLinterName()

This method is not documented.
Return
wild

public function getVersion()

This method is not documented.
Return
wild

final protected function isCodeEnabled($code)

This method is not documented.
Parameters
$code
Return
wild

public function getLintSeverityMap()

This method is not documented.
Return
wild

public function getLintNameMap()

This method is not documented.
Return
wild

public function getCacheGranularity()

This method is not documented.
Return
wild

public function getLinterConfigurationName()

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
This method is not documented.
Return
wild

public function setLinterConfigurationValue($key, $value)

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

protected function canCustomizeLintSeverities()

This method is not documented.
Return
wild

protected function shouldLintBinaryFiles()

This method is not documented.
Return
wild

protected function shouldLintDeletedFiles()

This method is not documented.
Return
wild

protected function shouldLintDirectories()

This method is not documented.
Return
wild

protected function shouldLintSymbolicLinks()

This method is not documented.
Return
wild

protected function getLintCodeFromLinterConfigurationKey($code)

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.