[Webkit-unassigned] [Bug 128422] Web Inspector: update check-webkit-style to flag single quotes in WebInspectorUI projects

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Feb 18 11:16:47 PST 2014


https://bugs.webkit.org/show_bug.cgi?id=128422





--- Comment #12 from Joseph Pecoraro <joepeck at webkit.org>  2014-02-18 11:13:58 PST ---
(From update of attachment 224482)
View in context: https://bugs.webkit.org/attachment.cgi?id=224482&action=review

> Tools/Scripts/webkitpy/style/checkers/js.py:30
> +This checker is only used to check WebInspector Javascript files.

Typo: "Javascript" => "JavaScript".

> Tools/Scripts/webkitpy/style/checkers/js.py:63
> +            # FIXME: Despite stripping comments, there are two single-line comments

Apparently this comment is wrong. There are more then two single-line comments that are not stripped.

> Tools/Scripts/webkitpy/style/checkers/js.py:100
> +        pattern = re.compile(r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"', re.DOTALL | re.MULTILINE)

I wonder if the string regexes are too greedy. Given that they are multiline.

The string regex components are:

    \'(?:\\.|[^\\\'])*\'

and:

    "(?:\\.|[^\\"])*"

Both of these are greedy. I believe the pattern /A(.)*A/ should be /A(.)*?A/. This may explain why some things are not getting stripped properly.

Also, the regex attempts to avoid escape sequences. If you're in a single quoted string it attempts to avoid the sequence |\'| in the regex with [^\\\']. However, that is wrong.

Maybe we should rethink this.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list