]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Revert "Merge pull request #93 from vlajos/csslint"
authorepriestley <git@epriestley.com>
Mon, 22 Jul 2013 13:51:48 +0000 (06:51 -0700)
committerepriestley <git@epriestley.com>
Mon, 22 Jul 2013 13:52:08 +0000 (06:52 -0700)
This reverts commit 2852a965e3308dcb81d1d7154e1a25aa72d74139, reversing
changes made to 46bb3dbc361729ba589c73ddd550f7d570f5d26f.

See: https://github.com/facebook/arcanist/pull/93

src/__phutil_library_map__.php
src/lint/engine/ComprehensiveLintEngine.php
src/lint/linter/ArcanistCSSLintLinter.php [deleted file]

index 363d99734ea5bac88d47494d287603d6e69bc741..a4963e2bdb564d3db8592b85c1ac14dfffdca89b 100644 (file)
@@ -28,7 +28,6 @@ phutil_register_library_map(array(
     'ArcanistBrowseWorkflow' => 'workflow/ArcanistBrowseWorkflow.php',
     'ArcanistBundle' => 'parser/ArcanistBundle.php',
     'ArcanistBundleTestCase' => 'parser/__tests__/ArcanistBundleTestCase.php',
-    'ArcanistCSSLintLinter' => 'lint/linter/ArcanistCSSLintLinter.php',
     'ArcanistCallConduitWorkflow' => 'workflow/ArcanistCallConduitWorkflow.php',
     'ArcanistCapabilityNotSupportedException' => 'workflow/exception/ArcanistCapabilityNotSupportedException.php',
     'ArcanistChooseInvalidRevisionException' => 'exception/ArcanistChooseInvalidRevisionException.php',
@@ -190,7 +189,6 @@ phutil_register_library_map(array(
     'ArcanistBritishTestCase' => 'ArcanistTestCase',
     'ArcanistBrowseWorkflow' => 'ArcanistBaseWorkflow',
     'ArcanistBundleTestCase' => 'ArcanistTestCase',
-    'ArcanistCSSLintLinter' => 'ArcanistLinter',
     'ArcanistCallConduitWorkflow' => 'ArcanistBaseWorkflow',
     'ArcanistCapabilityNotSupportedException' => 'Exception',
     'ArcanistChooseInvalidRevisionException' => 'Exception',
index c138e0c2e7087aeb1f597410d8e9fce2a7feb9d4..e8a104d2c99378a8d0b95f3a23f122d40a8fe331 100644 (file)
@@ -48,9 +48,6 @@ final class ComprehensiveLintEngine extends ArcanistLintEngine {
     $linters[] = id(new ArcanistJSHintLinter())
       ->setPaths(preg_grep('/\.js$/', $paths));
 
-    $linters[] = id(new ArcanistCSSLintLinter())
-      ->setPaths(preg_grep('/\.css$/', $paths));
-
     return $linters;
   }
 
diff --git a/src/lint/linter/ArcanistCSSLintLinter.php b/src/lint/linter/ArcanistCSSLintLinter.php
deleted file mode 100644 (file)
index 54b537e..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-<?php
-
-/**
- * Uses "CSS lint" to detect checkstyle errors in css code.
- * To use this linter, you must install CSS lint.
- * ##npm install csslint -g## (don't forget the -g flag or NPM will install
- * the package locally).
- *
- * Based on ArcanistPhpcsLinter.php
- *
- *   lint.csslint.options
- *   lint.csslint.bin
- *
- * @group linter
- */
-final class ArcanistCSSLintLinter extends ArcanistLinter {
-
-  private $reports;
-
-  public function getLinterName() {
-    return 'CSSLint';
-  }
-
-  public function getLintSeverityMap() {
-    return array();
-  }
-
-  public function getLintNameMap() {
-    return array();
-  }
-
-  public function getCSSLintOptions() {
-    $working_copy = $this->getEngine()->getWorkingCopy();
-
-    $options = $working_copy->getConfig('lint.csslint.options');
-
-    return $options;
-  }
-
-  private function getCSSLintPath() {
-    $working_copy = $this->getEngine()->getWorkingCopy();
-    $bin = $working_copy->getConfig('lint.csslint.bin');
-
-    if ($bin === null) {
-      $bin = 'csslint';
-    }
-
-    return $bin;
-  }
-
-  public function willLintPaths(array $paths) {
-    $csslint_bin = $this->getCSSLintPath();
-    $csslint_options = $this->getCSSLintOptions();
-    $futures = array();
-
-    foreach ($paths as $path) {
-      $filepath = $this->getEngine()->getFilePathOnDisk($path);
-      $this->reports[$path] = new TempFile();
-      $futures[$path] = new ExecFuture('%C %C --format=lint-xml >%s %s',
-        $csslint_bin,
-        $csslint_options,
-        $this->reports[$path],
-        $filepath);
-    }
-
-    foreach (Futures($futures)->limit(8) as $path => $future) {
-      $this->results[$path] = $future->resolve();
-    }
-
-    libxml_use_internal_errors(true);
-  }
-
-  public function lintPath($path) {
-    list($rc, $stdout) = $this->results[$path];
-
-    $report = Filesystem::readFile($this->reports[$path]);
-
-    if ($report) {
-      $report_dom = new DOMDocument();
-      libxml_clear_errors();
-      $report_dom->loadXML($report);
-    }
-    if (!$report || libxml_get_errors()) {
-      throw new ArcanistUsageException('CSS Linter failed to load ' .
-        'reporting file. Something happened when running csslint. ' .
-        "Output:\n$stdout" .
-        "\nTry running lint with --trace flag to get more details.");
-    }
-
-    $files = $report_dom->getElementsByTagName('file');
-    foreach ($files as $file) {
-      foreach ($file->childNodes as $child) {
-        if (!($child instanceof DOMElement)) {
-          continue;
-        }
-
-        $data = $this->getData($path);
-        $lines = explode("\n", $data);
-        $name = $this->getLinterName() . ' - ' . $child->getAttribute('reason');
-        $severity = $child->getAttribute('severity') == 'warning' ?
-            ArcanistLintSeverity::SEVERITY_WARNING
-            : ArcanistLintSeverity::SEVERITY_ERROR;
-
-        $message = new ArcanistLintMessage();
-        $message->setPath($path);
-        $message->setLine($child->getAttribute('line'));
-        $message->setChar($child->getAttribute('char'));
-        $message->setCode($child->getAttribute('severity'));
-        $message->setName($name);
-        $message->setDescription($child->getAttribute('reason')."\nEvidence:".$child->getAttribute('evidence'));
-        $message->setSeverity($severity);
-
-        if($child->hasAttribute('line')){
-            $line = $lines[$child->getAttribute('line') - 1];
-            $text = substr($line, $child->getAttribute('char') - 1);
-            $message->setOriginalText($text);
-        }
-        $this->addLintMessage($message);
-      }
-    }
-  }
-}