Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F49506557
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/lint/linter/ArcanistShellCheckLinter.php b/lint/linter/ArcanistShellCheckLinter.php
index a97158d..eba0e0d 100644
--- a/lint/linter/ArcanistShellCheckLinter.php
+++ b/lint/linter/ArcanistShellCheckLinter.php
@@ -1,162 +1,162 @@
<?php
final class ArcanistShellCheckLinter extends ArcanistExternalLinter {
private $shell;
private $exclude;
public function getInfoName() {
return 'ShellCheck';
}
public function getInfoURI() {
- return 'http://www.shellcheck.net/';
+ return 'https://www.shellcheck.net/';
}
public function getInfoDescription() {
return pht(
'ShellCheck is a static analysis and linting tool for %s scripts.',
'sh/bash');
}
public function getLinterName() {
return 'SHELLCHECK';
}
public function getLinterConfigurationName() {
return 'shellcheck';
}
public function getLinterConfigurationOptions() {
$options = array(
'shellcheck.shell' => array(
'type' => 'optional string',
'help' => pht(
'Specify shell dialect (%s, %s, %s, %s).',
'bash',
'sh',
'ksh',
'zsh'),
),
'shellcheck.exclude' => array(
'type' => 'optional list<string>',
'help' => pht('Specify excluded checks, e.g.: SC2035.'),
),
);
return $options + parent::getLinterConfigurationOptions();
}
public function setLinterConfigurationValue($key, $value) {
switch ($key) {
case 'shellcheck.shell':
$this->setShell($value);
return;
case 'shellcheck.exclude':
$this->setExclude($value);
return;
default:
return parent::setLinterConfigurationValue($key, $value);
}
}
public function setShell($shell) {
$this->shell = $shell;
return $this;
}
public function setExclude($exclude) {
$this->exclude = $exclude;
return $this;
}
public function getDefaultBinary() {
return 'shellcheck';
}
public function getInstallInstructions() {
return pht(
'Install ShellCheck with `%s`.',
'cabal install shellcheck');
}
protected function getMandatoryFlags() {
$options = array();
$options[] = '--format=checkstyle';
if ($this->shell) {
$options[] = '--shell='.$this->shell;
}
if ($this->exclude) {
foreach ($this->exclude as $code) {
$options[] = '--exclude='.$code;
}
}
return $options;
}
public function getVersion() {
list($stdout, $stderr) = execx(
'%C --version', $this->getExecutableCommand());
$matches = null;
if (preg_match('/version: (\d(?:\.\d){2})/', $stdout, $matches)) {
return $matches[1];
}
return null;
}
protected function parseLinterOutput($path, $err, $stdout, $stderr) {
$report_dom = new DOMDocument();
$ok = @$report_dom->loadXML($stdout);
if (!$ok) {
return false;
}
$files = $report_dom->getElementsByTagName('file');
$messages = array();
foreach ($files as $file) {
foreach ($file->getElementsByTagName('error') as $child) {
$code = str_replace('ShellCheck.', '', $child->getAttribute('source'));
$message = id(new ArcanistLintMessage())
->setPath($path)
->setLine($child->getAttribute('line'))
->setChar($child->getAttribute('column'))
->setName($this->getLinterName())
->setCode($code)
->setDescription($child->getAttribute('message'));
switch ($child->getAttribute('severity')) {
case 'error':
$message->setSeverity(ArcanistLintSeverity::SEVERITY_ERROR);
break;
case 'warning':
$message->setSeverity(ArcanistLintSeverity::SEVERITY_WARNING);
break;
case 'info':
$message->setSeverity(ArcanistLintSeverity::SEVERITY_ADVICE);
break;
default:
$message->setSeverity(ArcanistLintSeverity::SEVERITY_ERROR);
break;
}
$messages[] = $message;
}
}
return $messages;
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Mon, Sep 14, 16:00 (55 m, 36 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4085816
Default Alt Text
(4 KB)
Attached To
Mode
rSCL ShellCheck linter for Arcanist
Attached
Detach File
Event Timeline
Log In to Comment