1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-22 14:52:40 +01:00

Improve behavior for detecting the failure to parse external linter output

Summary:
Currently, a lot of `ArcanistExternalLinter` subclasses have something like this:

```lang=php
if ($err && !$messages) {
  return false;
}
```

We can avoid this code duplication by moving this check to the `ArcanistExternalLinter` class.

Test Plan: `arc unit`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11321
This commit is contained in:
Joshua Spence 2015-05-22 07:29:36 +10:00
parent 26c4f12a21
commit 8244b3582a
12 changed files with 7 additions and 44 deletions

View file

@ -120,10 +120,6 @@ final class ArcanistCoffeeLintLinter extends ArcanistExternalLinter {
} }
} }
if ($err && !$messages) {
return false;
}
return $messages; return $messages;
} }

View file

@ -56,10 +56,6 @@ final class ArcanistCpplintLinter extends ArcanistExternalLinter {
$messages[] = $message; $messages[] = $message;
} }
if ($err && !$messages) {
return false;
}
return $messages; return $messages;
} }

View file

@ -354,6 +354,13 @@ abstract class ArcanistExternalLinter extends ArcanistFutureLinter {
$messages = $this->parseLinterOutput($path, $err, $stdout, $stderr); $messages = $this->parseLinterOutput($path, $err, $stdout, $stderr);
if ($err && $this->shouldExpectCommandErrors() && !$messages) {
// We assume that if the future exits with a non-zero status and we
// failed to parse any linter messages, then something must've gone wrong
// during parsing.
$messages = false;
}
if ($messages === false) { if ($messages === false) {
if ($err) { if ($err) {
$future->resolvex(); $future->resolvex();

View file

@ -78,10 +78,6 @@ final class ArcanistFlake8Linter extends ArcanistExternalLinter {
$messages[] = $message; $messages[] = $message;
} }
if ($err && !$messages) {
return false;
}
return $messages; return $messages;
} }

View file

@ -79,10 +79,6 @@ final class ArcanistJSONLintLinter extends ArcanistExternalLinter {
} }
} }
if ($err && !$messages) {
return false;
}
return $messages; return $messages;
} }

View file

@ -129,10 +129,6 @@ final class ArcanistJscsLinter extends ArcanistExternalLinter {
} }
} }
if ($err && !$messages) {
return false;
}
return $messages; return $messages;
} }

View file

@ -177,10 +177,6 @@ final class ArcanistLesscLinter extends ArcanistExternalLinter {
} }
} }
if ($err && !$messages) {
return false;
}
return $messages; return $messages;
} }

View file

@ -70,10 +70,6 @@ final class ArcanistPEP8Linter extends ArcanistExternalLinter {
$messages[] = $message; $messages[] = $message;
} }
if ($err && !$messages) {
return false;
}
return $messages; return $messages;
} }

View file

@ -133,10 +133,6 @@ final class ArcanistPuppetLintLinter extends ArcanistExternalLinter {
$messages[] = $message; $messages[] = $message;
} }
if ($err && !$messages) {
return false;
}
return $messages; return $messages;
} }

View file

@ -77,10 +77,6 @@ final class ArcanistPyFlakesLinter extends ArcanistExternalLinter {
$messages[] = $message; $messages[] = $message;
} }
if ($err && !$messages) {
return false;
}
return $messages; return $messages;
} }

View file

@ -142,10 +142,6 @@ final class ArcanistPyLintLinter extends ArcanistExternalLinter {
$messages[] = $message; $messages[] = $message;
} }
if ($err && !$messages) {
return false;
}
return $messages; return $messages;
} }

View file

@ -81,10 +81,6 @@ final class ArcanistRubyLinter extends ArcanistExternalLinter {
$messages[] = $message; $messages[] = $message;
} }
if ($err && !$messages) {
return false;
}
return $messages; return $messages;
} }