]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Undumb other generic text linters
authorepriestley <git@epriestley.com>
Wed, 20 Feb 2013 22:36:53 +0000 (14:36 -0800)
committerepriestley <git@epriestley.com>
Wed, 20 Feb 2013 22:36:53 +0000 (14:36 -0800)
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

src/lint/engine/PhutilLintEngine.php
src/lint/linter/ArcanistGeneratedLinter.php
src/lint/linter/ArcanistNoLintLinter.php
src/lint/linter/ArcanistSpellingLinter.php
src/lint/linter/ArcanistTextLinter.php

index 5ddb4e6a7698d885b4b702094f4ac62957417759..6328f68f7f8edff0e8fe1640760d70d3e4a2ce62 100644 (file)
@@ -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);
 
index 25281d7085124d4268a02af578af81ebd937d357..b6d49ad683de6ce05c4fee4fba3af2d2f529b155 100644 (file)
@@ -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)) {
index c71a30e4686a390270fe2460a92c469c2a0b2f11..d302d2a270eb12055ea523650a829665d510a2de 100644 (file)
@@ -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)) {
index 6aee8ead6d5382b609b7a6e19a03ff663a44bb08..1898e75d33ddebb2c2ed6b851897fca5b9d048f7 100644 (file)
@@ -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)) {
index f9296b0e4c55c4c2964211fe2d0bc9a17d05ee29..fc1425fee3e0df5fd0c7112457eca3f190903e1d 100644 (file)
@@ -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.