mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-22 06:42:41 +01:00
Modernize ArcanistPhpcsLinter
Summary: Allow `--severity` to be specified using `.arclint`. Test Plan: `arc unit` Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Differential Revision: https://secure.phabricator.com/D11511
This commit is contained in:
parent
623df14ae5
commit
52277fc06f
1 changed files with 33 additions and 5 deletions
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
final class ArcanistPhpcsLinter extends ArcanistExternalLinter {
|
||||
|
||||
private $reports;
|
||||
private $standard;
|
||||
|
||||
public function getInfoName() {
|
||||
return 'PHP_CodeSniffer';
|
||||
|
@ -29,14 +29,42 @@ final class ArcanistPhpcsLinter extends ArcanistExternalLinter {
|
|||
return 'phpcs';
|
||||
}
|
||||
|
||||
protected function getMandatoryFlags() {
|
||||
return array('--report=xml');
|
||||
}
|
||||
|
||||
public function getInstallInstructions() {
|
||||
return pht('Install PHPCS with `pear install PHP_CodeSniffer`.');
|
||||
}
|
||||
|
||||
public function getLinterConfigurationOptions() {
|
||||
$options = array(
|
||||
'phpcs.standard' => array(
|
||||
'type' => 'optional string',
|
||||
'help' => pht('The name or path of the coding standard to use.'),
|
||||
),
|
||||
);
|
||||
|
||||
return $options + parent::getLinterConfigurationOptions();
|
||||
}
|
||||
|
||||
public function setLinterConfigurationValue($key, $value) {
|
||||
switch ($key) {
|
||||
case 'phpcs.standard':
|
||||
$this->standard = $value;
|
||||
return;
|
||||
|
||||
default:
|
||||
return parent::setLinterConfigurationValue($key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
protected function getMandatoryFlags() {
|
||||
$options = array('--report=xml');
|
||||
|
||||
if ($this->standard) {
|
||||
$options[] = '--standard='.$this->standard;
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
protected function getDefaultFlags() {
|
||||
$options = $this->getDeprecatedConfiguration('lint.phpcs.options', array());
|
||||
$standard = $this->getDeprecatedConfiguration('lint.phpcs.standard');
|
||||
|
|
Loading…
Reference in a new issue