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

Side by Side Diff: PRESUBMIT.py

Issue 2974093002: Fix presubmit check for webrtc/base. (Closed)
Patch Set: Created 3 years, 5 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 | « no previous file | 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 WebRTC project authors. All Rights Reserved. 1 # Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
2 # 2 #
3 # Use of this source code is governed by a BSD-style license 3 # Use of this source code is governed by a BSD-style license
4 # that can be found in the LICENSE file in the root of the source 4 # that can be found in the LICENSE file in the root of the source
5 # tree. An additional intellectual property rights grant can be found 5 # tree. An additional intellectual property rights grant can be found
6 # in the file PATENTS. All contributing project authors may 6 # in the file PATENTS. All contributing project authors may
7 # be found in the AUTHORS file in the root of the source tree. 7 # be found in the AUTHORS file in the root of the source tree.
8 8
9 import json 9 import json
10 import os 10 import os
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 problems = [] 515 problems = []
516 516
517 for f in input_api.AffectedFiles(): 517 for f in input_api.AffectedFiles():
518 if os.path.join('webrtc', 'base') in f.LocalPath(): 518 if os.path.join('webrtc', 'base') in f.LocalPath():
519 problems.append(' ' + f.LocalPath()) 519 problems.append(' ' + f.LocalPath())
520 continue 520 continue
521 for line_num, line in f.ChangedContents(): 521 for line_num, line in f.ChangedContents():
522 if 'webrtc/base' in line: 522 if 'webrtc/base' in line:
523 problems.append(' %s: %s' % (f.LocalPath(), line_num)) 523 problems.append(' %s: %s' % (f.LocalPath(), line_num))
524 524
525 return [output_api.PresubmitPromptWarning( 525 if problems:
526 'webrtc/base is being moved to webrtc/rtc_base (See ' 526 return [output_api.PresubmitPromptWarning(
527 'bugs.webrtc.org/7634). Please refer to webrtc/rtc_base instead in the ' 527 'webrtc/base is being moved to webrtc/rtc_base (See '
528 'following files:\n' + '\n'.join(problems))] 528 'bugs.webrtc.org/7634). Please refer to webrtc/rtc_base instead in the '
529 'following files:\n' + '\n'.join(problems))]
530 return []
529 531
530 532
531 def _CommonChecks(input_api, output_api): 533 def _CommonChecks(input_api, output_api):
532 """Checks common to both upload and commit.""" 534 """Checks common to both upload and commit."""
533 results = [] 535 results = []
534 # Filter out files that are in objc or ios dirs from being cpplint-ed since 536 # Filter out files that are in objc or ios dirs from being cpplint-ed since
535 # they do not follow C++ lint rules. 537 # they do not follow C++ lint rules.
536 black_list = input_api.DEFAULT_BLACK_LIST + ( 538 black_list = input_api.DEFAULT_BLACK_LIST + (
537 r".*\bobjc[\\\/].*", 539 r".*\bobjc[\\\/].*",
538 r".*objc\.[hcm]+$", 540 r".*objc\.[hcm]+$",
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 results = [] 662 results = []
661 source_file_filter = lambda x: input_api.FilterSourceFile( 663 source_file_filter = lambda x: input_api.FilterSourceFile(
662 x, white_list=(r'.+\.proto$',)) 664 x, white_list=(r'.+\.proto$',))
663 for f in input_api.AffectedSourceFiles(source_file_filter): 665 for f in input_api.AffectedSourceFiles(source_file_filter):
664 file_path = f.LocalPath() 666 file_path = f.LocalPath()
665 with open(file_path) as f: 667 with open(file_path) as f:
666 lines = f.readlines() 668 lines = f.readlines()
667 if lines[-1] != '\n' or lines[-2] == '\n': 669 if lines[-1] != '\n' or lines[-2] == '\n':
668 results.append(output_api.PresubmitError(error_msg.format(file_path))) 670 results.append(output_api.PresubmitError(error_msg.format(file_path)))
669 return results 671 return results
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698