Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15385183
D12034.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D12034.diff
View Options
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
@@ -108,27 +108,18 @@
continue;
}
+ $message_code = $this->getLinterName().'-'.
+ strtoupper($matches[2]).'-'.
+ preg_replace('/[^[:alnum:]]/', '_', $matches[3]);
+
$message = id(new ArcanistLintMessage())
->setPath($path)
->setLine($matches[0])
->setChar($matches[1])
- ->setCode($this->getLinterName())
+ ->setCode($message_code)
->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;
- }
+ $message->setSeverity($this->getLintMessageSeverity($message->getCode()));
$messages[] = $message;
}
@@ -136,4 +127,15 @@
return $messages;
}
+ protected function getDefaultMessageSeverity($code) {
+ $linter_name = $this->getLinterName();
+ if (preg_match("/^$linter_name-ERROR/", $code)) {
+ return ArcanistLintSeverity::SEVERITY_ERROR;
+ } else if (preg_match("/^$linter_name-WARNING/", $code)) {
+ return ArcanistLintSeverity::SEVERITY_WARNING;
+ } else {
+ return ArcanistLintSeverity::SEVERITY_ADVICE;
+ }
+ }
+
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 15, 9:55 PM (2 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7704049
Default Alt Text
D12034.diff (1 KB)
Attached To
Mode
D12034: Let ArcanistPuppetLintLinter respect severity/severity.rules maps
Attached
Detach File
Event Timeline
Log In to Comment