mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-22 14:52:40 +01:00
Undumb other generic text linters
Summary: Make all the broad-spectrum text linters use the new binary check. I didn't touch `ComprehensiveLintEngine` because it's a nest of vipers and no one has complained; see T2039. Test Plan: Ran `arc lint` on text files and binaries in a libphutil project (arcanist). Reviewers: lisp Reviewed By: lisp CC: aran Differential Revision: https://secure.phabricator.com/D5040
This commit is contained in:
parent
92a5803d30
commit
652472d059
5 changed files with 20 additions and 5 deletions
|
@ -40,11 +40,10 @@ class PhutilLintEngine extends ArcanistLintEngine {
|
|||
}
|
||||
}
|
||||
|
||||
$text_paths = preg_grep('/\.(php|css|js|hpp|cpp|l|y)$/', $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 ArcanistSpellingLinter())->setPaths($text_paths);
|
||||
$linters[] = id(new ArcanistGeneratedLinter())->setPaths($paths);
|
||||
$linters[] = id(new ArcanistNoLintLinter())->setPaths($paths);
|
||||
$linters[] = id(new ArcanistTextLinter())->setPaths($paths);
|
||||
$linters[] = id(new ArcanistSpellingLinter())->setPaths($paths);
|
||||
|
||||
$php_paths = preg_grep('/\.php$/', $paths);
|
||||
|
||||
|
|
|
@ -25,6 +25,10 @@ final class ArcanistGeneratedLinter extends ArcanistLinter {
|
|||
}
|
||||
|
||||
public function lintPath($path) {
|
||||
if ($this->isBinaryFile($path)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$data = $this->getData($path);
|
||||
|
||||
if (preg_match('/@'.'generated/', $data)) {
|
||||
|
|
|
@ -25,6 +25,10 @@ final class ArcanistNoLintLinter extends ArcanistLinter {
|
|||
}
|
||||
|
||||
public function lintPath($path) {
|
||||
if ($this->isBinaryFile($path)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$data = $this->getData($path);
|
||||
|
||||
if (preg_match('/@'.'nolint/', $data)) {
|
||||
|
|
|
@ -71,6 +71,10 @@ final class ArcanistSpellingLinter extends ArcanistLinter {
|
|||
}
|
||||
|
||||
public function lintPath($path) {
|
||||
if ($this->isBinaryFile($path)) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($this->partialWordRules as $severity => $wordlist) {
|
||||
if ($severity >= $this->severity) {
|
||||
if (!$this->isCodeEnabled($severity)) {
|
||||
|
|
|
@ -50,6 +50,10 @@ final class ArcanistTextLinter extends ArcanistLinter {
|
|||
}
|
||||
|
||||
public function lintPath($path) {
|
||||
if ($this->isBinaryFile($path)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strlen($this->getData($path))) {
|
||||
// If the file is empty, don't bother; particularly, don't require
|
||||
// the user to add a newline.
|
||||
|
|
Loading…
Reference in a new issue