Commit 66c50ea1 authored by Wez's avatar Wez Committed by Commit Bot

Fix OWNERS canned check to avoid duplicate output.

1. Update PanProjectChecks() to supply source_filter to CheckOwners().
   This prevents files under e.g. third_party/WebKit being checked both
   by the top-level and sub-directory PRESUBMIT rules.
2. Fix CheckOwners() to list missing-OWNERS only for the sub-directory
   it is invoked on, rather than the whole CL. This prevents files under
   sub-directories with their own PRESUBMIT rule, within the same repo,
   from causing OWNERS to be checked for files outside that directory.

BUG=

Change-Id: I9bd5677a69efe9c78b4174a917780d6688991a38
Reviewed-on: https://chromium-review.googlesource.com/426003
Commit-Queue: James Weatherall <wez@chromium.org>
Reviewed-by: 's avatarDirk Pranke <dpranke@chromium.org>
parent 48746657
......@@ -872,7 +872,7 @@ def CheckOwners(input_api, output_api, source_file_filter=None):
output = output_api.PresubmitNotifyResult
affected_files = set([f.LocalPath() for f in
input_api.change.AffectedFiles(file_filter=source_file_filter)])
input_api.AffectedFiles(file_filter=source_file_filter)])
owners_db = input_api.owners_db
owner_email, reviewers = GetCodereviewOwnerAndReviewers(
......@@ -1090,7 +1090,7 @@ def PanProjectChecks(input_api, output_api,
if owners_check:
snapshot("checking owners")
results.extend(input_api.canned_checks.CheckOwners(
input_api, output_api, source_file_filter=None))
input_api, output_api, source_file_filter=sources))
snapshot("checking long lines")
results.extend(input_api.canned_checks.CheckLongLines(
......
......@@ -2196,7 +2196,7 @@ class CannedChecksUnittest(PresubmitTestsBase):
if not is_committing or (not tbr and issue):
if not dry_run:
affected_file.LocalPath().AndReturn('foo/xyz.cc')
change.AffectedFiles(file_filter=None).AndReturn([affected_file])
input_api.AffectedFiles(file_filter=None).AndReturn([affected_file])
if issue and not rietveld_response and not gerrit_response:
rietveld_response = {
"owner_email": change.author_email,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment