Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(521)

Side by Side Diff: chrome/browser/resources/web_dev_style/js_checker.py

Issue 251713002: web_dev_style: add check for ending jsdoc comments with **/ instead of */. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: upstream => master Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/resources/test_presubmit.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Presubmit script for Chromium JS resources. 5 """Presubmit script for Chromium JS resources.
6 6
7 See chrome/browser/resources/PRESUBMIT.py 7 See chrome/browser/resources/PRESUBMIT.py
8 """ 8 """
9 9
10 class JSChecker(object): 10 class JSChecker(object):
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 def ConstCheck(self, i, line): 44 def ConstCheck(self, i, line):
45 """Check for use of the 'const' keyword.""" 45 """Check for use of the 'const' keyword."""
46 if self.input_api.re.search(r'\*\s+@const', line): 46 if self.input_api.re.search(r'\*\s+@const', line):
47 # Probably a JsDoc line 47 # Probably a JsDoc line
48 return '' 48 return ''
49 49
50 return self.RegexCheck(i, line, r'(?:^|\s|\()(const)\s', 50 return self.RegexCheck(i, line, r'(?:^|\s|\()(const)\s',
51 'Use /** @const */ var varName; instead of const varName;') 51 'Use /** @const */ var varName; instead of const varName;')
52 52
53 def EndJsDocCommentCheck(self, i, line):
54 msg = 'End JSDoc comments with */ instead of **/'
55 def _check(regex):
56 return self.RegexCheck(i, line, regex, msg)
57 return _check(r'^\s*(\*\*/)\s*$') or _check(r'/\*\* @[a-zA-Z]+.* (\*\*/)')
58
53 def GetElementByIdCheck(self, i, line): 59 def GetElementByIdCheck(self, i, line):
54 """Checks for use of 'document.getElementById' instead of '$'.""" 60 """Checks for use of 'document.getElementById' instead of '$'."""
55 return self.RegexCheck(i, line, r"(document\.getElementById)\('", 61 return self.RegexCheck(i, line, r"(document\.getElementById)\('",
56 "Use $('id'), from chrome://resources/js/util.js, instead of " 62 "Use $('id'), from chrome://resources/js/util.js, instead of "
57 "document.getElementById('id')") 63 "document.getElementById('id')")
58 64
59 def InheritDocCheck(self, i, line): 65 def InheritDocCheck(self, i, line):
60 """Checks for use of '@inheritDoc' instead of '@override'.""" 66 """Checks for use of '@inheritDoc' instead of '@override'."""
61 return self.RegexCheck(i, line, r"\* (@inheritDoc)", 67 return self.RegexCheck(i, line, r"\* (@inheritDoc)",
62 "@inheritDoc is deprecated, use @override instead") 68 "@inheritDoc is deprecated, use @override instead")
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 246
241 if results: 247 if results:
242 results.append(self.output_api.PresubmitNotifyResult( 248 results.append(self.output_api.PresubmitNotifyResult(
243 'See the JavaScript style guide at ' 249 'See the JavaScript style guide at '
244 'http://www.chromium.org/developers/web-development-style-guide' 250 'http://www.chromium.org/developers/web-development-style-guide'
245 '#TOC-JavaScript and if you have any feedback about the JavaScript ' 251 '#TOC-JavaScript and if you have any feedback about the JavaScript '
246 'PRESUBMIT check, contact tbreisacher@chromium.org or ' 252 'PRESUBMIT check, contact tbreisacher@chromium.org or '
247 'dbeam@chromium.org')) 253 'dbeam@chromium.org'))
248 254
249 return results 255 return results
OLDNEW
« no previous file with comments | « chrome/browser/resources/test_presubmit.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698