]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Reformat lint severities for readability
authorepriestley <git@epriestley.com>
Fri, 21 Sep 2012 19:27:32 +0000 (12:27 -0700)
committerepriestley <git@epriestley.com>
Fri, 21 Sep 2012 19:27:32 +0000 (12:27 -0700)
Summary: See D3482.

Test Plan: `arc lint`

Reviewers: vrana

Reviewed By: vrana

CC: aran
Differential Revision: https://secure.phabricator.com/D3501

src/lint/engine/PhutilLintEngine.php

index b4e099fedec44c0ba65b253f5ac0845654561e5d..d3f1a71d0164ff7a7afc6c5d8ee098917ddebdb5 100644 (file)
@@ -85,20 +85,10 @@ class PhutilLintEngine extends ArcanistLintEngine {
       $name_linter->addPath($path);
     }
 
+
     $xhpast_linter = new ArcanistXHPASTLinter();
-    $xhpast_linter->setCustomSeverityMap(
-      array(
-        ArcanistXHPASTLinter::LINT_RAGGED_CLASSTREE_EDGE
-          => ArcanistLintSeverity::SEVERITY_WARNING,
-        ArcanistXHPASTLinter::LINT_PHP_53_FEATURES
-          => ArcanistLintSeverity::SEVERITY_ERROR,
-        ArcanistXHPASTLinter::LINT_PHP_54_FEATURES
-          => ArcanistLintSeverity::SEVERITY_ERROR,
-        ArcanistXHPASTLinter::LINT_PHT_WITH_DYNAMIC_STRING
-          => ArcanistLintSeverity::SEVERITY_WARNING,
-        ArcanistXHPASTLinter::LINT_COMMENT_SPACING
-          => ArcanistLintSeverity::SEVERITY_ERROR,
-      ));
+    $xhpast_map = $this->getXHPASTSeverityMap();
+    $xhpast_linter->setCustomSeverityMap($xhpast_map);
     $linters[] = $xhpast_linter;
     foreach ($paths as $path) {
       if (preg_match('/\.php$/', $path)) {
@@ -121,4 +111,17 @@ class PhutilLintEngine extends ArcanistLintEngine {
     return $linters;
   }
 
+  private function getXHPASTSeverityMap() {
+    $error = ArcanistLintSeverity::SEVERITY_ERROR;
+    $warning = ArcanistLintSeverity::SEVERITY_WARNING;
+
+    return array(
+      ArcanistXHPASTLinter::LINT_PHP_53_FEATURES          => $error,
+      ArcanistXHPASTLinter::LINT_PHP_54_FEATURES          => $error,
+      ArcanistXHPASTLinter::LINT_PHT_WITH_DYNAMIC_STRING  => $error,
+      ArcanistXHPASTLinter::LINT_COMMENT_SPACING          => $error,
+
+      ArcanistXHPASTLinter::LINT_RAGGED_CLASSTREE_EDGE    => $warning,
+    );
+  }
 }