]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Ignore duplicate PEP8 lint errors in comprehensive engine
authorvrana <jakubv@fb.com>
Sat, 3 Nov 2012 21:47:38 +0000 (14:47 -0700)
committervrana <jakubv@fb.com>
Tue, 6 Nov 2012 19:48:00 +0000 (11:48 -0800)
Test Plan:
  $ arc lint a.py # with too long line

Reviewers: zeeg, epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3882

src/lint/engine/ArcanistLintEngine.php
src/lint/engine/ComprehensiveLintEngine.php
src/lint/linter/ArcanistPEP8Linter.php

index 08d818c7f91c70b23f1662c47aa86aabb4e6615a..424c4c6a0b387d7426e24172580be92ed54a6d7f 100644 (file)
@@ -336,4 +336,13 @@ abstract class ArcanistLintEngine {
     return $this;
   }
 
+  protected function getPEP8WithTextOptions() {
+    // E101 is subset of TXT2 (Tab Literal).
+    // E501 is same as TXT3 (Line Too Long).
+    // W291 is same as TXT6 (Trailing Whitespace).
+    // W292 is same as TXT4 (File Does Not End in Newline).
+    // W293 is same as TXT6 (Trailing Whitespace).
+    return '--ignore=E101,E501,W291,W292,W293';
+  }
+
 }
index 43d3efb1a2ca54fa99a7c3262ea4e504129cb4b3..432d4c00b61d48a06fd51428948586c8363dee84 100644 (file)
@@ -38,7 +38,9 @@ final class ComprehensiveLintEngine extends ArcanistLintEngine {
 
     $py_paths = preg_grep('/\.py$/', $paths);
     $linters[] = id(new ArcanistPyFlakesLinter())->setPaths($py_paths);
-    $linters[] = id(new ArcanistPEP8Linter())->setPaths($py_paths);
+    $linters[] = id(new ArcanistPEP8Linter())
+      ->setConfig(array('options' => $this->getPEP8WithTextOptions()))
+      ->setPaths($py_paths);
 
     $linters[] = id(new ArcanistRubyLinter())
       ->setPaths(preg_grep('/\.rb$/', $paths));
index 3e3f49729184ca9609cfc2a4f0412d3b22841a0e..2564fe8affdee80587ea1c84dbe46050dd453acf 100644 (file)
@@ -28,9 +28,7 @@ final class ArcanistPEP8Linter extends ArcanistLinter {
     $options = $working_copy->getConfig('lint.pep8.options');
 
     if ($options === null) {
-      // W293 (blank line contains whitespace) is redundant when used
-      // alongside TXT6, causing pain to python programmers.
-      return '--ignore=W293';
+      $options = $this->getConfig('options');
     }
 
     return $options;