From 88bb9909b956d3a9a2597bb33497cb3c4e245d2f Mon Sep 17 00:00:00 2001 From: Phil Frost Date: Fri, 9 May 2014 11:31:58 -0700 Subject: [PATCH] Allow .arclint to configure max line length of text linter 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 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/lint/linter/ArcanistTextLinter.php b/src/lint/linter/ArcanistTextLinter.php index 9042207e..3b6ee659 100644 --- a/src/lint/linter/ArcanistTextLinter.php +++ b/src/lint/linter/ArcanistTextLinter.php @@ -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'; }