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

Side by Side Diff: PRESUBMIT.py

Issue 9288045: PRESUBMIT check for JavaScript style errors (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes from Dan Created 8 years, 10 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
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 """Top-level presubmit script for Chromium. 5 """Top-level presubmit script for Chromium.
6 6
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
8 for more details about the presubmit API built into gcl. 8 for more details about the presubmit API built into gcl.
9 """ 9 """
M-A Ruel 2012/02/08 14:30:39 Let's remove changes to this file from this CL. I'
Tyler Breisacher (Chromium) 2012/02/08 18:43:41 Done.
10 10
11
12 import re
13
14
15 _EXCLUDED_PATHS = ( 11 _EXCLUDED_PATHS = (
16 r"^breakpad[\\\/].*", 12 r"^breakpad[\\\/].*",
17 r"^native_client_sdk[\\\/].*", 13 r"^native_client_sdk[\\\/].*",
18 r"^net[\\\/]tools[\\\/]spdyshark[\\\/].*", 14 r"^net[\\\/]tools[\\\/]spdyshark[\\\/].*",
19 r"^skia[\\\/].*", 15 r"^skia[\\\/].*",
20 r"^v8[\\\/].*", 16 r"^v8[\\\/].*",
21 r".*MakeFile$", 17 r".*MakeFile$",
22 ) 18 )
23 19
24 20
25 _TEST_ONLY_WARNING = ( 21 _TEST_ONLY_WARNING = (
26 'You might be calling functions intended only for testing from\n' 22 'You might be calling functions intended only for testing from\n'
27 'production code. It is OK to ignore this warning if you know what\n' 23 'production code. It is OK to ignore this warning if you know what\n'
28 'you are doing, as the heuristics used to detect the situation are\n' 24 'you are doing, as the heuristics used to detect the situation are\n'
29 'not perfect. The commit queue will not block on this warning.\n' 25 'not perfect. The commit queue will not block on this warning.\n'
30 'Email joi@chromium.org if you have questions.') 26 'Email joi@chromium.org if you have questions.')
31 27
32 28
33
34 def _CheckNoInterfacesInBase(input_api, output_api): 29 def _CheckNoInterfacesInBase(input_api, output_api):
35 """Checks to make sure no files in libbase.a have |@interface|.""" 30 """Checks to make sure no files in libbase.a have |@interface|."""
36 pattern = input_api.re.compile(r'^\s*@interface', input_api.re.MULTILINE) 31 pattern = input_api.re.compile(r'^\s*@interface', input_api.re.MULTILINE)
37 files = [] 32 files = []
38 for f in input_api.AffectedSourceFiles(input_api.FilterSourceFile): 33 for f in input_api.AffectedSourceFiles(input_api.FilterSourceFile):
39 if (f.LocalPath().startswith('base/') and 34 if (f.LocalPath().startswith('base/') and
40 not f.LocalPath().endswith('_unittest.mm')): 35 not f.LocalPath().endswith('_unittest.mm')):
41 contents = input_api.ReadFile(f) 36 contents = input_api.ReadFile(f)
42 if pattern.search(contents): 37 if pattern.search(contents):
43 files.append(f) 38 files.append(f)
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 return results 328 return results
334 329
335 330
336 def GetPreferredTrySlaves(project, change): 331 def GetPreferredTrySlaves(project, change):
337 only_objc_files = all( 332 only_objc_files = all(
338 f.LocalPath().endswith(('.mm', '.m')) for f in change.AffectedFiles()) 333 f.LocalPath().endswith(('.mm', '.m')) for f in change.AffectedFiles())
339 if only_objc_files: 334 if only_objc_files:
340 return ['mac_rel'] 335 return ['mac_rel']
341 preferred = ['win_rel', 'linux_rel', 'mac_rel'] 336 preferred = ['win_rel', 'linux_rel', 'mac_rel']
342 aura_re = '_aura[^/]*[.][^/]*' 337 aura_re = '_aura[^/]*[.][^/]*'
343 if any(re.search(aura_re, f.LocalPath()) for f in change.AffectedFiles()): 338 if any(input_api.re.search(aura_re, f.LocalPath())
339 for f in change.AffectedFiles()):
344 preferred.append('linux_chromeos') 340 preferred.append('linux_chromeos')
345 return preferred 341 return preferred
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/PRESUBMIT.py » ('j') | chrome/browser/resources/PRESUBMIT.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698