Page MenuHomePhabricator

regex for parsing severity codes in ArcanistCppLinter is wrong
Closed, ResolvedPublic

Description

Noticed T10038, but adding this in case others run into the same problem.

The function getLintCodeFromLinterConfigurationKey($code) in ArcanistCppLinter checks whether a lint message code is valid using:

if (!preg_match('@^[a-z_]+/[a-z_]+$@', $code)) {
...
}

However, this is no longer correct, since the there now exist lint codes such as build/c++11 which fail in this regex. We currently use a modified CppLint class that fixes this as follows:

if (!preg_match('@^[a-z_]+/[a-z0-9_+]+$@', $code)) {
...    
}

Revisions and Commits

Event Timeline

Looks like you are already aware of T8404, and this is a dup; Why did you submit another ticket?

Different (albeit related) bugs:

Problem in T8404 is for the regex in parseLinterOutput (without which the Linter will not work).

This issue is for the regex in getLintCodeFromLinterConfigurationKey (linter will work; you just won't be able to configure the linter fully).

I'll upstream regex changes if they include unit tests.

That shouldn't be a problem. I'll take a look at doing something later in the week, time permitting.

Added a proposed patch. See additional comments in the diff.

epriestley renamed this task from regex in ArcanistCppLinter is wrong to regex for parsing severity codes in ArcanistCppLinter is wrong.Jan 14 2016, 2:59 PM
epriestley closed this task as Resolved.
epriestley claimed this task.

Resolved by D15019.