mirror of
https://we.phorge.it/source/arcanist.git
synced 2025-01-26 06:28:19 +01:00
490984936b
This reverts commit2852a965e3
, reversing changes made to46bb3dbc36
. See: https://github.com/facebook/arcanist/pull/93
54 lines
1.6 KiB
PHP
54 lines
1.6 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Basic lint engine which just applies several linters based on the file types
|
|
*
|
|
* @group linter
|
|
*/
|
|
final class ComprehensiveLintEngine extends ArcanistLintEngine {
|
|
|
|
public function buildLinters() {
|
|
$linters = array();
|
|
|
|
$paths = $this->getPaths();
|
|
|
|
foreach ($paths as $key => $path) {
|
|
if (!$this->pathExists($path)) {
|
|
unset($paths[$key]);
|
|
}
|
|
if (preg_match('@^externals/@', $path)) {
|
|
// Third-party stuff lives in /externals/; don't run lint engines
|
|
// against it.
|
|
unset($paths[$key]);
|
|
}
|
|
}
|
|
|
|
$text_paths = preg_grep('/\.(php|css|hpp|cpp|l|y|py|pl)$/', $paths);
|
|
$linters[] = id(new ArcanistGeneratedLinter())->setPaths($text_paths);
|
|
$linters[] = id(new ArcanistNoLintLinter())->setPaths($text_paths);
|
|
$linters[] = id(new ArcanistTextLinter())->setPaths($text_paths);
|
|
|
|
$linters[] = id(new ArcanistFilenameLinter())->setPaths($paths);
|
|
|
|
$linters[] = id(new ArcanistXHPASTLinter())
|
|
->setPaths(preg_grep('/\.php$/', $paths));
|
|
|
|
$py_paths = preg_grep('/\.py$/', $paths);
|
|
$linters[] = id(new ArcanistPyFlakesLinter())->setPaths($py_paths);
|
|
$linters[] = id(new ArcanistPEP8Linter())
|
|
->setConfig(array('options' => $this->getPEP8WithTextOptions()))
|
|
->setPaths($py_paths);
|
|
|
|
$linters[] = id(new ArcanistRubyLinter())
|
|
->setPaths(preg_grep('/\.rb$/', $paths));
|
|
|
|
$linters[] = id(new ArcanistScalaSBTLinter())
|
|
->setPaths(preg_grep('/\.scala$/', $paths));
|
|
|
|
$linters[] = id(new ArcanistJSHintLinter())
|
|
->setPaths(preg_grep('/\.js$/', $paths));
|
|
|
|
return $linters;
|
|
}
|
|
|
|
}
|