]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Trigger bad charset lint warning only once per line
authorvrana <jakubv@fb.com>
Mon, 5 Nov 2012 23:52:19 +0000 (15:52 -0800)
committervrana <jakubv@fb.com>
Tue, 6 Nov 2012 00:36:19 +0000 (16:36 -0800)
Summary:
Makes lots of noise:
{F22758}

Test Plan:
Linted file with several bad characters per line.
Linted file with one bad character per line.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3896

src/lint/linter/ArcanistTextLinter.php

index 7bd63e1132e2b7b54a66d41293f2b4ba23b5d724..f9296b0e4c55c4c2964211fe2d0bc9a17d05ee29 100644 (file)
@@ -136,8 +136,9 @@ final class ArcanistTextLinter extends ArcanistLinter {
     $data = $this->getData($path);
 
     $matches = null;
+    $bad = '[^\x09\x0A\x20-\x7E]';
     $preg = preg_match_all(
-      '/[^\x09\x0A\x20-\x7E]+/',
+      "/{$bad}(.*{$bad})?/",
       $data,
       $matches,
       PREG_OFFSET_CAPTURE);