Commit 3b974ce1 authored by dbeam's avatar dbeam Committed by Commit bot

web_dev_style: tweak varNamesLikeThis check to detect endsWithUnder_

R=dpapad@chromium.org
BUG=582027

Review-Url: https://codereview.chromium.org/2860903002
Cr-Commit-Position: refs/heads/master@{#469252}
parent 263c1813
......@@ -76,10 +76,10 @@ class JSChecker(object):
"Don't use wrapper types (i.e. new String() or @type {String})")
def VarNameCheck(self, i, line):
"""See the style guide. http://goo.gl/uKir6"""
"""See the style guide. http://goo.gl/eQiXVW"""
return self.RegexCheck(i, line,
r"var (?!g_\w+)([a-z]*[_$][\w_$]*)(?<! \$)",
"Please use var namesLikeThis <http://goo.gl/uKir6>")
r"var (?!g_\w+)(_?[a-z][a-zA-Z]*[_$][\w_$]*)(?<! \$)",
"Please use var namesLikeThis <https://goo.gl/eQiXVW>")
def _GetErrorHighlight(self, start, length):
"""Takes a start position and a length, and produces a row of '^'s to
......
......@@ -370,6 +370,7 @@ class JsCheckerTest(SuperMoxTestBase):
def testVarNameFails(self):
lines = [
"var private_;",
"var hostName_ = 'https://google.com';",
" var _super_private",
" var unix_hacker = someFunc();",
]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment