mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-26 00:32:41 +01:00
Don't lint symlinks by default.
Summary: Fixes T5300. Currently, if a dead symbolic link is linted, all kinds of errors will be thrown by most linters because they will try to read the (non-existent) file contents. Instead, let's not lint symbolic links by default. In the case that the target of a symbolic link is inside the working copy, then it should be being linted anyway. Test Plan: Created a symbolic link and verified that it wasn't linted (by any linter other than the `ArcanistFilenameLinter`). Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: epriestley, Korvin Maniphest Tasks: T5300 Differential Revision: https://secure.phabricator.com/D9448
This commit is contained in:
parent
ff1915ecff
commit
02e3905cf5
3 changed files with 16 additions and 0 deletions
|
@ -190,6 +190,10 @@ abstract class ArcanistLintEngine {
|
|||
return ArcanistDiffUtils::isHeuristicBinaryFile($data);
|
||||
}
|
||||
|
||||
final public function isSymbolicLink($path) {
|
||||
return is_link($this->getFilePathOnDisk($path));
|
||||
}
|
||||
|
||||
final public function getFilePathOnDisk($path) {
|
||||
return Filesystem::resolvePath(
|
||||
$path,
|
||||
|
|
|
@ -49,4 +49,8 @@ final class ArcanistFilenameLinter extends ArcanistLinter {
|
|||
return true;
|
||||
}
|
||||
|
||||
public function shouldLintSymbolicLinks() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -148,6 +148,10 @@ abstract class ArcanistLinter {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!$this->shouldLintSymbolicLinks() && $engine->isSymbolicLink($path)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$keep[] = $path;
|
||||
}
|
||||
|
||||
|
@ -442,6 +446,10 @@ abstract class ArcanistLinter {
|
|||
return false;
|
||||
}
|
||||
|
||||
protected function shouldLintSymbolicLinks() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Map a configuration lint code to an `arc` lint code. Primarily, this is
|
||||
* intended for validation, but can also be used to normalize case or
|
||||
|
|
Loading…
Reference in a new issue