Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/ArcanistFlake8Linter.php
Context not available. | |||||
list($stdout) = execx('%C --version', $this->getExecutableCommand()); | list($stdout) = execx('%C --version', $this->getExecutableCommand()); | ||||
$matches = array(); | $matches = array(); | ||||
if (preg_match('/^(?P<version>\d+\.\d+(?:\.\d+)?)\b/', $stdout, $matches)) { | if (@preg_match('/^(?P<version>\d+\.\d+(?:\.\d+)?)\b/', $stdout, $matches)) { | ||||
return $matches['version']; | return $matches['version']; | ||||
} else { | } else { | ||||
return false; | return false; | ||||
Context not available. | |||||
$messages = array(); | $messages = array(); | ||||
foreach ($lines as $line) { | foreach ($lines as $line) { | ||||
$matches = null; | $matches = null; | ||||
if (!preg_match($regexp, $line, $matches)) { | if (!@preg_match($regexp, $line, $matches)) { | ||||
continue; | continue; | ||||
} | } | ||||
foreach ($matches as $key => $match) { | foreach ($matches as $key => $match) { | ||||
Context not available. | |||||
} | } | ||||
protected function getDefaultMessageSeverity($code) { | protected function getDefaultMessageSeverity($code) { | ||||
if (preg_match('/^C/', $code)) { | if (@preg_match('/^C/', $code)) { | ||||
// "C": Cyclomatic complexity | // "C": Cyclomatic complexity | ||||
return ArcanistLintSeverity::SEVERITY_ADVICE; | return ArcanistLintSeverity::SEVERITY_ADVICE; | ||||
} else if (preg_match('/^W/', $code)) { | } else if (@preg_match('/^W/', $code)) { | ||||
// "W": PEP8 Warning | // "W": PEP8 Warning | ||||
return ArcanistLintSeverity::SEVERITY_WARNING; | return ArcanistLintSeverity::SEVERITY_WARNING; | ||||
} else { | } else { | ||||
Context not available. | |||||
} | } | ||||
protected function getLintCodeFromLinterConfigurationKey($code) { | protected function getLintCodeFromLinterConfigurationKey($code) { | ||||
if (!preg_match('/^[A-Z]\d+$/', $code)) { | if (!@preg_match('/^[A-Z]\d+$/', $code)) { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
'Unrecognized lint message code "%s". Expected a valid flake8 '. | 'Unrecognized lint message code "%s". Expected a valid flake8 '. | ||||
Context not available. |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0