Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/ArcanistJscsLinter.php
| <?php | <?php | ||||
| final class ArcanistJscsLinter extends ArcanistExternalLinter { | final class ArcanistJscsLinter extends ArcanistExternalLinter { | ||||
| private $config; | private $config; | ||||
| private $preset; | private $preset; | ||||
| public function getInfoName() { | public function getInfoName() { | ||||
| return 'JSCS'; | return 'JSCS'; | ||||
| } | } | ||||
| public function getInfoURI() { | public function getInfoURI() { | ||||
| return 'https://github.com/mdevils/node-jscs'; | return 'https://github.com/mdevils/node-jscs'; | ||||
| } | } | ||||
| public function getInfoDescription() { | public function getInfoDescription() { | ||||
| return pht('Use `jscs` to detect issues with Javascript source files.'); | return pht( | ||||
| 'Use `%s` to detect issues with Javascript source files.', | |||||
| 'jscs'); | |||||
| } | } | ||||
| public function getLinterName() { | public function getLinterName() { | ||||
| return 'JSCS'; | return 'JSCS'; | ||||
| } | } | ||||
| public function getLinterConfigurationName() { | public function getLinterConfigurationName() { | ||||
| return 'jscs'; | return 'jscs'; | ||||
| Show All 11 Lines | public function getVersion() { | ||||
| if (preg_match($regex, $stdout, $matches)) { | if (preg_match($regex, $stdout, $matches)) { | ||||
| return $matches['version']; | return $matches['version']; | ||||
| } else { | } else { | ||||
| return false; | return false; | ||||
| } | } | ||||
| } | } | ||||
| public function getInstallInstructions() { | public function getInstallInstructions() { | ||||
| return pht('Install JSCS using `npm install -g jscs`.'); | return pht('Install JSCS using `%s`.', 'npm install -g jscs'); | ||||
| } | } | ||||
| protected function getMandatoryFlags() { | protected function getMandatoryFlags() { | ||||
| $options = array(); | $options = array(); | ||||
| $options[] = '--reporter=checkstyle'; | $options[] = '--reporter=checkstyle'; | ||||
| $options[] = '--no-colors'; | $options[] = '--no-colors'; | ||||
| if ($this->config) { | if ($this->config) { | ||||
| $options[] = '--config='.$this->config; | $options[] = '--config='.$this->config; | ||||
| } | } | ||||
| if ($this->preset) { | if ($this->preset) { | ||||
| $options[] = '--preset='.$this->preset; | $options[] = '--preset='.$this->preset; | ||||
| } | } | ||||
| return $options; | return $options; | ||||
| } | } | ||||
| public function getLinterConfigurationOptions() { | public function getLinterConfigurationOptions() { | ||||
| $options = array( | $options = array( | ||||
| 'jscs.config' => array( | 'jscs.config' => array( | ||||
| 'type' => 'optional string', | 'type' => 'optional string', | ||||
| 'help' => pht('Pass in a custom jscsrc file path.'), | 'help' => pht('Pass in a custom %s file path.', 'jscsrc'), | ||||
| ), | ), | ||||
| 'jscs.preset' => array( | 'jscs.preset' => array( | ||||
| 'type' => 'optional string', | 'type' => 'optional string', | ||||
| 'help' => pht('Custom preset.'), | 'help' => pht('Custom preset.'), | ||||
| ), | ), | ||||
| ); | ); | ||||
| return $options + parent::getLinterConfigurationOptions(); | return $options + parent::getLinterConfigurationOptions(); | ||||
| ▲ Show 20 Lines • Show All 73 Lines • Show Last 20 Lines | |||||