From 7b383632dde194c90309fde5f0303013fe569c34 Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Mon, 12 Jan 2015 06:47:16 +1100 Subject: [PATCH] Minor tidying of `ArcanistCSSLintLinter` Summary: Minor tidying. Test Plan: Eyeball it. Reviewers: chad, #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Differential Revision: https://secure.phabricator.com/D11307 --- src/lint/linter/ArcanistCSSLintLinter.php | 37 +++++++++++------------ 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/src/lint/linter/ArcanistCSSLintLinter.php b/src/lint/linter/ArcanistCSSLintLinter.php index 8351fb2b..10ecf461 100644 --- a/src/lint/linter/ArcanistCSSLintLinter.php +++ b/src/lint/linter/ArcanistCSSLintLinter.php @@ -1,7 +1,7 @@ getElementsByTagName('file'); $messages = array(); + foreach ($files as $file) { foreach ($file->childNodes as $child) { - if (!($child instanceof DOMElement)) { - continue; - } - $data = $this->getData($path); $lines = explode("\n", $data); $name = $child->getAttribute('reason'); @@ -81,13 +82,13 @@ final class ArcanistCSSLintLinter extends ArcanistExternalLinter { ? ArcanistLintSeverity::SEVERITY_WARNING : ArcanistLintSeverity::SEVERITY_ERROR; - $message = new ArcanistLintMessage(); - $message->setPath($path); - $message->setLine($child->getAttribute('line')); - $message->setChar($child->getAttribute('char')); - $message->setCode('CSSLint'); - $message->setDescription($child->getAttribute('reason')); - $message->setSeverity($severity); + $message = id(new ArcanistLintMessage()) + ->setPath($path) + ->setLine($child->getAttribute('line')) + ->setChar($child->getAttribute('char')) + ->setCode('CSSLint') + ->setSeverity($severity) + ->setDescription($child->getAttribute('reason')); if ($child->hasAttribute('line') && $child->getAttribute('line') > 0) { $line = $lines[$child->getAttribute('line') - 1]; @@ -103,18 +104,16 @@ final class ArcanistCSSLintLinter extends ArcanistExternalLinter { } protected function getLintCodeFromLinterConfigurationKey($code) { - // NOTE: We can't figure out which rule generated each message, so we // can not customize severities. I opened a pull request to add this // ability; see: // // https://github.com/stubbornella/csslint/pull/409 - throw new Exception( pht( - "CSSLint does not currently support custom severity levels, because ". - "rules can't be identified from messages in output. ". - "See Pull Request #409.")); + "%s does not currently support custom severity levels, because ". + "rules can't be identified from messages in output.", + 'CSSLint')); } }