4
* Basic lint engine which just applies several linters based on the file types.
6
final class ComprehensiveLintEngine extends ArcanistLintEngine {
8
public function buildLinters() {
11
$paths = $this->getPaths();
13
foreach ($paths as $key => $path) {
14
if (preg_match('@^externals/@', $path)) {
15
// Third-party stuff lives in /externals/; don't run lint engines
21
$text_paths = preg_grep('/\.(php|css|hpp|cpp|l|y|py|pl)$/', $paths);
22
$linters[] = id(new ArcanistGeneratedLinter())->setPaths($text_paths);
23
$linters[] = id(new ArcanistNoLintLinter())->setPaths($text_paths);
24
$linters[] = id(new ArcanistTextLinter())->setPaths($text_paths);
26
$linters[] = id(new ArcanistFilenameLinter())->setPaths($paths);
28
$linters[] = id(new ArcanistXHPASTLinter())
29
->setPaths(preg_grep('/\.php$/', $paths));
31
$py_paths = preg_grep('/\.py$/', $paths);
32
$linters[] = id(new ArcanistPyFlakesLinter())->setPaths($py_paths);
33
$linters[] = id(new ArcanistPEP8Linter())
34
->setFlags($this->getPEP8WithTextOptions())
35
->setPaths($py_paths);
37
$linters[] = id(new ArcanistRubyLinter())
38
->setPaths(preg_grep('/\.rb$/', $paths));
40
$linters[] = id(new ArcanistJSHintLinter())
41
->setPaths(preg_grep('/\.js$/', $paths));
46
protected function getPEP8WithTextOptions() {
47
// E101 is subset of TXT2 (Tab Literal).
48
// E501 is same as TXT3 (Line Too Long).
49
// W291 is same as TXT6 (Trailing Whitespace).
50
// W292 is same as TXT4 (File Does Not End in Newline).
51
// W293 is same as TXT6 (Trailing Whitespace).
52
return array('--ignore=E101,E501,W291,W292,W293');