Changeset View
Changeset View
Standalone View
Standalone View
src/lint/engine/ArcanistComprehensiveLintEngine.php
Show All 13 Lines | foreach ($paths as $key => $path) { | ||||
if (preg_match('@^externals/@', $path)) { | if (preg_match('@^externals/@', $path)) { | ||||
// Third-party stuff lives in /externals/; don't run lint engines | // Third-party stuff lives in /externals/; don't run lint engines | ||||
// against it. | // against it. | ||||
unset($paths[$key]); | unset($paths[$key]); | ||||
} | } | ||||
} | } | ||||
$text_paths = preg_grep('/\.(php|css|hpp|cpp|l|y|py|pl)$/', $paths); | $text_paths = preg_grep('/\.(php|css|hpp|cpp|l|y|py|pl)$/', $paths); | ||||
$linters[] = id(new ArcanistGeneratedLinter())->setPaths($text_paths); | $linters[] = (new ArcanistGeneratedLinter())->setPaths($text_paths); | ||||
$linters[] = id(new ArcanistNoLintLinter())->setPaths($text_paths); | $linters[] = (new ArcanistNoLintLinter())->setPaths($text_paths); | ||||
$linters[] = id(new ArcanistTextLinter())->setPaths($text_paths); | $linters[] = (new ArcanistTextLinter())->setPaths($text_paths); | ||||
$linters[] = id(new ArcanistFilenameLinter())->setPaths($paths); | $linters[] = (new ArcanistFilenameLinter())->setPaths($paths); | ||||
$linters[] = id(new ArcanistXHPASTLinter()) | $linters[] = (new ArcanistXHPASTLinter()) | ||||
->setPaths(preg_grep('/\.php$/', $paths)); | ->setPaths(preg_grep('/\.php$/', $paths)); | ||||
$py_paths = preg_grep('/\.py$/', $paths); | $py_paths = preg_grep('/\.py$/', $paths); | ||||
$linters[] = id(new ArcanistPyFlakesLinter())->setPaths($py_paths); | $linters[] = (new ArcanistPyFlakesLinter())->setPaths($py_paths); | ||||
$linters[] = id(new ArcanistPEP8Linter()) | $linters[] = (new ArcanistPEP8Linter()) | ||||
->setFlags($this->getPEP8WithTextOptions()) | ->setFlags($this->getPEP8WithTextOptions()) | ||||
->setPaths($py_paths); | ->setPaths($py_paths); | ||||
$linters[] = id(new ArcanistRubyLinter()) | $linters[] = (new ArcanistRubyLinter()) | ||||
->setPaths(preg_grep('/\.rb$/', $paths)); | ->setPaths(preg_grep('/\.rb$/', $paths)); | ||||
$linters[] = id(new ArcanistJSHintLinter()) | $linters[] = (new ArcanistJSHintLinter()) | ||||
->setPaths(preg_grep('/\.js$/', $paths)); | ->setPaths(preg_grep('/\.js$/', $paths)); | ||||
return $linters; | return $linters; | ||||
} | } | ||||
protected function getPEP8WithTextOptions() { | protected function getPEP8WithTextOptions() { | ||||
// E101 is subset of TXT2 (Tab Literal). | // E101 is subset of TXT2 (Tab Literal). | ||||
// E501 is same as TXT3 (Line Too Long). | // E501 is same as TXT3 (Line Too Long). | ||||
// W291 is same as TXT6 (Trailing Whitespace). | // W291 is same as TXT6 (Trailing Whitespace). | ||||
// W292 is same as TXT4 (File Does Not End in Newline). | // W292 is same as TXT4 (File Does Not End in Newline). | ||||
// W293 is same as TXT6 (Trailing Whitespace). | // W293 is same as TXT6 (Trailing Whitespace). | ||||
return array('--ignore=E101,E501,W291,W292,W293'); | return array('--ignore=E101,E501,W291,W292,W293'); | ||||
} | } | ||||
} | } |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0