Page MenuHomePhabricator
Diviner Arcanist Tech Docs ArcanistSpellingLinter

final class ArcanistSpellingLinter
Arcanist Technical Documentation (Lint)

Enforces basic spelling. Spelling inside code is actually pretty hard to get right without false positives. I take a conservative approach and just use a blacklisted set of words that are commonly spelled incorrectly.

Tasks

Human Readable Information

Runtime State

Executing Linters

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

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

ArcanistLinter

Return a brief human-readable description of the linter.

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

ArcanistSpellingLinter
This method is not documented.
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()

ArcanistLinter

Return a human-readable linter name.

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

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

public function lintPath($path)

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.

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

public function getCacheVersion()
Inherited

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

public function getLinterName()

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

This method is not documented.
Return
wild

public function getLintNameMap()

This method is not documented.
Return
wild

public function getCacheGranularity()
Inherited

This method is not documented.
Return
wild

public function getLinterConfigurationName()

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.

ArcanistSpellingLinter
This method is not documented.
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()
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.

public function loadDictionary($path)

This method is not documented.
Parameters
$path
Return
wild

public function addExactWordRule($misspelling, $correction)

This method is not documented.
Parameters
$misspelling
$correction
Return
wild

public function addPartialWordRule($misspelling, $correction)

This method is not documented.
Parameters
$misspelling
$correction
Return
wild

private function checkExactWord($path, $word, $correction)

This method is not documented.
Parameters
$path
$word
$correction
Return
wild

private function checkPartialWord($path, $word, $correction)

This method is not documented.
Parameters
$path
$word
$correction
Return
wild

public static function fixLetterCase($string, $case)

This method is not documented.
Parameters
$string
$case
Return
wild