From ddfdfce3f57e2b35539a40ae9cf5a64dd9be83e0 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 19 May 2015 07:58:24 -0700 Subject: [PATCH] Fix CPP Lint severity Summary: Currently all CPPLint issues are hard-coded to warning level, which prevents customising the severity in .arclint. Change to pick up the configured severity. Note that getLintMessageSeverity will call getDefaultMessageSeverity if nothing is configured for that error category. Test Plan: Tested manually to confirm configured categories display with the correct severity and that non-configured ones return with the default severity (ERROR). Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: epriestley, Korvin Differential Revision: https://secure.phabricator.com/D9682 --- src/lint/linter/ArcanistCpplintLinter.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lint/linter/ArcanistCpplintLinter.php b/src/lint/linter/ArcanistCpplintLinter.php index 3587131d..a3c5ca00 100644 --- a/src/lint/linter/ArcanistCpplintLinter.php +++ b/src/lint/linter/ArcanistCpplintLinter.php @@ -35,6 +35,10 @@ final class ArcanistCpplintLinter extends ArcanistExternalLinter { return $this->getDeprecatedConfiguration('lint.cpplint.options', array()); } + protected function getDefaultMessageSeverity($code) { + return ArcanistLintSeverity::SEVERITY_WARNING; + } + protected function parseLinterOutput($path, $err, $stdout, $stderr) { $lines = explode("\n", $stderr); @@ -49,13 +53,16 @@ final class ArcanistCpplintLinter extends ArcanistExternalLinter { foreach ($matches as $key => $match) { $matches[$key] = trim($match); } + + $severity = $this->getLintMessageSeverity($matches[3]); + $message = new ArcanistLintMessage(); $message->setPath($path); $message->setLine($matches[1]); $message->setCode($matches[3]); $message->setName($matches[3]); $message->setDescription($matches[2]); - $message->setSeverity(ArcanistLintSeverity::SEVERITY_WARNING); + $message->setSeverity($severity); $messages[] = $message; }