mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-22 23:02:41 +01:00
Recognize error codes from Flake8 extensions
Summary: Flake8 extensions are allowed to use their own letter-prefixed codes. For example, the flake8-debugger extension emits 'T002'-tagged messages. This change relaxes getLintCodeFromLinterConfigurationKey() to also recognize extension codes. Otherwise, attempting to configure message severities for e.g. 'T002' would result in an exception. Messages from extensions continue to default to ERROR severity, as they did before this change. Test Plan: Successfully reduced the severity of 'T002' to a warning via .arclint: "severity": { "T002": "warning" } Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D15810
This commit is contained in:
parent
a2ab38df78
commit
9b07d1c480
1 changed files with 2 additions and 1 deletions
|
@ -91,12 +91,13 @@ final class ArcanistFlake8Linter extends ArcanistExternalLinter {
|
||||||
} else {
|
} else {
|
||||||
// "E": PEP8 Error
|
// "E": PEP8 Error
|
||||||
// "F": PyFlakes Error
|
// "F": PyFlakes Error
|
||||||
|
// or: Flake8 Extension Message
|
||||||
return ArcanistLintSeverity::SEVERITY_ERROR;
|
return ArcanistLintSeverity::SEVERITY_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getLintCodeFromLinterConfigurationKey($code) {
|
protected function getLintCodeFromLinterConfigurationKey($code) {
|
||||||
if (!preg_match('/^(E|W|C|F)\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 '.
|
||||||
|
|
Loading…
Reference in a new issue