Add unexpected files to presubmit error
This makes it easier to debug which files are incorrectly bundled
with other changes.
R=jacktfranklin@chromium.org
Bug: none
Change-Id: Ifdf56da22a164cc2bbc762f79d80f70122f6057e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2817078
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 599cfd6..b75211c 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -97,9 +97,16 @@
if '.gitignore' in affected_files:
num_in_dir = num_in_dir + 1
if num_in_dir < num_affected:
- results.append(output_api
- .PresubmitError(('CLs that affect files in "%s" should be limited to these files/directories.' % dir_list) +
- ' You can disable this check by adding DISABLE_THIRD_PARTY_CHECK=<reason> to your commit message'))
+ unexpected_files = [
+ file for file in affected_files if file not in affected_in_dir
+ ]
+ results.append(
+ output_api.PresubmitError(
+ ('CLs that affect files in "%s" should be limited to these files/directories.'
+ % dir_list) +
+ ('\nUnexpected files: %s.' % unexpected_files) +
+ '\nYou can disable this check by adding DISABLE_THIRD_PARTY_CHECK=<reason> to your commit message'
+ ))
break
return results