Block more check_includes overrides from being added.
There is almost never a good reason to add these, so prohibit them in the presubmit. Bug: webrtc:6828 Change-Id: I51100574be2da755ccf5e9c25755341e46fd3a37 Reviewed-on: https://webrtc-review.googlesource.com/38861 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Patrik Höglund <phoglund@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21574}
This commit is contained in:

committed by
Commit Bot

parent
c77b528a20
commit
6f491067c0
18
PRESUBMIT.py
18
PRESUBMIT.py
@ -417,6 +417,23 @@ def CheckPublicDepsIsNotUsed(gn_files, output_api):
|
||||
line_number)))
|
||||
return result
|
||||
|
||||
def CheckCheckIncludesIsNotUsed(gn_files, output_api):
|
||||
result = []
|
||||
error_msg = ('check_includes overrides are not allowed since it can cause '
|
||||
'incorrect dependencies to form. It effectively means that your '
|
||||
'module can include any .h file without depending on its '
|
||||
'corresponding target. There are some exceptional cases when '
|
||||
'this is allowed: if so, get approval from a .gn owner in the'
|
||||
'root OWNERS file.\n'
|
||||
'Used in: %s (line %d).')
|
||||
for affected_file in gn_files:
|
||||
for (line_number, affected_line) in affected_file.ChangedContents():
|
||||
if 'check_includes' in affected_line:
|
||||
result.append(
|
||||
output_api.PresubmitError(error_msg % (affected_file.LocalPath(),
|
||||
line_number)))
|
||||
return result
|
||||
|
||||
def CheckGnChanges(input_api, output_api):
|
||||
source_file_filter = lambda x: input_api.FilterSourceFile(
|
||||
x, white_list=(r'.+\.(gn|gni)$',),
|
||||
@ -433,6 +450,7 @@ def CheckGnChanges(input_api, output_api):
|
||||
result.extend(CheckNoPackageBoundaryViolations(input_api, gn_files,
|
||||
output_api))
|
||||
result.extend(CheckPublicDepsIsNotUsed(gn_files, output_api))
|
||||
result.extend(CheckCheckIncludesIsNotUsed(gn_files, output_api))
|
||||
return result
|
||||
|
||||
def CheckGnGen(input_api, output_api):
|
||||
|
Reference in New Issue
Block a user