]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Allow .arclint to configure max line length of text linter
authorPhil Frost <pfrost@macprofessionals.com>
Fri, 9 May 2014 18:31:58 +0000 (11:31 -0700)
committerepriestley <git@epriestley.com>
Fri, 9 May 2014 18:31:58 +0000 (11:31 -0700)
Test Plan:
Verified manually. Something like this in .arclint:

  "linters" : {
    "text" : {
      "type" : "text",
      "include" : "(\\.(txt|py|html?)$)",
      "text.max-line-length": 200
    }

changes the line length. Something other than an integer there raises an error.

Reviewers: epriestley, #blessed_reviewers, #arcanist

Reviewed By: epriestley, #blessed_reviewers, #arcanist

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D9029

src/lint/linter/ArcanistTextLinter.php

index 9042207ebf1144ab33c9e5849eb1e40121f29000..3b6ee6591099488862f78b42c346248e69bd32f6 100644 (file)
@@ -23,11 +23,29 @@ final class ArcanistTextLinter extends ArcanistLinter {
     return 0.5;
   }
 
+  public function getLinterConfigurationOptions() {
+    $options = array(
+      'text.max-line-length' => 'optional int',
+    );
+
+    return $options + parent::getLinterConfigurationOptions();
+  }
+
   public function setMaxLineLength($new_length) {
     $this->maxLineLength = $new_length;
     return $this;
   }
 
+  public function setLinterConfigurationValue($key, $value) {
+    switch ($key) {
+      case 'text.max-line-length':
+        $this->setMaxLineLength($value);
+        return;
+    }
+
+    return parent::setLinterConfigurationValue($key, $value);
+  }
+
   public function getLinterName() {
     return 'TXT';
   }