WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
165453
check-webkit-style: false positive caused by regex literal matching in SingleQuoteChecker
https://bugs.webkit.org/show_bug.cgi?id=165453
Summary
check-webkit-style: false positive caused by regex literal matching in Single...
Matt Baker
Reported
2016-12-05 20:01:33 PST
SingleQuoteChecker strips out regex literals before checking for single quotes, which is a good thing. Unfortunately, the regex that does this matches the wrong thing when a regex contains a forward slash: Tools/Scripts/webkitpy/style/checkers/js.py: 88: line = re.sub('/.+?/', '//', line) Input: /[/'"]/ Expect: ^-----^ Actual: ^-^ Output: //'"]/
Attachments
Add attachment
proposed patch, testcase, etc.
Matt Baker
Comment 1
2016-12-05 20:07:46 PST
Forward slash should be escaped: Input: /[\/'"]/ Expect: ^------^ Actual: ^--^
Ross Kirsling
Comment 2
2017-05-10 14:44:06 PDT
This checker has many other problems too -- it doesn't support template strings, it doesn't allow multiline strings to share a line with actual code, and it doesn't allow you to start a line with (whitespace and) a multiplication operator. Given that ESLint does this properly with an actual parser, it would seem advisable to drop this checker altogether.
Ross Kirsling
Comment 3
2017-05-10 14:56:17 PDT
To be clearer:
> return `'${foo}'`;
is viewed as an error, while
> return 'foo'; /* bar */
is not.
Radar WebKit Bug Importer
Comment 4
2017-07-20 15:59:07 PDT
<
rdar://problem/33440119
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug