Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F10360850
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/lint/linter/ArcanistCppcheckLinter.php b/src/lint/linter/ArcanistCppcheckLinter.php
index 50f39950..f4661b64 100644
--- a/src/lint/linter/ArcanistCppcheckLinter.php
+++ b/src/lint/linter/ArcanistCppcheckLinter.php
@@ -1,110 +1,110 @@
<?php
/**
* Uses Cppcheck to do basic checks in a C++ file.
*/
final class ArcanistCppcheckLinter extends ArcanistExternalLinter {
public function getInfoName() {
return 'Cppcheck';
}
public function getInfoURI() {
return 'http://cppcheck.sourceforge.net';
}
public function getInfoDescription() {
return pht('Use `cppcheck` to perform static analysis on C/C++ code.');
}
public function getLinterName() {
return 'cppcheck';
}
public function getLinterConfigurationName() {
return 'cppcheck';
}
public function getDefaultBinary() {
$prefix = $this->getDeprecatedConfiguration('lint.cppcheck.prefix');
$bin = $this->getDeprecatedConfiguration('lint.cppcheck.bin', 'cppcheck');
if ($prefix) {
return $prefix.'/'.$bin;
} else {
return $bin;
}
}
public function getVersion() {
list($stdout) = execx('%C --version', $this->getExecutableCommand());
$matches = array();
$regex = '/^Cppcheck (?P<version>\d+\.\d+)$/';
if (preg_match($regex, $stdout, $matches)) {
return $matches['version'];
} else {
return false;
}
}
public function getInstallInstructions() {
- return pht('Install Cpplint using `apt-get install cpplint` or similar.');
+ return pht('Install Cppcheck using `apt-get install cppcheck` or similar.');
}
protected function getMandatoryFlags() {
return array(
'--quiet',
'--inline-suppr',
'--xml',
'--xml-version=2',
);
}
protected function getDefaultFlags() {
return $this->getDeprecatedConfiguration(
'lint.cppcheck.options',
array('-j2', '--enable=performance,style,portability,information'));
}
protected function parseLinterOutput($path, $err, $stdout, $stderr) {
$dom = new DOMDocument();
$ok = @$dom->loadXML($stderr);
if (!$ok) {
return false;
}
$errors = $dom->getElementsByTagName('error');
$messages = array();
foreach ($errors as $error) {
foreach ($error->getElementsByTagName('location') as $location) {
$message = new ArcanistLintMessage();
$message->setPath($location->getAttribute('file'));
$message->setLine($location->getAttribute('line'));
$message->setCode('Cppcheck');
$message->setName($error->getAttribute('id'));
$message->setDescription($error->getAttribute('msg'));
switch ($error->getAttribute('severity')) {
case 'error':
$message->setSeverity(ArcanistLintSeverity::SEVERITY_ERROR);
break;
default:
if ($error->getAttribute('inconclusive')) {
$message->setSeverity(ArcanistLintSeverity::SEVERITY_ADVICE);
} else {
$message->setSeverity(ArcanistLintSeverity::SEVERITY_WARNING);
}
break;
}
$messages[] = $message;
}
}
return $messages;
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Nov 8, 09:28 (1 d, 8 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1034404
Default Alt Text
(3 KB)
Attached To
Mode
R118 Arcanist - fork
Attached
Detach File
Event Timeline
Log In to Comment