mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-25 16:22:42 +01:00
Don't lint file content of directories
Summary: This also changes how we treat `@generated` and `@nolint` - after this diff, we will still lint their path. Test Plan: Created directory `a.php` and symlink `b.php` pointing to directory. `arc lint` previously printed: > Requested path `/data/users/jakubv/devtools/arcanist/_.php' is not a file. Now it prints: > No lint warnings. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D3737
This commit is contained in:
parent
b52ee2fdee
commit
4585ab7363
1 changed files with 11 additions and 11 deletions
|
@ -48,6 +48,15 @@ class PhutilLintEngine extends ArcanistLintEngine {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$name_linter = new ArcanistFilenameLinter();
|
||||||
|
$linters[] = $name_linter;
|
||||||
|
foreach ($paths as $key => $path) {
|
||||||
|
$name_linter->addPath($path);
|
||||||
|
if (!is_file($path)) {
|
||||||
|
unset($paths[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$generated_linter = new ArcanistGeneratedLinter();
|
$generated_linter = new ArcanistGeneratedLinter();
|
||||||
$linters[] = $generated_linter;
|
$linters[] = $generated_linter;
|
||||||
|
|
||||||
|
@ -79,13 +88,6 @@ class PhutilLintEngine extends ArcanistLintEngine {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$name_linter = new ArcanistFilenameLinter();
|
|
||||||
$linters[] = $name_linter;
|
|
||||||
foreach ($paths as $path) {
|
|
||||||
$name_linter->addPath($path);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$xhpast_linter = new ArcanistXHPASTLinter();
|
$xhpast_linter = new ArcanistXHPASTLinter();
|
||||||
$xhpast_map = $this->getXHPASTSeverityMap();
|
$xhpast_map = $this->getXHPASTSeverityMap();
|
||||||
$xhpast_linter->setCustomSeverityMap($xhpast_map);
|
$xhpast_linter->setCustomSeverityMap($xhpast_map);
|
||||||
|
@ -101,10 +103,8 @@ class PhutilLintEngine extends ArcanistLintEngine {
|
||||||
$linters[] = $license_linter;
|
$linters[] = $license_linter;
|
||||||
foreach ($paths as $path) {
|
foreach ($paths as $path) {
|
||||||
if (preg_match('/\.(php|cpp|hpp|l|y)$/', $path)) {
|
if (preg_match('/\.(php|cpp|hpp|l|y)$/', $path)) {
|
||||||
if (!preg_match('@^externals/@', $path)) {
|
$license_linter->addPath($path);
|
||||||
$license_linter->addPath($path);
|
$license_linter->addData($path, $this->loadData($path));
|
||||||
$license_linter->addData($path, $this->loadData($path));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue