From d53dcbe952e08f425a1bdd619ab1a0fd4cba7723 Mon Sep 17 00:00:00 2001 From: vrana Date: Mon, 5 Nov 2012 15:52:19 -0800 Subject: [PATCH] Trigger bad charset lint warning only once per line 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lint/linter/ArcanistTextLinter.php b/src/lint/linter/ArcanistTextLinter.php index 7bd63e11..f9296b0e 100644 --- a/src/lint/linter/ArcanistTextLinter.php +++ b/src/lint/linter/ArcanistTextLinter.php @@ -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); -- 2.43.0