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

Side by Side Diff: third_party/WebKit/PRESUBMIT.py

Issue 1395493002: Improve error messages from checkperms PRESUBMIT check (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « PRESUBMIT.py ('k') | tools/checkperms/checkperms.py » ('j') | 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) 2013 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2013 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 Blink. 5 """Top-level presubmit script for Blink.
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 """
10 10
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 for line_num, line in f.ChangedContents(): 288 for line_num, line in f.ChangedContents():
289 if pattern.match(line): 289 if pattern.match(line):
290 errors.append(' %s:%d %s' % (f.LocalPath(), line_num, line)) 290 errors.append(' %s:%d %s' % (f.LocalPath(), line_num, line))
291 return errors 291 return errors
292 292
293 293
294 def _CheckFilePermissions(input_api, output_api): 294 def _CheckFilePermissions(input_api, output_api):
295 """Check that all files have their permissions properly set.""" 295 """Check that all files have their permissions properly set."""
296 if input_api.platform == 'win32': 296 if input_api.platform == 'win32':
297 return [] 297 return []
298 path = input_api.os_path.join( 298 args = [input_api.python_executable,
299 '..', '..', 'tools', 'checkperms', 'checkperms.py') 299 input_api.os_path.join(
300 args = [sys.executable, path, '--root', input_api.change.RepositoryRoot()] 300 input_api.change.RepositoryRoot(),
301 'tools/checkperms/checkperms.py'),
302 '--root', input_api.change.RepositoryRoot()]
301 for f in input_api.AffectedFiles(): 303 for f in input_api.AffectedFiles():
302 args += ['--file', f.LocalPath()] 304 args += ['--file', f.LocalPath()]
303 checkperms = input_api.subprocess.Popen( 305 try:
304 args, stdout=input_api.subprocess.PIPE) 306 input_api.subprocess.check_output(args)
305 errors = checkperms.communicate()[0].strip() 307 return []
306 if errors: 308 except input_api.subprocess.CalledProcessError as error:
307 return [output_api.PresubmitError( 309 return [output_api.PresubmitError(
308 'checkperms.py failed.', errors.splitlines())] 310 'checkperms.py failed:',
309 return [] 311 long_text=error.output)]
310 312
311 313
312 def _CheckForInvalidPreferenceError(input_api, output_api): 314 def _CheckForInvalidPreferenceError(input_api, output_api):
313 pattern = input_api.re.compile('Invalid name for preference: (.+)') 315 pattern = input_api.re.compile('Invalid name for preference: (.+)')
314 results = [] 316 results = []
315 317
316 for f in input_api.AffectedFiles(): 318 for f in input_api.AffectedFiles():
317 if not f.LocalPath().endswith('-expected.txt'): 319 if not f.LocalPath().endswith('-expected.txt'):
318 continue 320 continue
319 for line_num, line in f.ChangedContents(): 321 for line_num, line in f.ChangedContents():
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 for master in masters: 364 for master in masters:
363 try_config.setdefault(master, {}) 365 try_config.setdefault(master, {})
364 for builder in masters[master]: 366 for builder in masters[master]:
365 # Do not trigger presubmit builders, since they're likely to fail 367 # Do not trigger presubmit builders, since they're likely to fail
366 # (e.g. OWNERS checks before finished code review), and we're 368 # (e.g. OWNERS checks before finished code review), and we're
367 # running local presubmit anyway. 369 # running local presubmit anyway.
368 if 'presubmit' not in builder: 370 if 'presubmit' not in builder:
369 try_config[master][builder] = ['defaulttests'] 371 try_config[master][builder] = ['defaulttests']
370 372
371 return try_config 373 return try_config
OLDNEW
« no previous file with comments | « PRESUBMIT.py ('k') | tools/checkperms/checkperms.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698