Diviner

Class ArcanistLintEngine

Definedsrc/lint/engine/ArcanistLintEngine.php:45
GroupLint Integration
This class is stable: you may safely extend it.

Manages lint execution. When you run 'arc lint' or 'arc diff', Arcanist checks your .arcconfig to see if you have specified a lint engine in the key "lint.engine". The engine must extend this class. For example:

lang=js { ... "lint.engine" : "ExampleLintEngine", ... }

The lint engine is given a list of paths (generally, the paths that you modified in your change) and determines which linters to run on them. The linters themselves are responsible for actually analyzing file text and finding warnings and errors. For example, if the modified paths include some JS files and some Python files, you might want to run JSLint on the JS files and PyLint on the Python files.

You can also run multiple linters on a single file. For instance, you might run one linter on all text files to make sure they don't have trailing whitespace, or enforce tab vs space rules, or make sure there are enough curse words in them.

Because lint engines are pretty custom to the rules of a project, you will generally need to build your own. Fortunately, it's pretty easy (and you can use the prebuilt linters, you just need to write a little glue code to tell Arcanist which linters to run). For a simple example of how to build a lint engine, see ExampleLintEngine.

You can test an engine like this:

arc lint --engine ExampleLintEngine --lintall some_file.py

...which will show you all the lint issues raised in the file.

See Arcanist User Guide: Customizing Lint, Unit Tests and Workflows for more information about configuring lint engines.

Tasks

Methods

public this __construct()

returnthis
This method is not documented.

protected abstract buildLinters()

returnwild
This method is not documented.

protected didRunLinters(array $linters)

parametersarray$linters
returnwild
This method is not documented.

protected getCacheVersion()

returnwild
This method is not documented.

public getCommitHookMode()

returnwild
This method is not documented.

public getEnableAsyncLint()

returnwild
This method is not documented.

public getFilePathOnDisk($path)

parameterswild$path
returnwild
This method is not documented.

public getHookAPI()

returnwild
This method is not documented.

public getLineAndCharFromOffset($path, $offset)

parameterswild$path
wild$offset
returnwild
This method is not documented.

protected getPEP8WithTextOptions()

returnwild
This method is not documented.

public getPathChangedLines($path)

parameterswild$path
returnwild
This method is not documented.

public getPaths()

returnwild
This method is not documented.

public getPostponedLinters()

returnwild
This method is not documented.

protected getResultForPath($path)

parameterswild$path
returnwild
This method is not documented.

public getResults()

returnwild
This method is not documented.

public getStoppedPaths()

returnwild
This method is not documented.

public getWorkingCopy()

returnwild
This method is not documented.

private isRelevantMessage(ArcanistLintMessage $message)

parametersArcanistLintMessage$message
returnwild
This method is not documented.

public isSeverityEnabled($severity)

parameterswild$severity
returnwild
This method is not documented.

public loadData($path)

parameterswild$path
returnwild
This method is not documented.

public pathExists($path)

parameterswild$path
returnwild
This method is not documented.

public run()

returnwild
This method is not documented.

public this setCachedResults(array $results)

parametersdict<string$resultspath, dict<string version, list<dict message>>>
returnthis
This method is not documented.

public setCommitHookMode($mode)

parameterswild$mode
returnwild
This method is not documented.

public setEnableAsyncLint($enable_async_lint)

parameterswild$enable_async_lint
returnwild
This method is not documented.

public setFileData($data)

parameterswild$data
returnwild
This method is not documented.

public setHookAPI(ArcanistHookAPI $hook_api)

parametersArcanistHookAPI$hook_api
returnwild
This method is not documented.

public setMinimumSeverity($severity)

parameterswild$severity
returnwild
This method is not documented.

public setPathChangedLines($path, $changed)

parameterswild$path
wild$changed
returnwild
This method is not documented.

public setPaths($paths)

parameterswild$paths
returnwild
This method is not documented.

public setPostponedLinters(array $linters)

parametersarray$linters
returnwild
This method is not documented.

public setRepositoryVersion($version)

parameterswild$version
returnwild
This method is not documented.

public setWorkingCopy(ArcanistWorkingCopyIdentity $working_copy)

parametersArcanistWorkingCopyIdentity$working_copy
returnwild
This method is not documented.

private shouldUseCache($cache_granularity, $repository_version)

parameterswild$cache_granularity
wild$repository_version
returnwild
This method is not documented.