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

Side by Side Diff: PRESUBMIT.py

Issue 2873223004: Orphan headers should check only added files (Closed)
Patch Set: Created 3 years, 7 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 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 try: 616 try:
617 sys.path = sys.path + [input_api.os_path.join( 617 sys.path = sys.path + [input_api.os_path.join(
618 input_api.PresubmitLocalPath(), 'tools_webrtc', 'presubmit_checks_lib')] 618 input_api.PresubmitLocalPath(), 'tools_webrtc', 'presubmit_checks_lib')]
619 from check_orphan_headers import GetBuildGnPathFromFilePath 619 from check_orphan_headers import GetBuildGnPathFromFilePath
620 from check_orphan_headers import IsHeaderInBuildGn 620 from check_orphan_headers import IsHeaderInBuildGn
621 finally: 621 finally:
622 # Restore sys.path to what it was before. 622 # Restore sys.path to what it was before.
623 sys.path = original_sys_path 623 sys.path = original_sys_path
624 624
625 for f in input_api.AffectedSourceFiles(input_api.FilterSourceFile): 625 for f in input_api.AffectedSourceFiles(input_api.FilterSourceFile):
626 if f.LocalPath().endswith('.h'): 626 if f.LocalPath().endswith('.h') and f.Action() == 'A':
627 file_path = os.path.abspath(f.LocalPath()) 627 file_path = os.path.abspath(f.LocalPath())
628 root_dir = os.getcwd() 628 root_dir = os.getcwd()
629 gn_file_path = GetBuildGnPathFromFilePath(file_path, os.path.exists, 629 gn_file_path = GetBuildGnPathFromFilePath(file_path, os.path.exists,
630 root_dir) 630 root_dir)
631 in_build_gn = IsHeaderInBuildGn(file_path, gn_file_path) 631 in_build_gn = IsHeaderInBuildGn(file_path, gn_file_path)
632 if not in_build_gn: 632 if not in_build_gn:
633 results.append(output_api.PresubmitError(error_msg.format( 633 results.append(output_api.PresubmitError(error_msg.format(
634 file_path, gn_file_path))) 634 file_path, gn_file_path)))
635 return results 635 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