Page MenuHomePhabricator

D12034.id28961.diff
No OneTemporary

D12034.id28961.diff

diff --git a/src/lint/linter/ArcanistLinter.php b/src/lint/linter/ArcanistLinter.php
--- a/src/lint/linter/ArcanistLinter.php
+++ b/src/lint/linter/ArcanistLinter.php
@@ -189,7 +189,7 @@
return $this->getLinterName().$short_code;
}
- final public function getLintMessageSeverity($code) {
+ final public function getLintMessageSeverity($code, $severity_code = null) {
$map = $this->customSeverityMap;
if (isset($map[$code])) {
return $map[$code];
@@ -206,7 +206,11 @@
return $map[$code];
}
- return $this->getDefaultMessageSeverity($code);
+ if ($severity_code !== null) {
+ return $this->getDefaultMessageSeverity($severity_code);
+ } else {
+ return $this->getDefaultMessageSeverity($code);
+ }
}
protected function getDefaultMessageSeverity($code) {
diff --git a/src/lint/linter/ArcanistPuppetLintLinter.php b/src/lint/linter/ArcanistPuppetLintLinter.php
--- a/src/lint/linter/ArcanistPuppetLintLinter.php
+++ b/src/lint/linter/ArcanistPuppetLintLinter.php
@@ -114,21 +114,8 @@
->setChar($matches[1])
->setCode($this->getLinterName())
->setName(ucwords(str_replace('_', ' ', $matches[3])))
- ->setDescription(ucfirst($matches[4]));
-
- switch ($matches[2]) {
- case 'warning':
- $message->setSeverity(ArcanistLintSeverity::SEVERITY_WARNING);
- break;
-
- case 'error':
- $message->setSeverity(ArcanistLintSeverity::SEVERITY_ERROR);
- break;
-
- default:
- $message->setSeverity(ArcanistLintSeverity::SEVERITY_ADVICE);
- break;
- }
+ ->setDescription(ucfirst($matches[4]))
+ ->setSeverity($this->getLintMessageSeverity($matches[3], $matches[2]));
$messages[] = $message;
}
@@ -140,4 +127,20 @@
return $messages;
}
+ protected function getDefaultMessageSeverity($code) {
+ switch ($code) {
+ case 'warning':
+ return ArcanistLintSeverity::SEVERITY_WARNING;
+ break;
+
+ case 'error':
+ return ArcanistLintSeverity::SEVERITY_ERROR;
+ break;
+
+ default:
+ return ArcanistLintSeverity::SEVERITY_ADVICE;
+ break;
+ }
+ }
+
}

File Metadata

Mime Type
text/plain
Expires
Fri, Mar 21, 5:54 PM (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7715829
Default Alt Text
D12034.id28961.diff (2 KB)

Event Timeline